13.07.2015 Views

User manual - ICP DAS USA

User manual - ICP DAS USA

User manual - ICP DAS USA

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7. Demo of LinPAC-8000 Modules With C LanguageIn this section, we will focus on examples for the description and application of thecontrol functions on the I-7000/I-8000/I-87k series modules for use in the LinPAC-8000.After you install the LinPAC-8000 SDK, all these demo programs as below are in the pathof “c:/cygwin/LinCon8k/examples”.7.1 I-7k Modules DIO Control DemoThis demo – i7kdio.c will illustrate how to control DI/DO with the I-7050 module (8 DOchannels and 7 DI channels). The address and baudrate of the I-7050 module in theRS-485 network are 02 and 9600 separately.The result of this demo allows the DO channels 0 ~ 7 output and DI channel 2 input.The source code of this demo program is as follows:#include#include#include "msw.h"char szSend[80], szReceive[80], ans;WORD wBuf[12];float fBuf[12];/* ------------------------------------------------------------------- */int main(){int wRetVal;// Check Open_Com3wRetVal = Open_Com(COM3, 9600, Data8Bit, NonParity, OneStopBit);if (wRetVal > 0) {printf("open port failed!\n");return (-1);}// ***** 7050 DO && DI Parameter *******wBuf[0] = 3;// COM PortwBuf[1] = 0x02;// AddresswBuf[2] = 0x7050;// IDwBuf[3] = 0;// CheckSum disablewBuf[4] = 100;// TimeOut , 100 msecondwBuf[5] = 0x0f;// 8 DO Channels OnwBuf[6] = 0;// string debugLinPAC-8x4x SDK:243

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!