Download User Manual

Transcript
Fig.11-4
The result of this demo allows users to control DO channels’ state and returns the
state of the DI channels. The source code of this demo program is as follows:
#include<stdio.h>
#include<stdlib.h>
#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-8114
wRetVal = 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 Port
wBuf[1] = 0x02;
// Address
wBuf[2] = 0x7044;
// ID
wBuf[3] = 0;
// CheckSum disable
wBuf[4] = 100;
// TimeOut , 100 msecond
wBuf[6] = 0;
// string debug
LinCon-8000 SDK Manual:318