Moxa ioPAC 8500-2-M12-C-T [41/66] Mx_modbus_rtu_master_read_coils

Moxa ioPAC 8500-2-M12-C-T [41/66] Mx_modbus_rtu_master_read_coils
Developer's Guide for Moxa RTU Controllers Programmer's Guide
2-33
MX_Modbus_Rtu_Master_Read_Coils
INT32 MX_Modbus_Rtu_Master_Read_Coils(UINT32 port, UINT8 unitId, UINT16 startAddr ,
UINT16 coilCount, UINT8 byteCoils[], UINT32 timeoutMs);
This function performs Modbus function code 0x1; it reads multiple coils and puts the output.
Input Parameters
port
UART port number
ioLogik W5348-C series: the port numbers are 0 and 1
ioPAC 8020-C series: the port number is 0
unitId
Modbus device unit identifier
startAddr
Modbus address
coilCount
The number of read coils
timeoutMs
Timeout value in milliseconds
Output Parameters
byteCoils
This parameter holds the read coils value; 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 the header file libmoxa_pgm.h.
MODBUS_ERR_OK
MODBUS_ERR_LIB_INIT
MODBUS_ERR_PARAM
MODBUS_ERR_UART_WRITE
MODBUS_ERR_TIMEOUT
MODBUS_ERR_RESP
MODBUS_ERR_CRC
MX_Modbus_Rtu_Master_Write_Coils
INT32 MX_Modbus_Rtu_Master_Write_Coils (UINT32 port, UINT8 unitId, UINT16 startAddr,
UINT16 coilCount, UINT8 byteCoils[], UINT32 timeoutMs);
This function performs Modbus function code 0xF. It writes multiple coils, and the coils values.
Input Parameters
port
UART port number
ioLogik W5348-C series: the port numbers are 0 and 1
ioPAC 8020-C series: the port number is 0
unitId
Modbus device unit identifier
startAddr.
Modbus address
coilCount
The numbers of coils
byteCoils
The user should put the coils value in bit-map format
timeoutMs
Timeout value in milliseconds
Output Parameters
None
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_UART_WRITE
MODBUS_ERR_TIMEOUT
MODBUS_ERR_RESP
MODBUS_ERR_CRC

Содержание

Скачать