I start with the following question Arduino can be used in industrial aplicaiones? of course, using a common protocol used in the industry called Modbus Serial RTU in this case configured as Master.
MODBUS communication is done by sending the value of A0 (ADC0) 10 modbus records using a potentiometer 100k variation is performed.
Modbus RTU Frame
Table functions Modbus RTU
For a long time I searched libraries implementing modbus and have used an excellent library
created by smarmengol.
Materials.
1 Arduino
1 Potenciometro 100K
1 Display Oled 128×64
It has been used oled screen Arduino communicate via I2C for validating records both read and written between Arduino and the slave simulator
10 Reading and Writing Holding Registers Holding Registers 10 is carried out, the settlement is set au16data [32] with a capacity of 32 storage registers, records of reading and writing.
Addressing Records
Read 10 Registers 0 – 9 Funcion 3 Read multiple Registers
Holding [0] …. au16data[0]
Holding [1] …. au16data[2]
…………………………..
Holding [8] …. au16data[8]
Holding [9] …. au16data[9]
Write 10 Registers 10 a 19 Funcion 16 Write multiple Registers
Holding [10] …. au16data[10]
Holding [11] …. au16data[12]
……………………………………….
Holding [18] …. au16data[18]
Holding [19] …. au16data[19]
Connection PyModSlaveQt simulator.
Reading Record
Holding Registers from Simulator
Holding Registers from Arduino
Writing Records
Holding Registers from Simulator
Holding Registers from Arduino
Realized tests
Downloads GitHub : Arduino source code Instructables : Arduino modbus RTU Master Channel Youtube: JhonValenciaPDAcontrol
1 Reply to “Modbus RTU Master Library tests with Arduino Part 1”