ICP DAS
LinPAC-52xx Series XV-Board API User Manual
5
2. XV-Board API functions
The following is an overview of the API functions used by the LP-22xx/52xx series controller that
contains an XV-Board.
2.1. modbusRequest
Description:
This function is used to send a Modbus protocol request.
Syntax:
[ C ]
int
modbusRequest(char cPort, char cNetID, char cFunction, WORD wAddr,
WORD wCount, char szBuf, WORD wBufLen, WORD wTimeout, WORD *wT)
Parameters:
cPort:
[Input] The number of the COM port for the XV-Board. 1=COM1=/dev/ttyO1.
cNetID: [Input] The NetID for the device.
The default slave address for the XV-Board is '1'.
cFunction: [Input]
The
Modbus
RTU protocol function code.
wAddr:
[Input]
The
channel
address.
Note
: Input the channel address mapping in
decimal
format.
wCount:
[Input] The number of channels.
szBuf[ ]:
[Input
/
Output] Used to set or read back the value from a function code.
wBufLen:
[Input] The length of the szBuf[ ].
wTimeout:
[Input] The Timeout setting. The normal value is 100 milliseconds.
*wT:
[Output] The total duration of the send/receive interval. Unit=1 ms.
Return Values:
0: The function was successfully processed.
Other: The processing failed.
Refer to Chapter 3: “
” for details of other returned values.