Modbus problems
Posted: Sat Feb 24, 2018 4:03 pm
Hi there,
I have a PIC 16F1936 that I want to use as a Modbus Master.
A LCD is connected to the PIC, together with a MAX485 and some pushbuttons.
I have tested all kinds of communication but I can't get the communication working.
I have inserted a simple program with the instruction "read coil status" every second.
The program is attached below.
Settings are:
Slave ID = 1
Coil address = 0
Number of coils = 4
Functioncode of "Read coil status" should be 1.
According Modbus specs, the software should send 01 (slave), 01 (function), 00, 00, (coil), 04,00 (number) and checksum.
When the simmulation runs, Flowcode shows that the following code is send:
ReadCoilStatus -> SlaveID:1 FunctionCode:1 Address:0 CoilCount:4 CRC:0xc93d
I use a Modbus sniffer that is called Modsim64.
I have connected this to the RS484 Modbus-port and the software is running.
The software shows traffic on the Modbus port.
The software receives 06, 06, 00, 00, 60, e6, 98, 18 (hex) or 006, 006, 000, 000, 000, 096, 230, 152, 024 (dec)
What is going wrong? please let me know if you have any suggestions.
Rinie
I have a PIC 16F1936 that I want to use as a Modbus Master.
A LCD is connected to the PIC, together with a MAX485 and some pushbuttons.
I have tested all kinds of communication but I can't get the communication working.
I have inserted a simple program with the instruction "read coil status" every second.
The program is attached below.
Settings are:
Slave ID = 1
Coil address = 0
Number of coils = 4
Functioncode of "Read coil status" should be 1.
According Modbus specs, the software should send 01 (slave), 01 (function), 00, 00, (coil), 04,00 (number) and checksum.
When the simmulation runs, Flowcode shows that the following code is send:
ReadCoilStatus -> SlaveID:1 FunctionCode:1 Address:0 CoilCount:4 CRC:0xc93d
I use a Modbus sniffer that is called Modsim64.
I have connected this to the RS484 Modbus-port and the software is running.
The software shows traffic on the Modbus port.
The software receives 06, 06, 00, 00, 60, e6, 98, 18 (hex) or 006, 006, 000, 000, 000, 096, 230, 152, 024 (dec)
What is going wrong? please let me know if you have any suggestions.
Rinie