Moxa ioPAC 8500-5-RJ45-C-T [42/66] Mx_modbus_rtu_master_read_discrete_inputs

Moxa ioPAC 8020-5-M12-C-T [42/66] Mx_modbus_rtu_master_read_discrete_inputs
Developer's Guide for Moxa RTU Controllers Programmer's Guide
2-34
MX_Modbus_Rtu_Master_Write_Coil
INT32 MX_Modbus_Rtu_Master_Write_Coil(UINT32 port, UINT8 unitId, UINT16 addr, UINT8 c
oil,
UINT32 timeOutMs);
This function performs Modbus function code 0x5; it writes a single coil.
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
addr
Modbus address
coil
coil value: 0 or 1
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
MX_Modbus_Rtu_Master_Read_Discrete_Inputs
INT32 MX_Modbus_Rtu_Master_Read_Discrete_Inputs(UINT32 port, UINT8 unitId, UINT16
startAddr , UINT16 coilCount, UINT8 byteCoils[], UINT32 timeoutMs);
This function performs Modbus function code 0x2; it reads multiple discrete inputs.
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 input coilds
timeoutMs
Timeout value in millisecond
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_UART_WRITE
MODBUS_ERR_TIMEOUT
MODBUS_ERR_RESP
MODBUS_ERR_CRC

Содержание

Скачать