I'm trying to connect to a Xinje PLC via modbus RTP but i keep getting invalid function code exception. Please help!!
IllegalFunctionException: Function code: 0x3f
This is not enough information for me. Is RTP a typo? RTU? The ModbusIO log could be useful, but some of the answers will be in experimenting or reading the Xinje documentation for what Modbus is supported.
The first thing that comes to my mind, and others may know more, is that some PLCs only support certain read/write requests. This is why data sources are supplied with the 'Use multiple write commands only' and 'Contiguous batches only' options. Also, some PLCs only support certain sizes of read requests.
This means Mango got a response but the function code in the response is not valid. This can happen if your RS-485 wiring is not good and there is noise on the line so some of the messages get corrupted. Playing around with the settings Phillip suggest is also a good idea. It's generally expected that you will occasionally get corrupted messages over RS-485 so if this happens ever once and awhile I wouldn't worry about it as long as you are still getting data reliably.