You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.4 KiB
45 lines
1.4 KiB
3 months ago
|
/*
|
||
|
* Generic MODBUS Library for STM32: Protocol Constants
|
||
|
*
|
||
|
* (c) 2019--2022 Martin Mareš <mj@ucw.cz>
|
||
|
*/
|
||
|
|
||
|
enum modbus_function {
|
||
|
MODBUS_FUNC_READ_COILS = 0x01,
|
||
|
MODBUS_FUNC_READ_DISCRETE_INPUTS = 0x02,
|
||
|
MODBUS_FUNC_READ_HOLDING_REGISTERS = 0x03,
|
||
|
MODBUS_FUNC_READ_INPUT_REGISTERS = 0x04,
|
||
|
MODBUS_FUNC_WRITE_SINGLE_COIL = 0x05,
|
||
|
MODBUS_FUNC_WRITE_SINGLE_REGISTER = 0x06,
|
||
|
MODBUS_FUNC_READ_EXCEPTION_STATUS = 0x07,
|
||
|
MODBUS_FUNC_DIAGNOSTICS = 0x08,
|
||
|
MODBUS_FUNC_GET_COMM_EVENT_COUNTER = 0x0b,
|
||
|
MODBUS_FUNC_GET_COMM_EVENT_LOG = 0x0c,
|
||
|
MODBUS_FUNC_WRITE_MULTIPLE_COILS = 0x0f,
|
||
|
MODBUS_FUNC_WRITE_MULTIPLE_REGISTERS = 0x10,
|
||
|
MODBUS_FUNC_REPORT_SLAVE_ID = 0x11,
|
||
|
MODBUS_FUNC_READ_FILE_RECORD = 0x14,
|
||
|
MODBUS_FUNC_WRITE_FILE_RECORD = 0x15,
|
||
|
MODBUS_FUNC_MASK_WRITE_REGISTER = 0x16,
|
||
|
MODBUS_FUNC_READ_WRITE_MULTIPLE_REGISTERS = 0x17,
|
||
|
MODBUS_FUNC_READ_FIFO_QUEUE = 0x18,
|
||
|
MODBUS_FUNC_ENCAPSULATED_INTERFACE_TRANSPORT = 0x2b,
|
||
|
};
|
||
|
|
||
|
enum modbus_error {
|
||
|
MODBUS_ERR_ILLEGAL_FUNCTION = 0x01,
|
||
|
MODBUS_ERR_ILLEGAL_DATA_ADDRESS = 0x02,
|
||
|
MODBUS_ERR_ILLEGAL_DATA_VALUE = 0x03,
|
||
|
MODBUS_ERR_SLAVE_DEVICE_FAILURE = 0x04,
|
||
|
MODBUS_ERR_ACKNOWLEDGE = 0x05,
|
||
|
MODBUS_ERR_SLAVE_DEVICE_BUSY = 0x06,
|
||
|
MODBUS_ERR_MEMORY_PARITY_ERROR = 0x08,
|
||
|
MODBUS_ERR_GATEWAY_PATH_UNAVAILABLE = 0x0a,
|
||
|
MODBUS_ERR_GATEWAY_TARGET_DEVICE_FAILED = 0x0b,
|
||
|
};
|
||
|
|
||
|
enum modbus_encapsulated_interface_transport_type {
|
||
|
MODBUS_EIT_CANOPEN = 0x0d,
|
||
|
MODBUS_EIT_READ_DEVICE_IDENT = 0x0e,
|
||
|
};
|