
Click on “Benefits Are Here! Free PLC Resources, Do You Want It?“
1.What Are the Differences Between ModBus RTU and ModBus Communication Protocol?
ModBus protocol is an application layer message transmission protocol (OSI model layer 7), which defines a protocol data unit (PDU) independent of the communication layer, that is, PDU=Function Code+Data Field.
ModBus protocol can be applied to different types of buses or networks. For different buses or networks, Modbus protocol introduces additional field mappings into the application data unit (ADU), that is, ADU=Additional Field+PDU. Currently, there are three communication modes for Modbus:
1. Ethernet, corresponding communication mode is MODBUS TCP.
2. Asynchronous serial transmission (various media such as wired RS-232-/422/485/; fiber optics, wireless, etc.), corresponding communication modes are MODBUS RTU or MODBUS ASCII.
3. High-speed token passing network, corresponding communication mode is Modbus PLUS.
2.Questions About MODBUS RTU Communication Protocol?
Modbus mainly consists of station address (one byte) + function code (one byte) + starting address (two bytes) + number of words accessed (two bytes) + checksum (CRC16 or LRC, two bytes) totaling 8 bytes. Actually, programming in VB is very simple by adding the MSComm component, the difficult part is the checksum.
3.What Are Modbus, RTU, and Modbus RTU?
Modbus protocol is the standard protocol in the industrial control industry, originally written by Modicon, now acquired by Schneider.
Modbus is divided into two types of protocols: serial protocol (Modbus RTU) and network protocol (Modbus TCP). Generally, industrial control computers only support RS-232 or RS-485 serial modes, at which point the protocol stack of the industrial control computer only contains the Modbus RTU protocol. When it receives data from the serial port, it directly controls based on the data in the message. If transmission using Modbus TCP protocol is needed, a PLC with a network port is required.
The specific frame format is as follows:
Modbus RTU Address FieldFunction CodeDataError Check
Modbus TCP Destination AddressProtocolID LengthUnit NumberFunction CodeData
Simply put, TCP is derived from RTU, while RTU is another concept that is not included in the Modbus protocol, and refers to devices in the industrial control industry.
4.Some Questions About Commands Sent by the MODBUS RTU Master
01 Read Coil Status (Read Coil Status)
02 Read Input Status (Read Input Status)
03 Read Holding Register (Read Holding Register)
04 Read Input Register (Read Input Register)
05 Write Single Coil (Force Single Coil)
06 Write Single Register (Preset Single Register)
15 Write Multiple Coils (Force Multiple Coils)
16 Write Multiple Registers (Preset Multiple Registers)
What Do These Mean?
Answer:01 Read the status of the logical coil group
02 Read the status of the discrete coil group
03 Read the binary values of one or more holding registers
04 Read the binary values of one or more input registers
05 Change the status of the logical coil
06 Change the binary value of a single register
15 Change the binary values of multiple registers
16 Specify the binary values of multiple holding registers
5.How to Convert OPC to Modbus RTU?
I currently have an OPC server with many tags, tags come from AB, how do I connect the tags to Modbus?
Profibus, Fielbus, Modbus, CC-link, etc. are communication protocols supported by various PLC hardware, which is the attribute of each vendor’s hardware. However, computer configuration software now supports many protocols for PLCs. You misunderstood.
Profibus, Fielbus, Modbus, CC-link are communication protocols that generally do not require programming, just like using a computer, you do not need to write the IP protocol, you just need to follow it.
Following means that you must set the hardware according to the communication protocol supported by the manufacturer when configuring PLC or DCS hardware. In fact, this is very simple. Here, simple means that you learn programming, focusing on writing programs for executing control actions, and you do not need to write the hardware communication protocol yourself.
6.What Is Modbus RTU Master?
It is selecting the RTU mode because MODBUS is divided into ASCII mode and RTU mode, MASTER is set as the master station, usually the PLC end, and the frequency converter is set as the slave station. It is also necessary to pay attention to the settings of the master and slave addresses.
7.Why Does Modbus RTU Not Have Start and End Markers?
Since each byte of Modbus RTU frame is a hexadecimal number, with a value range of 00~FF, if using 02 and 03 to represent start and end markers like in Modbus ASCII, it would conflict with the values 2 and 3, making it impossible to determine whether it is a marker or a value, thus preventing data unpacking.
8.How to Convert Modbus TCP to RTU?
Please carefully check the frame format:
Modbus RTU Address FieldFunction CodeDataError Check
Modbus TCP Destination AddressProtocolID LengthUnit NumberFunction CodeData
Write a program for TCP to RTU and place it in the device to act as a Modbus bridge.
9.Is the MODBUS RTU Communication Line Burnt?
Use a multimeter to measure the outgoing communication line, the voltage should not exceed 5V, which should be fine. Generally, it will not burn anything. When connecting, distinguish between positive and negative. Many products B are positive, measure to check.
10.How to Set Up Touch Screen Modbus RTU?
Generally, it is implemented through macro instructions, of course, there are also those that support RTU in the communication type menu.
11.How Are Floating Point Numbers Stored in the MODBUS RTU Protocol, and How to Convert the Values Read from Floating Point Registers?
The byte format for storing floating point numbers is as follows:
Address +0 +1 +2 +3
Content SEEE EEEE EMMM MMMM MMMM MMMM MMMM MMMM
Here, S represents the sign bit, 1 for negative, 0 for positive.
E is the exponent offset by 127, binary exponent = (EEEEEEEE)-127.
M24 bits of the mantissa are stored in 23 bits, only storing 23 bits, the highest bit is fixed to 1. This method achieves a high number of effective bits with the least number of bits, improving accuracy. Zero is a specific value, where both the exponent and mantissa are also 0.
The floating point number -12.5 is stored as a hexadecimal number 0xC1480000 in the storage area, this value is as follows:
Address +0 +1 +2 +3
Content0xC1 0x48 0x00 0x00
Conversion between floating point and hexadecimal equivalent stored values is quite simple. The following example illustrates how the above value -12.5 is converted. The floating point stored value is not in a direct format, to convert to a floating point number, the bits must be separated as listed in the floating point storage format table above, for example:
Address +0 +1 +2 +3
Format SEEEEEEE EMMM MMMM MMMM MMMM MMMM MMMM
Binary11000001 01001000 00000000 00000000
Hexadecimal C1 48 00 00
From this example, the following information can be obtained:
The sign bit is 1, indicating a negative number.
The exponent is binary 10000010 or decimal 130, 130 minus 127 is 3, which is the actual exponent.
The mantissa is the following binary number 10010000000000000000000
There is an omitted decimal point and 1 on the left of the mantissa; this 1 is often omitted in floating point storage, adding a 1 and decimal point to the beginning of the mantissa gives the mantissa value as follows:
1.10010000000000000000000
Next, adjust the mantissa according to the exponent. A negative exponent shifts the decimal point to the left. A positive exponent shifts the decimal point to the right. Since the exponent is 3, the mantissa is adjusted as follows:
1100.10000000000000000000
The result is a binary floating point number, with the binary number to the left of the decimal point representing the power of 2 at that position, for example:
(1*2^3)+(1*2^2)+(0*2^1)+(0*2^0)=12.
The right side of the decimal point also represents the power of 2 at that position, but the exponent is negative. For example:
.100… represents (1*2^(-1))+(0*2^(-2))+…=0.5.
The sum of these values is 12.5. Since the set sign bit indicates this number is negative, the hexadecimal value 0xC1480000 represents -12.5.
12.For RS-485 Devices Following MODBUS-RTU Protocol, How to Read Information Using a Computer?
Use the computer’s serial port, connect a 485 converter to the device’s 485 interface, then find a serial port software to send Modbus messages according to the register addresses on the device documentation, the Modbus message is sent through the serial port software, message format:0103 00 00 00 01 840A Read Register Command.
13.How to Write Data from vbmodbus to modScan32rtu?
Determine which software is the master and which is the slave. Then determine whether the communication protocol is RTU, ASCII, or TCP. If it is TCP, use the socket control. For RTU/ASCII, use the COM control. Then receive and send data according to the protocol and parse it accordingly.
14.What Are the Differences Between ModBus RTU Communication Protocol and ModBus Communication Protocol?
Modbus protocol includes MODBUS RTU.
15.How to Determine Timeout in Modbus RTU Communication Protocol?
Set a flag variable to indicate whether there is a timeout; then use a timer, with the timing duration set to the time taken to send 3.5 characters (of course, for safety, the time can be longer); set the timeout flag in the timer; in the serial port interrupt, reset the timer each time a byte is received; in the main program, perform corresponding processing based on the timeout flag.
16.How to Understand the 1.5 and 3.5 Character Intervals in MODBUS RTU Protocol?
There must be a certain time interval between sending two frames of data to ensure that the receiving UART can distinguish them. This time interval in MODBUS RTU mode requires a 1.5 and 3.5 character interval, which is the time to transmit 1.5 and 3.5 characters, related to the set communication parameters, calculated as:
If the serial communication parameters are set as (note: the start bit is fixed to 1): data bit 8, parity bit 1, stop bit 1, baud rate 9600bps, then the time to transmit one character (that is, 1 byte) is: (1+8+1+1)/9600=0.00114583s=1.1454583ms
1.5 character interval =1.5×1.1454583ms=1.71818745ms
3.5 character interval =3.5×1.1454583ms=4.00910405ms
17.What Testing Software is Available for MODBUS RTU?
Recommended:modscan32 and the latest modbus poll
18.In MODBUS RTU Protocol, Communication Between Host and Instrument Reads and Writes Data Correctly, Why Are Parameters Lost After Powering Off the Instrument? How to Save?
There are two possibilities:
1. If the instrument does not save parameters after power off, it can be determined that it is an instrument problem;
2. Some instruments require writing confirmation parameters to a fixed register after writing parameters to ensure the correctness of the written parameters; check the instrument communication section of the manual.
-END-
[Recommended Reading]
The Most Comprehensive Explanation of Analog Quantity, Must-Read for Instrument Automation and Related Personnel
Learn Control with Xiao Z – The Concept of Digital Quantity and Its Generation and Signal Types in Industrial Production
A Diagram to Help You Understand the Processing of Analog Input Signals, This Article is Helpful for Configuration and Maintenance Engineers!
Learn Control with Xiao Z – How Digital Signals are Input into Automatic Control Systems and How the Automatic Control System Processes Them
A Diagram to Help You Understand Analog Output
Learn Control with Xiao Z – Processing of Digital Signal Output and Introduction to Digital Signals Needed in Industrial Sites
Learn Control with Xiao Z – Display and Control of Digital Signals
