Using Modbus Protocol with Vehicle Monitoring Devices

The Modbus protocol is the most common industry protocol for M2M communication. It is a de facto standard and is supported by almost all manufacturers of industrial equipment.


Due to its versatility and openness, the standard allows the integration of equipment from different manufacturers. Modbus is used for collecting readings from sensors, controlling relays and controllers, monitoring, etc.


There are 3 formats of the Modbus protocol: Modbus RTU, Modbus TCP, Modbus ASCII. Modbus ASCII is almost never found in nature and for this reason we are not interested now.


Modbus TCP is designed to work in local networks. Also not our case.


Modbus RTU is the most common option. Works on top of RS-485/232. What you need. Below, the term Modbus will describe exactly this format.


Since Modbus is designed to work with prom. automation, then the internal structure of the protocol primarily describes the parameters of prom. Automation, such as digital inputs and outputs, analog inputs and outputs. Those who do not have enough (and such an overwhelming majority) make their add-ons over the protocol.


Below is a picture with a description and some terms from the protocol.


All parameters are divided on the one hand into inputs and outputs. Inputs can only be read, and outputs can be read and written.


On the other hand, there are discrete inputs / outputs in the size of one bit and 16-bit registers (which is typical, in the size of 16 bits).


There are read and write functions for working with these four groups of parameters.


For example, the READ DISCRETE INPUTS function with code 2 is used to read digital inputs.


image


Currently, the UMK-302 terminals have read functions of all standard types, such as 1, 2, 3, and 4.


In addition, the Modbus protocol assumes that there are devices with two different roles:
Master - a master device that polls all other devices. There can be only one master on the bus.


Slave – . . 1 247. . .


1. Modbus 302


Modbus 302 2.11.0


302 Master Modbus Slave .
302 32 . 32 Slave , 32 Slave .


Modbus . RS-485 «RS485 8,19200», 8 – Modbus, 19200 – .


( ), , . , 2 , 9 . , , 7 . Modbus . «SetMdb 1,0x1FF01FF», 1 – , 0x1FF01FF , .


image


:


image


Wialon IPS 1.1 2.0 , . .. Mdb0- Mdb8, Mdb16- Mdb24.


Wialon Combine «Custom Parameters» 256 287. .. Mdb0 param256, Mdb1 param257 ..


image


2.


.


. .


«» --1. . .


image


.


image


9 , . Modbus , 9 , .


302 Modbus , . .
-.
.


«MDBPARAMn [X[,Y[,Z[,A[,B]]]]]», n – 0 31.
X – 1 247 0, .
Y – . .
Z – .
A – . CAN-.
B – . CAN-.


image


Y :


Y=0 – 1. 1 Coils;
Y=1 – 2. 1 Input Discrete;
Y=2 – 3. 1 Holding Registers. . 0…65535. Y=3 – 3. 1 Holding Registers. -32768…32767 Y=4 – 4. 1 Input Register. . 0…65535.
Y=5 – 4. 1 Input Register. -32768…32767
Y=6 – 3. 2 Holding Registers. float. ( 1023).
Y=7 – 4. 2 Input Register. float. ( 1023).
Y=8 – 3. 2 Holding Registers. . ( 1023).
Y=9 – 4. 2 Input Register. . ( 1023).


. . .


1 . . :


image


5 :
MdbParam0 1,7,0,,I
MdbParam1 1,7,2,,U
MdbParam2 1,7,4,,PP
MdbParam3 1,7,6,,E
MdbParam4 1,7,8,,Uin


:
MdbParam5 1,5,12,,T


:
MdbParam6 1,9,13,,Twork
MdbParam7 1,9,15,,Tstab



MdbParam8 1,7,18,,SP


. «Mdb»


image


: 0, 1, 2, 4, 5 .


3 3200. . .
MdbParam3 1,7,6,x/3200,E


Parameters 6 and 7 are displayed in seconds.
Let's translate into hours through the recalculation formula: MdbParam6 1,9,13, x / 3600, Twork
MdbParam7 1,9,15, x / 3600, Tstab
Parameter 8 is not displayed. The simulator does not support this parameter. Apparently the parameter appeared on the map later.


Reboot. We look at the story.


image


The survey is configured. We look at the result in the transport monitoring system.


image


All Articles