ICP DAS
LinPAC-52xx Series XV-Board API User Manual
20
Example:
int RetValue, comport=COM1, count=4;
int addr=0;
/* Refer to [Remark 1] */
char szBuf[80];
DWORD baudrate=115200, dwValue=15;
/* Open the device file */
RetValue=Open_Com(comport, baudrate, Data8Bit, NonParity, OneStopBit);
if (RetValue > 0) {
printf("open
COM%d
failed!\n",comport);
return
FAILURE;
}
memset(szBuf, 0, sizeof(szBuf));
szBuf[0]=dwValue & 0xff;
szBuf[1]=(dwValue >> 8) & 0xff;
szBuf[2]=(dwValue >> 16) & 0xff;
szBuf[3]=(dwValue >> 24) & 0xff;
RetValue=setXVBit(comport, addr, count, szBuf, sizeof(szBuf));
Close_Com(comport);
Remarks:
[1] This is the input value reference address mapping (Modbus register table) for the '
wAddr
'
parameter.
More information regarding address mapping can be found at:
http://ftp.icpdas.com.tw/pub/cd/linpac/napdos/lp-5000/lp-52xx/lp-5231/user_manual/xv-boar