Data concurrent processing control system based on 485 bus
By monitoring the status in real time on the 485 bus and using data broadcasting and random delay mechanisms to optimize data transmission, the problem of low data transmission efficiency of traditional 485 bus is solved, and fast and reliable data acquisition is achieved, which is suitable for multi-device scenarios.
Patent Information
- Application Number
- CN202411289692.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The traditional 485 bus data transmission method is inefficient, especially when the number of slaves is large, it takes a long time to read all sensor data. There is a risk of data loss and cannot meet the growing data transmission needs.
Design a data concurrency processing control system based on 485 bus, and optimizes data transmission by monitoring the bus status in real time, using data broadcasting and random delay mechanisms. The controller has a collection module to compress and filter the data, and only when the data changes. Transmission is performed and the data transmission order is optimized by random delay and waiting times.
It greatly improves data acquisition efficiency. The traditional time required to be 30 seconds or even longer is shortened to less than 2 seconds, and the maximum suspension of 256 devices is significantly reduced, significantly reducing the risk of data loss.
Smart Images

Figure CN119071102A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of communication, and in particular to a 485 bus-based data concurrent processing control system. Background Art
[0002] With the development of industrial automation and intelligence, the efficiency and stability of data transmission have become particularly important. As a serial communication interface widely used in industrial sites, the 485 bus is favored for its high reliability, strong anti-interference and long-distance transmission capability. However, the traditional 485 bus data transmission method generally adopts a polling solution, such as Figure 1 As shown, a one-master-multiple-slave structure is adopted. If the master station needs to collect data from the slave stations, it needs to poll multiple times. If there are many slave stations, it often takes a long time to read all the sensor data. This is inefficient, the data transmission speed is slow, and there may even be a risk of data loss, which cannot meet the growing data transmission needs. Summary of the invention
[0003] The object of the present invention is to provide a 485 bus data concurrent processing control system to solve one or more of the above problems.
[0004] The present invention proposes a 485 bus-based data concurrent processing control system, comprising a plurality of devices and a 485 bus for connecting the plurality of devices to establish communication, each device is provided with a controller, a 485 chip, and a sensor, two serial ports of the controller are respectively connected to a 485 chip, one of the 485 chips is connected to the sensor, and the other 485 chip is connected to the sensor; Each device monitors the real-time data on the 485 bus in real time to determine whether the 485 bus is in an idle state. When the 485 bus is in an idle state, if a device issues a data transmission request, it will broadcast the data on the bus after a random delay. When other devices receive this broadcast data, they will suspend data transmission until the 485 bus is in an idle state again.
[0005] In some embodiments, A plurality of the above devices are sequentially connected in parallel with the terminal matching resistors on the 485 bus; The device is also provided with a power supply; The controller is a single chip microcomputer.
[0006] In some embodiments, The single chip microcomputer is an STM32 single chip microcomputer; The power supply is a DCDC power supply.
[0007] In some embodiments, the controller is provided with a collection module, which compresses and filters the data collected by the 485 chip. If the data changes by a preset ratio, the data on the corresponding device is sent normally, otherwise the data is not sent.
[0008] In some embodiments, the controller has preset rules for determining whether the 485 bus is in an idle state, and the rules are: when monitoring the 485 bus in real time, if the time when there is no data on the 485 bus is greater than the preset idle time, then it is determined that the current 485 bus is in an idle state, otherwise it is determined that the 485 bus is busy.
[0009] In some implementations, the preset idle time length is 3 bytes of time.
[0010] In some embodiments, when the 485 bus is in an idle state and multiple devices issue data transmission requests, the waiting times of the devices that issue data transmission requests are all 0, and the random reference time of each device is screened within a preset system random reference time range. Devices with smaller random reference times have priority over devices with larger random reference times to broadcast data on the 485 bus. When one device on the 485 bus is broadcasting data, the waiting times of other devices that issue data transmission requests are increased by 1. When the device broadcasting data on the 485 bus has completed sending data, other devices that issue data transmission requests set random delays, and devices with smaller random delay times have priority over devices with larger random delay times to broadcast data on the 485 bus. This cycle is repeated until all devices that issue data transmission requests have completed sending data.
[0011] In some embodiments, The random delay is X*random reference time, where X is the preset threshold minus the number of waiting times; The system random reference time is greater than or equal to 1.5 byte times.
[0012] In some embodiments, The preset threshold is 4; The system random reference time is 1.5 byte times to 5 byte times.
[0013] In some implementations, the system random reference time ranges from 2 to 5 ms.
[0014] The advantages of the 485 bus data concurrent processing control system described in the present invention are: 1. The acquisition end has the ability to compress and process data. When the data changes within a certain range, the data is transmitted, which greatly saves the cost of the 485 bus; 2. The problem of 485 bus data concurrency is solved by monitoring the bus, sending transmission commands through the phase bus, random delay, etc. 3. A maximum of 256 devices can be connected to the 485 bus. The control system can shorten the traditional acquisition time of 30 seconds or even longer to less than 2 seconds, greatly improving the acquisition efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is the traditional 485 network bus topology diagram; Figure 2 A 485 bus topology diagram in some implementation modes of the present invention; Figure 3 It is a transmission flow chart of a concurrent processing control system based on 485 bus data in some implementation modes of the present invention; Figure 4 It is a collection flow chart of a concurrent processing control system based on 485 bus data in some implementation modes of the present invention; Figure 5 Schematic diagram of the hardware framework of the device in some embodiments of the present invention. DETAILED DESCRIPTION
[0016] Combination Figures 2 to 5 In this embodiment, a data concurrent processing control system based on 485 bus is proposed, including several devices (such as Figure 1 Devices 1 to n, n is less than or equal to 256) shown in the figure and a 485 bus that connects several devices together to establish communication. Each device is equipped with a controller, a 485 chip, and a sensor. The two serial ports of the controller are respectively connected to a 485 chip, one of which is connected to the sensor, and the other is connected to the sensor. Each device monitors the real-time data on the 485 bus to determine whether the 485 bus is in an idle state. When the 485 bus is in an idle state, the device can issue a data transmission request. If a device issues a data transmission request, it will broadcast data on the bus after a random delay. Other devices will suspend data transmission after receiving the broadcast data until the 485 bus is in an idle state again. Several of these devices are connected in parallel with the terminal matching resistors on the 485 bus in sequence; the power supply can be directly equipped on the device, and the power supply can be a DCDC power supply; the controller can be a single-chip microcomputer, such as: STM32 single-chip microcomputer; the sensor on the device can also be replaced with other embedded devices, etc.
[0017] The controller is equipped with an acquisition module, which can compress and filter the data collected by the 485 chip (the compression and filtering process can be directly implemented using existing technologies, so it will not be described here). The data collected by the 485 chip includes sensor data, controller data, etc. If the data changes within the preset ratio, the data on the corresponding device will be sent normally, otherwise the data will not be sent (for example: if the preset ratio is less than 2%, when the switch data flips from 0-1, and the analog quantity changes by 2%, it is considered that the data has changed by more than the preset ratio, and the data will not be sent). If the data is not sent or the data is not sent for a preset period of time, the device data is re-read (that is, the corresponding acquisition module re-collects the data through the 485 chip).
[0018] The controller has a preset rule for judging whether the 485 bus is in an idle state. The rule is: when monitoring the 485 bus in real time, if the time when there is no data on the 485 bus is greater than the preset idle time, the current 485 bus is judged to be in an idle state, otherwise the 485 bus is judged to be busy. The preset idle time can be set as needed, such as setting the preset idle time to one of 1.5 byte time, 2 byte time and 3 byte time. When it is set to 3 byte time, it can better compatibility with the devices on the 485 bus and increase universality. Taking the preset idle time as 3 byte time as an example, the current baud rate of the 485 bus is 9600, then the single byte time is about 1.05ms, and the 3-byte time is about 3.2ms.
[0019] Combination Figure 3As shown in the content, when the 485 bus is in an idle state and multiple devices issue data transmission requests, the waiting times of the devices that issue data transmission requests are all 0. The random reference time of each device is screened within the preset system random reference time range. The device with a smaller random reference time has priority over the device with a larger random reference time to broadcast data on the 485 bus. When one device on the 485 bus is broadcasting data, the bus is busy, and other devices that issue data transmission requests enter waiting, and the waiting times are increased by 1. When the data broadcasting device on the 485 bus has completed sending data, other devices that issue data transmission requests set random delays. Devices with a smaller random delay have priority over devices with a larger random delay to broadcast data on the 485 bus. This cycle is executed until all devices that issue data transmission requests have completed sending data. The random delay can be X*random reference time, where X is the preset threshold - the waiting times, and the preset threshold can be 4. The specific preset threshold can also be adjusted as needed according to the number of data points and data volume on the network. For example: at this stage, both device 2 and device 3 need to perform data transmission. The random reference time screened out by device 2 is 3ms, and the random time screened out by device 3 is 2.5ms. The current waiting times of everyone are 0. At this time, because the random delay of 3 is smaller than that of 2, 3 will broadcast a data to the bus first. At this time, when 2 receives this data broadcast, it will no longer send data to the bus. The system will increase the waiting times by 1. At this time, the waiting times of device 2 is 1. After 3 has finished sending, 2 will set the delay again and perform data transmission according to the above method.
[0020] The system random benchmark time in the above system random benchmark time range is greater than or equal to 1.5 byte times, and there is no upper limit requirement. However, if the upper limit is too high, the data transmission efficiency will be reduced. Therefore, the system random benchmark time range can be set to 1.5 byte times to 5 byte times, such as: 2-5ms.
[0021] When selecting the random reference time of each device, random screening can be directly adopted, as long as the random reference time is controlled within the random reference time range of the system.
[0022] The above undisclosed matters can all be implemented using existing technologies, so they will not be elaborated here.
[0023] For ordinary technicians, several similar variations and improvements can be made without departing from the creative concept of the present invention, and these should also be regarded as the protection scope of the present invention.
Claims
1. A concurrent processing control system based on 485 bus data, characterized in that: It includes several devices and a 485 bus for connecting the devices to establish communication. Each device is equipped with a controller, a 485 chip, and a sensor. Two serial ports of the controller are respectively connected to a 485 chip, one of which is connected to the sensor, and the other is connected to the sensor. Each device monitors the real-time data on the 485 bus in real time to determine whether the 485 bus is in an idle state. When the 485 bus is in an idle state, if a device issues a data transmission request, it will broadcast the data on the bus after a random delay. When other devices receive this broadcast data, they will suspend data transmission until the 485 bus is in an idle state again.
2. A 485 bus data concurrent processing control system according to claim 1, wherein: A plurality of the above devices are sequentially connected in parallel with the terminal matching resistors on the 485 bus; The device is also provided with a power supply; The controller is a single chip microcomputer.
3. A 485 bus data concurrent processing control system according to claim 2, wherein: The single chip microcomputer is an STM32 single chip microcomputer; The power supply is a DCDC power supply.
4. A 485 bus data concurrent processing control system according to claim 1 or 2, wherein: The controller is provided with a collection module, which compresses and filters the data collected by the 485 chip. If the data changes in a preset proportion, the data on the corresponding device is sent normally, otherwise the data is not sent.
5. A 485 bus data concurrent processing control system according to claim 1, wherein: The controller has preset rules for determining whether the 485 bus is in an idle state. The rule is: when monitoring the 485 bus in real time, if the time when there is no data on the 485 bus is greater than the preset idle time, the current 485 bus is determined to be in an idle state, otherwise the 485 bus is determined to be busy.
6. A 485 bus data concurrent processing control system according to claim 5, wherein: The preset idle time length is 3 bytes of time.
7. A 485 bus data concurrent processing control system according to claim 1, wherein: When the 485 bus is in idle state and multiple devices issue data transmission requests, the waiting times of the devices that issue data transmission requests are all 0. The random reference time of each device is screened within the preset system random reference time range. The device with a smaller random reference time has priority over the device with a larger random reference time to broadcast data on the 485 bus. When there is a device on the 485 bus broadcasting data, the waiting times of other devices that issue data transmission requests are increased by 1. When the device broadcasting data on the 485 bus has completed sending data, other devices that issue data transmission requests set random delays. Devices with a smaller random delay time have priority over devices with a larger random delay time to broadcast data on the 485 bus. This cycle is executed until all devices that issue data transmission requests have completed sending data.
8. A 485 bus data concurrent processing control system according to claim 7, wherein: The random delay is X*random reference time, where X is the preset threshold minus the number of waiting times; The system random reference time is greater than or equal to 1.5 byte times.
9. A 485 bus data concurrent processing control system according to claim 8, wherein: The preset threshold is 4; The system random reference time ranges from 1.5 byte times to 5 byte times.
10. A 485 bus data concurrent processing control system according to claim 9, wherein: The system random reference time range is 2-5ms.
Citation Information
Patent Citations
Method of implementing embedded device address installation by RS 485 bus competition
CN101163075A
485 bus system and asynchronous half-duplex communication method thereof
CN102546141A
Communication enhancement method and system based on 485 bus
CN113395187A
Bus communication address allocation method and system based on NTC (Negative Temperature Coefficient)
CN114301729A
Communication method based on 485 bus and smart home system
CN116582384A
Cited By
Multi-device high real-time control method based on RS485 bus
CN120277020A
