CN109981433B - RS485 active data transmission method of aperiodic bus arbitration mechanism - Google Patents
RS485 active data transmission method of aperiodic bus arbitration mechanism Download PDFInfo
- Publication number
- CN109981433B CN109981433B CN201910199383.2A CN201910199383A CN109981433B CN 109981433 B CN109981433 B CN 109981433B CN 201910199383 A CN201910199383 A CN 201910199383A CN 109981433 B CN109981433 B CN 109981433B
- Authority
- CN
- China
- Prior art keywords
- data
- bus
- slave
- address
- address frame
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 20
- 230000005540 biological transmission Effects 0.000 title claims abstract description 17
- 230000001788 irregular Effects 0.000 claims abstract description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000003245 coal Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/40006—Architecture of a communication node
- H04L12/40013—Details regarding a bus controller
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/40006—Architecture of a communication node
- H04L12/40039—Details regarding the setting of the power status of a node according to activity on the bus
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Small-Scale Networks (AREA)
Abstract
The invention discloses an RS485 active data transmission method of an irregular bus arbitration mechanism, which comprises the following steps: judging whether a bus is busy through a master device, if not, judging whether an address frame of a slave device on the bus changes, if so, actively sending a frame of address frame interference data to the bus, receiving and storing the address frame interference data by the slave device, and calculating the order of sending data by the slave device according to the address frame interference data; otherwise, whether data needs to be sent to the slave equipment is judged. The invention can make the slave device sequentially and actively transmit data to the master device by the master device irregularly transmitting the address frame interference data. In addition, the mode that the master device replies data in a unified mode is adopted, the communication mode that the RS485 bus needs to be called and answered every time of communication is avoided, and the bus communication efficiency is improved.
Description
Technical Field
The invention relates to an RS485 active data transmission method of an irregular bus arbitration mechanism.
Background
At present, the following two same communication modes are mainly adopted in the field of coal mines in an RS485 communication mode:
one, single master-slave communication mode. The slave device responds when the master device calls. Slave devices in this communication mode are however unable to actively transmit data,
two, multi-host mode. Any device on the bus is a main device, and the communication between the devices adopts a calling and answering mode. However, in this mode, a call and answer mode must be adopted for every two devices to communicate with each other, and each time a device communicates, a call process must be carried out, which seriously affects the communication efficiency of the bus.
Disclosure of Invention
The invention aims to provide an RS485 active data transmission method of an irregular bus arbitration mechanism, which aims to solve the problems in the existing RS485 communication mode.
In order to solve the above technical problem, the present invention provides an RS485 active data transmission method of an aperiodic bus arbitration mechanism, which includes the following steps:
s1: judging whether the bus is busy through the master device, and if not, judging whether the address frame of the slave device on the bus changes;
s2: if the address frame change of the slave equipment on the bus is judged, actively sending a frame of address frame interference data comprising a plurality of addresses to the bus, receiving and storing the address frame interference data by the slave equipment, and calculating the order of sending data by the slave equipment according to the address frame interference data; and if the address frame of the slave device on the bus is not changed, judging whether data needs to be transmitted to the slave device.
Further, the method further comprises:
s3: after the data transmission of the slave equipment is completed, the master equipment transmits a frame of reply information, wherein the frame of reply information comprises the reply information of all the slave equipment.
Further, when the master device judges that the slave device address frame on the bus changes, the assignment OV is equal to 0; and after the master equipment sends the address frame interference data to the slave equipment, judging whether the sending of the address frame interference data is finished, and if the sending is finished, assigning the value OV to be 1.
Further, the master device sends the data if judging that the data needs to be sent; otherwise, receiving data and starting a timer H1, when the received data exceeds the preset time, enabling OV to be 0 and H1 to be 0, and feeding back the bus fault; and when the received data is completely sent within the preset time, H1 is made to be 0, the bus is fed back to be idle, and the step of judging the address frame is returned.
Further, when the slave device on the bus does not receive the address frame intervention data, the order in which the slave device transmits the data is not changed.
Further, when the slave device receives data, firstly judging whether the received data is address frame interference data, if not, judging whether a bus is idle and preparing to send the data; otherwise, the address frame interference data is saved, and the order of sending data by the slave equipment is calculated according to the address frame interference data.
Further, the slave device calculates the difference between the own address and the device address information table in the address frame interference data according to the comparison, and sends data to the master device in the descending order according to the calculated difference.
Further, an address interval time is set between two slave devices of adjacent addresses, and when the waiting time for sending data from the slave device is greater than or equal to the address interval time, the waiting time of the next device is the address interval x address interval time.
The invention has the beneficial effects that: the method comprises the steps that the master device sends address frame interference data irregularly, so that the slave devices can send data to the master device actively in sequence; in addition, the mode that the master device replies data in a unified mode is adopted, the communication mode that the RS485 bus needs to be called and answered every time of communication is avoided, and the bus communication efficiency is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a block diagram of a bus communication network;
FIG. 2 is a master communications flow diagram;
fig. 3 is a slave communication flow diagram.
Detailed Description
The invention discloses an RS485 active data transmission method of an irregular bus arbitration mechanism, which comprises the following steps:
s1: the method comprises the steps that the equipment on the bus keeps a state of receiving information, whether the bus is busy is judged through the master equipment, if not, whether an address frame of the slave equipment on the bus changes or not is judged, namely, whether the number of the slave equipment on the bus changes or not is judged;
s2: if the address frame of the slave equipment on the bus is judged to be changed, actively sending a frame of address frame interference data to the bus, wherein the address frame interference data comprises a plurality of addresses, receiving and storing the address frame interference data by the slave equipment, and calculating the order of sending data by the slave equipment according to the address frame interference data; and if the address frame of the slave device on the bus is not changed, judging whether data needs to be transmitted to the slave device.
The bus communication network composition frame diagram is shown in fig. 1, wherein KJJ15(a) is a master device responsible for sending address interference frame data and simultaneously sending and receiving data; KJ90-F16(B) is a slave device that can actively transmit data after receiving an address intervention frame. The invention can make the slave device sequentially actively transmit data to the master device by making the master device send the address frame interference data irregularly, and the slave device transmits data to the master device according to the sequence, thereby improving the communication efficiency.
According to one embodiment of the present application, when the master device determines that there is a change in the slave device address frame on the bus, the value OV is set to 0; and after the master equipment sends the address frame interference data to the slave equipment, judging whether the sending of the address frame interference data is finished, and if the sending is finished, assigning the value OV to be 1. It is also possible to assign OV to 0 before determining whether the bus is busy, depending on whether there is a change in the slave address frame.
According to one embodiment of the application, the master device sends data when judging that the data needs to be sent; otherwise, receiving data and starting a timer H1, when the received data exceeds the preset time, enabling OV to be 0 and H1 to be 0, and feeding back the bus fault; and when the received data is completely sent within the preset time, H1 is made to be 0, the bus is fed back to be idle, and the step of judging the address frame is returned.
According to one embodiment of the present application, when a slave device on the bus does not receive address frame intervention data, the order in which the slave device transmits the data is unchanged. When the number of the slave devices on the bus is not changed, the sequence of the slave devices for sending data is always kept in the original sequence; only if the number of the slave devices on the bus changes, when the master device sends the address interference frame information again, the communication order of the slave devices on the bus is changed.
According to one embodiment of the application, when the slave device receives data, whether the received data is address frame interference data is judged firstly, if not, whether a bus is idle is judged by the side, and the data is ready to be sent; otherwise, the address frame interference data is saved, and the order of sending data by the slave equipment is calculated according to the address frame interference data.
According to an embodiment of the present application, the slave device calculates a difference between the own address and the device address information table in the address frame interference data according to the comparison, and may send data to the master device in the descending order or in the descending order according to the calculated difference.
According to an embodiment of the present application, an address interval time is set between two slave devices of adjacent addresses, and when the time for the slave device to transmit data is greater than or equal to the address interval time, the next device waiting time is the address interval x address interval time.
According to one embodiment of the application, after the data transmission of the slave devices is completed, the master device transmits a frame of reply information, wherein the frame of reply information contains the reply information of all the slave devices, and the reply method can reduce the process that each slave device and the master device have calls and replies so as to further improve the bus communication efficiency.
Finally, the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all of them should be covered in the claims of the present invention.
Claims (7)
1. An RS485 active data transmission method of an irregular bus arbitration mechanism is characterized by comprising the following steps:
s1: judging whether the bus is busy through the master device, and if not, judging whether the address frame of the slave device on the bus changes;
s2: if the address frame change of the slave equipment on the bus is judged, actively sending a frame of address frame interference data comprising a plurality of addresses to the bus, and receiving and storing the address frame interference data by the slave equipment; the slave device calculates the order of sending data by the slave device according to the address frame interference data; if the address frame of the slave equipment on the bus is not changed, judging whether data needs to be sent to the slave equipment or not;
s3: after the data transmission of the slave equipment is completed, the master equipment transmits a frame of reply information, wherein the frame of reply information comprises the reply information of all the slave equipment.
2. The RS485 active data transmission method of aperiodic bus arbitration mechanism as claimed in claim 1, wherein when the master determines that there is a change in the slave address frame on the bus, the value OV =0 is assigned; and after the master equipment sends the address frame interference data to the slave equipment, judging whether the sending of the address frame interference data is finished, and if the sending is finished, assigning OV = 1.
3. The RS485 active data transmission method according to claim 2, wherein the master device sends data if it determines that data transmission is required; otherwise, receiving data and starting a timer H1, and when the received data exceeds the preset time, enabling OV =0 and H1=0, and feeding back a bus fault; and when the received data is completely sent within the preset time, H1=0 is set, the bus is fed back to be idle, and the step of judging the address frame is returned.
4. The RS485 active data transfer method of claim 1, wherein when a slave device on the bus does not receive address frame interference data, the order in which the slave device sends data is not changed.
5. The RS485 active data transmission method according to any of claims 1-4, wherein when receiving data from a slave device, first determining whether the received data is address frame interference data, if not, determining whether the bus is idle to prepare to send data; otherwise, the address frame interference data is saved, and the order of sending data by the slave equipment is calculated according to the address frame interference data.
6. The RS485 active data transmission method according to claim 5, wherein the slave device calculates the difference between the own address and the device address information table in the address frame interference data according to the comparison, and the slave device sends data to the master device in descending order according to the calculated difference.
7. The RS485 active data transmission method according to claim 6, wherein an address interval is set between two slaves in adjacent addresses, and when the waiting time for the slave to send data is greater than or equal to the address interval, the next device waits for the address interval.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910199383.2A CN109981433B (en) | 2019-03-15 | 2019-03-15 | RS485 active data transmission method of aperiodic bus arbitration mechanism |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910199383.2A CN109981433B (en) | 2019-03-15 | 2019-03-15 | RS485 active data transmission method of aperiodic bus arbitration mechanism |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109981433A CN109981433A (en) | 2019-07-05 |
CN109981433B true CN109981433B (en) | 2021-09-07 |
Family
ID=67079048
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910199383.2A Active CN109981433B (en) | 2019-03-15 | 2019-03-15 | RS485 active data transmission method of aperiodic bus arbitration mechanism |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109981433B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114760219B (en) * | 2022-04-28 | 2023-04-14 | 深圳市晟瑞科技有限公司 | Multi-terminal communication method and device, electronic equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101404604A (en) * | 2008-11-03 | 2009-04-08 | 浪潮电子信息产业股份有限公司 | 485 bus type monitoring system and its high extendibility method |
US7548153B2 (en) * | 2004-07-09 | 2009-06-16 | Tc License Ltd. | Multi-protocol or multi-command RFID system |
CN102857956A (en) * | 2012-07-26 | 2013-01-02 | 京信通信系统(广州)有限公司 | Master-slave communication method and device |
CN106357301A (en) * | 2016-08-25 | 2017-01-25 | 阳光电源股份有限公司 | Cascaded power line carrier wave method and device |
CN106874237A (en) * | 2017-03-08 | 2017-06-20 | 上海冉能自动化科技有限公司 | Method of data synchronization and system based on two lines bus |
-
2019
- 2019-03-15 CN CN201910199383.2A patent/CN109981433B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7548153B2 (en) * | 2004-07-09 | 2009-06-16 | Tc License Ltd. | Multi-protocol or multi-command RFID system |
CN101404604A (en) * | 2008-11-03 | 2009-04-08 | 浪潮电子信息产业股份有限公司 | 485 bus type monitoring system and its high extendibility method |
CN102857956A (en) * | 2012-07-26 | 2013-01-02 | 京信通信系统(广州)有限公司 | Master-slave communication method and device |
CN106357301A (en) * | 2016-08-25 | 2017-01-25 | 阳光电源股份有限公司 | Cascaded power line carrier wave method and device |
CN106874237A (en) * | 2017-03-08 | 2017-06-20 | 上海冉能自动化科技有限公司 | Method of data synchronization and system based on two lines bus |
Non-Patent Citations (1)
Title |
---|
煤矿安全监控系统总线分站的设计;周代勇,邵严,胡宇;《煤矿机械》;20170615;第38卷(第6期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN109981433A (en) | 2019-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021243580A1 (en) | Method and apparatus for transmitting downlink positioning reference signal, and storage medium | |
EP0712561B1 (en) | Local isdn radio transmission system | |
US6006017A (en) | System for determining the frequency of repetitions of polling active stations relative to the polling of inactive stations | |
EP0221708B1 (en) | Communication system for the transfer of small digital message blocks and large digital message blocks | |
CN102017749B (en) | The method and apparatus that in Radio Access Network, request and processing ascending resource distribute | |
US5488693A (en) | Protocol with control bits and bytes for controlling the order of communications between a master processor and plural slave processors | |
CN108541081B (en) | Analog and digital DMR compatible talkback small cluster building method | |
JPH05252314A (en) | Telephone service integration device, communication adapter, and combination device of data processing system | |
CN109981433B (en) | RS485 active data transmission method of aperiodic bus arbitration mechanism | |
CN107659456A (en) | A kind of data collision transmission method based on RS485 communications | |
US4853956A (en) | Communication system distributed processing message delivery system | |
CN1187998C (en) | Communication basic facilities and mehtod for quick building-up up-chain-circuit data | |
CN113630904B (en) | Bluetooth multi-pairing connection method and medium | |
CN111385874A (en) | Data communication terminal based on dynamic polling protocol | |
AU646318B2 (en) | A radio system | |
US20050180377A1 (en) | Radio communication system time slot allocation method | |
CN109818703B (en) | Time distribution method, device and system | |
CN110958717A (en) | Contention-free random medium access control method and system for centralized wireless local area network | |
CN117319946B (en) | Wireless communication method, system, device and storage medium | |
CN117156598B (en) | Communication link setting method and system of 5G MIMO frequency shift system | |
JP3359765B2 (en) | Wireless LAN system | |
KR100378823B1 (en) | Telecommunication line card data transmit method for pbx | |
CN107528681B (en) | Data transmission method, transceiver and communication terminal | |
CN117768075A (en) | Method, terminal and network equipment for determining uplink channel | |
CN115766595A (en) | Communication system for rapid scanning inside PLC |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |