I am an intern and I am currently working on the task of implementing MODBUS-RTU protocol with RS485 as the electrical layer.
I have constructed a simple circuit for 1 master and 2 slaves to communicate serially using the RS485 protocol and have tested it successfully.
Now, I wish to implement the MODBUS protocol for this simple circuit and then use that as a base for complex MODBUS implementations involving larger number of participating devices. For this, I have a acquired good idea of the MODBUS - RTU protocol by going through Modbus_Application_Protocol , Modbus_over_serial_line and Modicon Modbus Implementation Reference Guides - all official documents.
However, now that I have started constructing my code for the slave and master, I am unable to do so easily. Hence, I was looking for guidance on the same. If anyone has implemented the same and can help me with guidance in terms of the code, it would be great. I have been on this since a month and I post this now, because after many efforts I feel the need for some well directed guidance.
In case anyone wished to contact me personally, here is my id - email@example.com
Really appreciate the help.
Have a nice day!
There is simple pascal code for a Modbus master (RTU) here:
You can get a nice free Windows slave simulator here:
Select Downloads then "PeakHMI Slave Simulators"
Refer the following users manual about MODBUS master and slave. This could be helpful for your implementation.
Also, there is a free MODBUS protocol tester master application available for download. This could be helpful for testing your MODBUS slave.
Also you can find a Modbus RTU and TCP slave or master implementation in 'C' source code form at http://www.colwaysolutions.com.
Since the implementation is in ANSI 'C' you can port it easily to PIC too. The vendor also provides ports to a few popular micro controller cores like 8051, ARM, Coldfire etc. including for some RTOS kernels (OS9, MQX, uc-OS). The library is very light weight consuming negligible RAM and ROM space.