4. Modbus RTU报错error code :MODBUSERROR_CRC 、MODBUSERROR_NO_RESPONSE、MODBUSERROR_ILLEGAL_FUNCTION

报错:MODBUSERROR_ILLEGAL_FUNCTION

A:

①检查功能块是不是写错了,writereg和readreg要分开用

②授权异常,检查控制器中的授权,是否临时授权和永久授权混用,可将永久授权剪切出来,暂时用临时授权

报错:MODBUSERROR_NO_RESPONSE 和 MODBUSERROR_CRC MODBUSERROR_ILLEGAL_FUNCTION
A:

①先用modbus调试工具进行通讯,并检查线路是否正确接线

②如果用的是485的方式通讯,修改COE参数通道的值如下,将enable half duplex =true 和 enable point to point connect = false

1

2


以下附上报错列表

Modbus RTU Error Codes

TYPE MODBUS_ERRORS :

( (* Modbus communication errors *)

MODBUSERROR_NO_ERROR, (* 0 *)

MODBUSERROR_ILLEGAL_FUNCTION, (* 1 *)

MODBUSERROR_ILLEGAL_DATA_ADDRESS, (* 2 *)

MODBUSERROR_ILLEGAL_DATA_VALUE, (* 3 *)

MODBUSERROR_SLAVE_DEVICE_FAILURE, (* 4 *)

MODBUSERROR_ACKNOWLEDGE, (* 5 *)

MODBUSERROR_SLAVE_DEVICE_BUSY, (* 6 *)

MODBUSERROR_NEGATIVE_ACKNOWLEDGE, (* 7 *)

MODBUSERROR_MEMORY_PARITY, (* 8 *)

MODBUSERROR_GATEWAY_PATH_UNAVAILABLE, (* A *)

MODBUSERROR_GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND, (* B *) (* additional Modbus error definitions *)

MODBUSERROR_CHARREC_TIMEOUT := 16#20, (* 20 hex *)

MODBUSERROR_ILLEGAL_DATA_SIZE, (* 21 hex *)

MODBUSERROR_ILLEGAL_DEVICE_ADDRESS, (* 22 hex *)

MODBUSERROR_ILLEGAL_DESTINATION_ADDRESS, (* 23 hex *)

MODBUSERROR_ILLEGAL_DESTINATION_SIZE, (* 24 hex *)

MODBUSERROR_NO_RESPONSE, (* 25 hex *) (* Low level communication errors *)

MODBUSERROR_TXBUFFOVERRUN := 102, (* 102 *)

MODBUSERROR_SENDTIMEOUT := 103, (* 103 *)

MODBUSERROR_DATASIZEOVERRUN := 107, (* 107 *)

MODBUSERROR_STRINGOVERRUN := 110, (* 110 *)

MODBUSERROR_INVALIDPOINTER := 120, (* 120 *)

MODBUSERROR_CRC := 150, (* 150 *) (* High level PLC errors *)

MODBUSERROR_INVALIDMEMORYADDRESS := 232, (* 232 *)

MODBUSERROR_TRANSMITBUFFERTOOSMALL (* 233 *) ); END_TYPE