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.

The result of this demo allows users to control DO channels’ state and returns thestate of the DI channels. 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, j=0;char i[10];// Check Open_Com9 in I-8114WwRetVal = Open_Com(COM9, 115200, Data8Bit, NonParity, OneStopBit);if (wRetVal > 0) {printf("open port failed!\n");return (-1);}// ***** 7044 DO & DI Parameter *******wBuf[0] = 9;// COM PortwBuf[1] = 0x02;// AddresswBuf[2] = 0x7044; // IDwBuf[3] = 0;// CheckSum disablewBuf[4] = 100;// TimeOut , 100 msecondwBuf[6] = 0;// string debug// 7044 DOwhile(j!=113) {printf("Input DO value or press 'q' to quit!! -> ");scanf("%s",i);if (i[0]=='q') {wBuf[5] = 0;// All DO Channels OffwRetVal = DigitalOut(wBuf, fBuf, szSend, szReceive);break;}j=atoi(i);if (j>=0 & j255)wBuf[5] = 255;// DO Channels OnwRetVal = DigitalOut(wBuf, fBuf, szSend, szReceive);if (wRetVal)printf("DigitalOut_7044 Error !, Error Code=%d\n", wRetVal);printf("The DO of 7044 : %u \n", wBuf[5]);LinPAC-8x4x SDK:283

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

Saved successfully!

Ooh no, something went wrong!