Moxa ioPAC 8500-9-RJ45-C-T [48/66] Mx_modbus_tcp_master_read_discrete_inputs

Moxa ioPAC 8500-2-M12-C-T [48/66] Mx_modbus_tcp_master_read_discrete_inputs
Developer's Guide for Moxa RTU Controllers Programmer's Guide
2-40
MX_Modbus_Tcp_Master_Read_Discrete_Inputs
INT32 MX_Modbus_Tcp_Master_Read_Discrete_Inputs(UINT32 sHandle, UINT16 startAddr ,
UINT16 coilCount, UINT8 byteCoils[]);
This function performs Modbus function code 0x2; it reads multiple discrete inputs.
Input Parameters
sHandle
TCP connection handle
startAddr
Modbus address
coilCount
The numbers of discrete inputs.
Output Parameters
byteCoils
This parameter holds the read discrete inputs; users should provide enough buffer space. For
example, if coildCount=9, the buffer size of byteCoils should be at least 2 bytes.
Return Value
Modbus standard error codes are mapped to values 16 to 24. Refer to header file libmoxa_pgm.h.
MODBUS_ERR_OK
MODBUS_ERR_LIB_INIT
MODBUS_ERR_PARAM
MODBUS_ERR_NOT_OPENED
MODBUS_ERR_SOCKET
MODBUS_ERR_TIMEOUT
MODBUS_ERR_RESP
MX_Modbus_Tcp_Master_Read_Input_Regs
INT32 MX_Modbus_Tcp_Master_Read_Input_Regs(UINT32 sHandle, UINT16 startAddr , UINT16
regCount, UINT16 regs[]);
This function performs Modbus function code 0x4; it reads multiple input registers.
Input Parameters
sHandle
TCP connection handle
startAddr
MODBUS address
regCount
The numbers of input registers
timeoutMs
Timeout value in milliseconds
Output Parameters
regs
This parameter holds the read input registers; users should provide enough buffer space. For
example, if regCount =4, the buffer size of regs should be at least 8 bytes.
Return Value
Modbus standard error codes are mapped to values 16 to 24. Refer to the header file libmoxa_pgm.h.
MODBUS_ERR_OK
MODBUS_ERR_LIB_INIT
MODBUS_ERR_PARAM
MODBUS_ERR_NOT_OPENED
MODBUS_ERR_SOCKET
MODBUS_ERR_TIMEOUT
MODBUS_ERR_RESP

Содержание

Скачать