CN112860591B - Method for sequential addressing of RS485 bus by signal relay - Google Patents

Method for sequential addressing of RS485 bus by signal relay Download PDF

Info

Publication number
CN112860591B
CN112860591B CN202110113481.7A CN202110113481A CN112860591B CN 112860591 B CN112860591 B CN 112860591B CN 202110113481 A CN202110113481 A CN 202110113481A CN 112860591 B CN112860591 B CN 112860591B
Authority
CN
China
Prior art keywords
addressing
node
upper computer
bus
nodes
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
Application number
CN202110113481.7A
Other languages
Chinese (zh)
Other versions
CN112860591A (en
Inventor
凡魏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ioidea Technology (wuhan) Co ltd
Original Assignee
Ioidea Technology (wuhan) Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ioidea Technology (wuhan) Co ltd filed Critical Ioidea Technology (wuhan) Co ltd
Priority to CN202110113481.7A priority Critical patent/CN112860591B/en
Publication of CN112860591A publication Critical patent/CN112860591A/en
Application granted granted Critical
Publication of CN112860591B publication Critical patent/CN112860591B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0002Serial port, e.g. RS232C

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses a system and a method for sequentially addressing an RS485 bus by using signal relays, wherein the system comprises an upper computer and a plurality of nodes, the nodes are sequentially connected with the upper computer through the RS485 bus, a relay is respectively arranged in each node, the upper computer locally stores and maintains an equipment list, each node has a specific SN number stored in the equipment, and an addressing status bit storage unit is arranged for recording whether the current node is addressed. The method adopts a mode of closing the bus step by step through the signal relay to achieve sequential traversal, and ensures that node information reaches the upper computer certainly through a mode of 2 times of response. The system and the method can record the relative position of each lower position in the bus by using the upper computer for addressing once, the addressing is quick, 5 nodes can be addressed within 1 second, the labor cost is effectively saved, the error rate is effectively reduced, and the problem of recording errors can not occur theoretically.

Description

Method for sequential addressing of RS485 bus by signal relay
Technical Field
The invention relates to a method for sequentially addressing an RS485 bus by using a signal relay.
Background
Because the 485 adopts a bus communication scheme, for the devices on the RS485 bus, the upper computer cannot know the relative position of the lower computer in the line. The corresponding position of the host computer is recorded in a manual mode of inputting in advance, so that the workload is high, or the probability of errors is high. As shown in fig. 1, 31 nodes are mounted under the controller, and the 31 nodes communicate with the controller through a common bus. As each node is randomly installed during installation construction, for the nodes 1-31, the corresponding SN number of each device cannot correspond to the SN number of each device. This causes the later maintenance to have great difficulty, needs the artificial mode to record the SN number that every equipment number corresponds in advance.
Disclosure of Invention
The invention provides a method for sequentially addressing an RS485 bus by using signal relays, which can record the relative position of each lower position in the bus by using an upper computer for addressing at one time by using a mode that the signal relays open and close the bus.
In order to achieve the purpose, the invention adopts the following technical scheme:
the utility model provides a RS485 bus utilizes signal relay order addressing system, includes host computer, a plurality of node, the node passes through the RS485 bus and is connected with the host computer in proper order, and each node is inside to be equipped with a relay respectively, and host computer local storage maintains an equipment list.
Preferably, there are 2 interfaces of RS485 in and out on each node, and each node has its own specific SN number stored in the device.
Preferably, each node is provided with an addressing status bit storage unit for recording whether the current node is addressed.
A sequential addressing method for an RS485 bus by using signal relays comprises the following steps:
s1, after the upper computer and the nodes are normally installed in the equipment, relays of all the nodes are set to be in a closed state, all the nodes are connected to an RS485 bus, and instructions sent by the upper computer can reach all the nodes;
s2, the upper computer initiates addressing, which specifically comprises:
s21, the upper computer sends a reset instruction, all the nodes receive the reset instruction at the moment, the relays of all the nodes are disconnected at the same time, the addressing state position stored by the node is set to be 0, in the state, the instruction sent by the upper computer can be received by only the first node, and meanwhile, the upper computer clears the equipment list;
s22, the upper computer sends an addressing request instruction, when the node receives the addressing instruction, the current addressing status bit is judged, if the current addressing status bit is 0, the SN of the node is sent to the RS485 bus, and the upper computer receives the SN information and stores the SN information in the position of the equipment list 1;
s23, the upper computer sends addressing response information to the bus, at the moment, the node 1 receives the addressing response, the addressing state position is set to 1, and the relay is closed;
s24, after the upper computer sends the response information, the upper computer continues to send the next addressing request instruction, at this time, because the relay of the node 1 is closed in the step S23, the node 1 and the node 2 receive the addressing request at the same time, but because the node 1 judges that the addressing status bit is 1, namely the node is addressed, the node does not send SN to the RS485 bus any more, and the node 2 judges that the addressing status bit is 0, the SN is sent to the RS485 bus, at this time, the upper computer receives the SN information of the 2 nd node, and the upper computer stores the second device SN at the position of the device list 2;
and S25, the upper computer can store all the equipment SN on the RS485 bus in an equipment list in a traversing mode by repeatedly sending the addressing instruction, and an equipment information table completely consistent with the wiring diagram is established.
Preferably, only one message is allowed to be sent by the RS485 bus at the same time, otherwise, a message storm is caused, and the message cannot be received.
Due to the structure, the invention has the advantages that:
this application utilizes the mode that signal relay opened and shut the bus, can use the host computer once to address just can take notes the relative position of each next in the bus, and the addressing is quick, and 1 second addressable 5 nodes effectively save the human cost, effectively reduce the error rate simultaneously, can not appear in theory and type wrong problem.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below.
FIG. 1 is a schematic diagram of a prior art addressing system architecture;
FIG. 2 is a schematic structural diagram of relays of all nodes of the present invention in a closed state;
FIG. 3 is a schematic structural diagram of relays of all nodes in an off state according to the present invention;
FIG. 4 is a schematic structural diagram of the node 1 receiving an address response status according to the present invention;
FIG. 5 is a schematic structural diagram of the node 2 receiving an address acknowledgement status according to the present invention;
FIG. 6 is a schematic structural diagram of the present invention when all nodes receive an address response status;
FIG. 7 is a flow chart of the addressing state of the present invention.
Detailed Description
The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 2 to 7, the present embodiment provides a system for sequentially addressing an RS485 bus by using signal relays, including an upper computer and a plurality of nodes, where the nodes are sequentially connected to the upper computer through the RS485 bus, each node is internally provided with a relay, and the upper computer locally stores and maintains an equipment list.
In this embodiment, there are 2 interfaces RS485 in and out on each node, and each node has its own specific SN number stored in the device.
In this embodiment, an addressing status bit storage unit is disposed in each node for recording whether the current node is addressed.
In this embodiment, the relay inside the node can cut off the connection from the node at the later stage to the upper computer.
The embodiment also provides a sequential addressing method of an RS485 bus by using signal relays, which comprises the following steps:
s1, after the upper computer and the nodes are normally installed in the equipment, the relays of all the nodes are set to be in a closed state, all the nodes are connected to the RS485 bus, and the instructions sent by the upper computer can reach all the nodes;
s2, the upper computer initiates addressing, which specifically comprises:
s21, the upper computer sends a reset instruction, all the nodes receive the reset instruction at the moment, the relays of all the nodes are disconnected at the same time, the addressing state position stored by the node is set to be 0, in the state, the instruction sent by the upper computer can be received by only the first node, and meanwhile, the upper computer clears the equipment list;
s22, the upper computer sends an addressing request instruction, when the node receives the addressing instruction, the current addressing state bit is judged, if the current addressing state bit is 0, the device SN of the node is sent to the RS485 bus, and the upper computer receives the SN information and stores the SN information in the position of the device list 1;
s23, the upper computer sends addressing response information to the bus, at the moment, the node 1 receives the addressing response, the addressing state position is set to 1, and the relay is closed; after one addressing response, the SN information of the first node can be guaranteed to be recorded by the upper level. If the addressing response message is not received by the node 1 due to the line abnormality, the node 1 continues to keep the unaddressed state;
s24, after the upper level sends the response information, the upper level continues to send the next addressing request instruction, at this time, because the relay of the node 1 is closed in the step S23, the node 1 and the node 2 receive the addressing request at the same time, but because the node 1 judges that the addressing status bit is 1, namely the addressing is performed, the node 1 does not send SN to the RS485 bus any more, and the node 2 judges that the addressing status bit is 0, the SN is sent to the RS485 bus, at this time, the upper level receives the SN information of the 2 nd node, and the upper level stores the second device SN at the position of the device list 2;
and S25, the upper computer can store all the equipment SN on the RS485 bus in an equipment list in a traversing mode by repeatedly sending the addressing instruction, and an equipment information table completely consistent with the wiring diagram is established.
In this embodiment, only one piece of information is allowed to be sent by the RS485 bus at the same time, otherwise, an information storm is caused and the information storm cannot be received.
According to the system and the method, the purpose of sequential traversal is achieved by means of opening and closing of the signal relay, the node information is guaranteed to reach the upper computer in a mode of 2 times of response, the relative position of each lower node in the bus can be recorded by the aid of the upper computer through one-time addressing, the addressing is fast, 5 nodes can be addressed within 1 second, labor cost is effectively saved, meanwhile, the error rate is effectively reduced, and the problem of entry errors can be avoided theoretically.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (4)

1. An addressing method of an RS485 bus system sequentially addressing by using signal relays is characterized in that the system comprises an upper computer and a plurality of nodes, wherein the nodes are sequentially connected with the upper computer through the RS485 bus, a relay is respectively arranged in each node, and the upper computer locally stores and maintains an equipment list;
the method comprises the following steps:
s1, after the upper computer and the nodes are normally installed in the equipment, the relays of all the nodes are set to be in a closed state, all the nodes are connected to the RS485 bus, and the instructions sent by the upper computer can reach all the nodes;
s2, the upper computer initiates addressing, which specifically comprises:
s21, the upper computer sends a reset instruction, all the nodes receive the reset instruction at the moment, the relays of all the nodes are disconnected at the same time, the addressing state position stored by the node is set to be 0, in the state, the instruction sent by the upper computer can be received by only the first node, and meanwhile, the upper computer clears the equipment list;
s22, the upper computer sends an addressing request instruction, when the node receives the addressing instruction, the current addressing state bit is judged, if the current addressing state bit is 0, the device SN of the node is sent to the RS485 bus, and the upper computer receives the SN information and stores the SN information in the position of the device list 1;
s23, the upper computer sends addressing response information to the bus, at the moment, the node 1 receives the addressing response, the addressing state position is set to 1, and the relay is closed;
s24, after the upper computer sends the response information, the upper computer continues to send the next addressing request instruction, at this time, because the relay of the node 1 is closed in the step S23, the node 1 and the node 2 receive the addressing request at the same time, but because the node 1 judges that the addressing state bit is 1, namely the addressing is carried out, the node 1 does not send SN to the RS485 bus any more, and the node 2 judges that the addressing state bit is 0, the SN is sent to the RS485 bus, at this time, the upper computer receives the SN information of the 2 nd node, and the upper computer stores the second device SN at the position of the device list 2;
and S25, the upper computer can store all the equipment SN on the RS485 bus in an equipment list in a traversing mode by repeatedly sending the addressing instruction, and an equipment information table completely consistent with the wiring diagram is established.
2. The addressing method of an RS485 bus system using signal relay sequential addressing as claimed in claim 1, wherein there are 2 RS485 in and out interfaces on each node, each node has its own specific SN number stored in the device.
3. The addressing method of the RS485 bus sequential addressing system using the signal relay as claimed in claim 1, wherein an addressing status bit storage unit is disposed in each node for recording whether the current node is addressed.
4. The addressing method of the RS485 bus system using the signal relay as claimed in claim 1, wherein only one message is allowed to be sent by the RS485 bus at the same time, otherwise, a message storm is caused and the message is not received.
CN202110113481.7A 2021-01-27 2021-01-27 Method for sequential addressing of RS485 bus by signal relay Active CN112860591B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110113481.7A CN112860591B (en) 2021-01-27 2021-01-27 Method for sequential addressing of RS485 bus by signal relay

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110113481.7A CN112860591B (en) 2021-01-27 2021-01-27 Method for sequential addressing of RS485 bus by signal relay

Publications (2)

Publication Number Publication Date
CN112860591A CN112860591A (en) 2021-05-28
CN112860591B true CN112860591B (en) 2022-07-01

Family

ID=75986095

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110113481.7A Active CN112860591B (en) 2021-01-27 2021-01-27 Method for sequential addressing of RS485 bus by signal relay

Country Status (1)

Country Link
CN (1) CN112860591B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101572702A (en) * 2009-05-27 2009-11-04 大连理工计算机控制工程有限公司 Method for scheduling high-speed bus master and slave network communication
CN104734363A (en) * 2015-04-14 2015-06-24 合肥工业大学 Internet of things based high- and low-voltage switchgear system
CN107181659A (en) * 2016-03-10 2017-09-19 深圳市祈飞科技有限公司 Intelligent cabinet communication means and system based on RS485 buses
CN109792431A (en) * 2016-10-05 2019-05-21 天体电子学先进电子系统公司 Automatically the automatic addressing of the multiple spot branch communication system terminated including system and configuration
CN111665736A (en) * 2020-07-11 2020-09-15 埃安美(苏州)物联技术有限公司 Smart home control system based on Internet of things

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477506A (en) * 2008-01-04 2009-07-08 鸿富锦精密工业(深圳)有限公司 Addressing system and method of master equipment to slave equipment
US7668998B2 (en) * 2008-01-08 2010-02-23 Parata Systems, Llc Methods, systems, and devices for providing an interrupt scheme in automated pharmaceutical dispensing machines without centralized arbitration
CN105959288A (en) * 2016-05-27 2016-09-21 姹や寒 Network protocol conversion method for power grid system and intercommunication method of power grid system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101572702A (en) * 2009-05-27 2009-11-04 大连理工计算机控制工程有限公司 Method for scheduling high-speed bus master and slave network communication
CN104734363A (en) * 2015-04-14 2015-06-24 合肥工业大学 Internet of things based high- and low-voltage switchgear system
CN107181659A (en) * 2016-03-10 2017-09-19 深圳市祈飞科技有限公司 Intelligent cabinet communication means and system based on RS485 buses
CN109792431A (en) * 2016-10-05 2019-05-21 天体电子学先进电子系统公司 Automatically the automatic addressing of the multiple spot branch communication system terminated including system and configuration
CN111665736A (en) * 2020-07-11 2020-09-15 埃安美(苏州)物联技术有限公司 Smart home control system based on Internet of things

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于RS485总线的单片机多机通信软件设计;陈新忠;《现代电子技术》;20020325;全文 *

Also Published As

Publication number Publication date
CN112860591A (en) 2021-05-28

Similar Documents

Publication Publication Date Title
CN101296065B (en) Method and system for improving reliability of redundancy main station
CN101841408A (en) Primary/standby route equipment switching method and route equipment
WO2011012041A1 (en) System and mothod for setting addresses of serial bus slave devices
CN101394306A (en) Seamless switching method for dual server system
CN104753038A (en) Intelligent substation centralized relay protection system and method
CN102025562A (en) Path detection method and device
CN201985624U (en) Device for remotely controlling the restart of power supply
CN101141282B (en) Network management system and its management method
CN103036934A (en) Wide area network clustered deployment system and method based on mirror image
CN103973476A (en) Gateway, and gateway hot backup system and method
CN103139033A (en) Primary device redundancy switching method of single main communication control bus
CN112860591B (en) Method for sequential addressing of RS485 bus by signal relay
CN101340377B (en) Method, apparatus and system for data transmission in double layer network
CN106532960B (en) A kind of adaptive SCADA monitoring methods being suitable for field of power distribution
CN202735735U (en) Low-cost on-site measurement and control I/O module of wired and wireless hot standby redundancy communication
CN103441880A (en) Method for preventing data from being lost for system having data access with IEC61859 intelligent device during switching of main system and standby system
CN101702684B (en) Method for realizing to refresh Ethernet ring network forwarding database and device
CN102487332A (en) Fault processing method, apparatus thereof and system thereof
CN105959227B (en) A kind of the topology learning method, apparatus and system of unidirectional serial bus network
CN111026662A (en) Remote debugging method, system and medium for terminal equipment of Internet of things
CN100496005C (en) Large-scale network control system
CN114363152B (en) WTB node initial operation method and system for preventing node address abnormality
CN201312325Y (en) Self-adaptive network frame for bus interanet systems
CN100417110C (en) Route renewing method based on converying type network system
CN101754052B (en) Network fault-tolerant intercom equipment, security intercom system and realization method thereof

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