ICP DAS USA LinPAC-22 Series User Manual page 6

Xv-board api functions
Table of Contents

Advertisement

ICP DAS
Example:
int RetValue, timeout=100, count=1, netid=1;
int comport=COM1;
int function=1;
int addr=33;
char szBuf[80];
DWORD baudrate=115200;
WORD wT;
/* Open the device file */
RetValue=Open_Com(comport, baudrate, Data8Bit, NonParity, OneStopBit);
if (RetValue > 0) {
printf("open COM%d failed!\n",comport);
return FAILURE;
}
RetValue=modbusRequest(comport, netid, function, addr, count, szBuf, sizeof(szBuf),
timeout, &wT);
Close_Com(comport);
if (RetValue==0) {
if((function==1)||(function==2))
printf("%d", szBuf[0]);
else {
RetValue=(szBuf[0]<<8)|szBuf[1];
printf("%ld", RetValue);
}
}
/* Refer to [Remark 1] */
/* Refer to [Remark 2] */
/* Refer to [Remark 3] */
LinPAC-52xx Series XV-Board API User Manual
6

Advertisement

Table of Contents
loading

Table of Contents