Precautions for MODBUS

Source: Internet
Author: User
Tags integer numbers

1. When Modbus communication is used, a floating point transmission problem is encountered. Generally, floating point numbers are 32 bits, while Modbus bus can only transmit up to 16 bits of data.
Solution: You can use two integer numbers to transmit a floating point number (dividing a 32-bit binary number into two 16-bit binary numbers). After the transfer, then combine the two integer numbers into a floating point number.

2. During the debugging process, when the data is transmitted to the PLC, it is initially found that the data is not the original value, but some inexplicable data, or it is too big, it is either a negative multiple-digit number.

After repeated attempts, I finally found out the problem. Originally, In the Modbus bus, the data is transmitted in low bytes first. If the data is not exchanged after being transmitted, the binary values are arranged in reverse order, that is, the original low byte is at the High Level and the high byte is at the low level. Therefore, the obtained data is far from the original data. This problem can be solved by exchanging the high/low bytes of data (SWAP position 1.

3. What should I do if the debugging process is always disconnected?
In the debugging process of data communication, if the data is always disconnected, we generally check in this order:
1) are various devices normal,
2) whether the wiring is correct and in good condition;
3) whether the configuration of various devices is correct.
In general, these factors have very few problems, but it is necessary to carefully check these factors. After confirmation, pay attention to the following points:
1) Use a testing software for testing, which can narrow down the scope of the problem. During our debugging process, we used a small test software called "mbus2" to test the wiring and configuration of the traffic computer. Generally, when the software is successfully tested, the overall debugging can be solved. Such test software can be obtained online, like the "mbnus2" and "Modbus View" we use. They are easy to use but extremely effective.
2) if you check that there is no problem but it still does not work, you can try to turn off all devices and restart them. This simple method is often useful during debugging.

Conclusion:
Modbus protocol is used for communication between different devices, which is easy to operate, applicable, and fast to communicate. Therefore, Modbus is a common communication protocol in various industrial control systems. At the same time, Modbus is also a strong field bus. Modbus will play a greater role in realizing real network-based industrial control.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.