CN117692433A - Multi-device communication automatic addressing method based on electronic token - Google Patents

Multi-device communication automatic addressing method based on electronic token Download PDF

Info

Publication number
CN117692433A
CN117692433A CN202410138049.7A CN202410138049A CN117692433A CN 117692433 A CN117692433 A CN 117692433A CN 202410138049 A CN202410138049 A CN 202410138049A CN 117692433 A CN117692433 A CN 117692433A
Authority
CN
China
Prior art keywords
electronic token
slave device
frequency
slave
signal
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.)
Pending
Application number
CN202410138049.7A
Other languages
Chinese (zh)
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.)
Gospower Digital Technology Shenzhen Co ltd
Original Assignee
Gospower Digital Technology Shenzhen 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 Gospower Digital Technology Shenzhen Co ltd filed Critical Gospower Digital Technology Shenzhen Co ltd
Priority to CN202410138049.7A priority Critical patent/CN117692433A/en
Publication of CN117692433A publication Critical patent/CN117692433A/en
Pending legal-status Critical Current

Links

Abstract

The invention belongs to the technical field of communication, and discloses an electronic token-based multi-device communication automatic addressing method.A main device sends out a fixed frequency f at a signal port under an electronic token 0 Receiving the electronic token signal issued by the main equipment from the equipment 1, and multiplying the frequency of the received signal to obtain f 1 The fixed frequency f is sent out through the electronic token sending signal port 1 Receiving the electronic token signal issued by the slave device 1 from the slave device 2, detecting the frequency of the signal, and multiplying the frequency of the received signal to obtain f 2 The fixed frequency f is sent out through the electronic token sending signal port 2 And so on, slave device determining by detecting frequencyOwn communication address. The invention has the beneficial effects that: the method adopts the mode of sequentially transmitting the electronic tokens, uses few MCU resources and hardware cost, can realize the rapid and automatic allocation of the addresses of the slave devices of the RS485 network, and the allocated address sequence is consistent with the physical wiring sequence of the devices.

Description

Multi-device communication automatic addressing method based on electronic token
Technical Field
The invention relates to the technical field of communication, in particular to an electronic token-based multi-device communication automatic addressing method.
Background
The RS485 communication is one of the most widely used communication modes in the industry control and monitoring industry, and has the advantages of simplicity, reliability, low resource consumption for MCU, low cost, long transmission distance and the like. Because the RS485 is a half-duplex communication mode and has no bus arbitration mechanism, a master-slave communication mode is generally adopted, namely, a master machine is provided with a plurality of slaves, each slave machine has a unique communication address, all communication is requested by the master machine, the corresponding slave machine responds, the slave machine is not allowed to actively initiate communication, and otherwise, bus conflict caused by simultaneous data transmission of the plurality of slave machines can occur.
Based on the RS485 response type communication mode, different communication addresses must be set for the slave devices accessing the RS485 network, namely, the master device needs to communicate with which slave device, and sends a command according to the corresponding address, after receiving the command, the slave device checks whether the communication address is the same as the address of the slave device, and responds, otherwise, does not respond, so that the problem of bus conflict does not occur as long as the slave devices with the same communication address do not occur. In this way, the address of the slave device needs to be preset, typically by setting the address to the memory of the slave device or by dialing the address. In either way, the difficulty of operation on the construction site is increased, misoperation is easy to occur, and a plurality of slave devices are set to be the same communication address, so that the whole network communication is abnormal.
Therefore, it is proposed in the industry to automatically allocate the communication address of the slave device by using the globally unique hardware serial number of the slave device and adopting a registration request mode, but this mode is easy to cause bus conflict during registration request, the address allocation consumes a long time, the allocated communication address does not correspond to the physical connection sequence, and the specific device corresponding to the data is not easy to find. For example, in the connection mode of fig. 1, addresses of slave devices increase from left to right according to normal logic, but if the addresses are automatically allocated by adopting a registration mode, the addresses of the slave devices are arranged according to a sequence number sequence, the addresses are irrelevant to the connection sequence of a communication cable, and the addresses of the slave devices are allocated out of sequence, so that great inconvenience is brought to use and maintenance.
Therefore, it is necessary to provide a new multi-device communication automatic addressing method, so as to implement automatic and rapid allocation of RS485 communication addresses, and the allocated address sequence is consistent with the wiring sequence, so that inspection and maintenance are convenient.
Disclosure of Invention
The invention discloses an electronic token-based multi-device communication automatic addressing method which can effectively solve the technical problems related to the background technology.
In order to achieve the above purpose, the technical scheme of the invention is as follows:
an electronic token-based multi-device communication automatic addressing method, wherein the multi-device comprises a master device and n slave devices, and the automatic addressing method comprises the following steps:
s1, connecting a master device and a slave device through a cable, wherein electronic token signal lines are connected between the master device and the slave device 1, between the slave device 1 and the slave device 2 … and between the slave device n-1 and the slave device n; the master device is provided with a token sending signal line, and the slave device is simultaneously provided with a token sending signal line and a token receiving signal line;
s2, the master device sends out a fixed frequency f to the slave device 1 through an electronic token signal line (token sending signal line) 0 The slave device 1 receives the electronic token signal issued by the master device (via the token receiving signal line) and detects the frequency of the signal, and at the same time, the frequency of the received signal is converted by X times to obtain a fixed frequency f 1 Then sends out a fixed frequency f to the slave device 2 through an electronic token signal line (token transmission signal line) 1 X noteq 0 or 1;
s3, and so on, receiving the frequency f from the device 2 (through the token receiving signal line) 1 Is converted by frequency X times and then emits a fixed frequency f to the slave device 3 2 Until receiving a square wave signal of frequency f from device n n-1 Is a square wave signal of (a);
s4, each slave device determines the communication address of the slave device according to the frequency of the square wave signal received by the slave device.
As a preferred improvement of the present invention: the number of slave devices is 2-32.
As a preferred improvement of the present invention: the master device is connected with the slave device through an RS485 communication cable.
As a preferred improvement of the present invention: the master device is provided with an electronic token issuing signal interface, the slave device 1 and the slave device 2 and … are respectively provided with an electronic token receiving signal interface and an electronic token issuing signal interface from the slave device n-1, and the slave device n is provided with an electronic token receiving signal interface.
As a preferred improvement of the present invention: and X is 2.
As a preferred improvement of the present invention: the frequency of the signal sent by the main equipment is 1Hz, and the frequency of the signal received by each slave equipment is sequentially 1Hz, 2Hz, 4Hz and … 2 (n-1) Hz。
As a preferred improvement of the present invention: in the step S4, the algorithm of the communication address addr is addr=M has the values of 0, 1 and 2 … n-1.
The beneficial effects of the invention are as follows:
1. the method for automatically distributing the RS485 communication addresses is provided, the automatic and rapid distribution of the RS485 communication addresses is realized by adding the electronic token communication line, the distributed address sequence is consistent with the wiring sequence, and the slave device addresses are automatically redistributed without manual intervention when the slave devices are added, removed and replaced in the middle;
2. the method has the advantages that the method adopts the mode of sequentially transmitting the electronic tokens, the rapid and automatic allocation of the addresses of the slave devices of the RS485 network can be realized, the allocated addresses are consistent with the physical wiring sequence of the devices, meanwhile, the method has the characteristics of line breakage monitoring and automatic reassignment of the addresses by on-line plugging, is convenient for inspection and maintenance, and reduces the construction difficulty and the probability of error of manual address allocation.
Drawings
For a clearer description of the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the description below are only some embodiments of the present invention, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art, wherein:
fig. 1 is a schematic diagram of an RS485 communication device connection;
FIG. 2 is a schematic diagram of device connection of an electronic token based multi-device communication automatic addressing method of the present invention;
fig. 3 is a flow chart of the operation of the slave device of the present invention.
Detailed Description
The technical solutions of the embodiments of the present invention will be clearly and completely described in the following in conjunction with the embodiments of the present invention, and it is obvious that the described embodiments are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that all directional indicators (such as up, down, left, right, front, and rear … …) in the embodiments of the present invention are merely used to explain the relative positional relationship, movement, etc. between the components in a particular posture (as shown in the drawings), and if the particular posture is changed, the directional indicator is changed accordingly.
Furthermore, descriptions such as those referred to as "first," "second," and the like, are provided for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implying an order of magnitude of the indicated technical features in the present disclosure. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
In the present invention, unless specifically stated and limited otherwise, the terms "connected," "affixed," and the like are to be construed broadly, and for example, "affixed" may be a fixed connection, a removable connection, or an integral body; can be mechanically or electrically connected; either directly or indirectly, through intermediaries, or both, may be in communication with each other or in interaction with each other, unless expressly defined otherwise. The specific meaning of the above terms in the present invention can be understood by those of ordinary skill in the art according to the specific circumstances.
In addition, the technical solutions of the embodiments of the present invention may be combined with each other, but it is necessary to be based on the fact that those skilled in the art can implement the technical solutions, and when the technical solutions are contradictory or cannot be implemented, the combination of the technical solutions should be considered as not existing, and not falling within the scope of protection claimed by the present invention.
Referring to fig. 2, the present invention provides an electronic token-based multi-device communication automatic addressing method, wherein the multi-device includes a master device and n slave devices, the master device is connected with the slave devices through an RS485 communication cable, the master device is provided with an electronic token down signaling interface, the slave device 1, the slave device 2 and …, the slave device n-1 is provided with an electronic token receiving signal interface and an electronic token down signaling interface, and the slave device n is provided with an electronic token receiving signal interface, the method includes the following steps: s1, an electronic token signal line is connected between a master device and a slave device 1, and between a slave device 1 and a slave device 2 and between a slave device n-1 and a slave device n …; s2, the master device sends out a fixed frequency f to the slave device 1 through the electronic token signal line 0 The slave device 1 receives the electronic token signal issued by the master device, detects the frequency of the signal, and converts the frequency of the received signal by X times to obtain a fixed frequency f 1 Then sends out a fixed frequency f to the slave device 2 through the electronic token signal line 1 Wherein X is equal to 0 or 1 and is a positive number; s3, and so on, receiving a fixed frequency f from the device 2 1 Is converted by frequency X times and then emits a fixed frequency f to the slave device 3 2 Until receiving a fixed frequency f from the device n n-1 Is a square wave signal of (a); s4, each slave device determines the communication address of the slave device according to the frequency of the square wave signal received by the slave device.
Specifically, in the network, the master device adds an electronic token down signaling interface, and the slave device adds an electronic token receiving signaling interface and an electronic token down signaling interface. Electronic token issuing interface connection of main equipmentThe first slave device receives the signal port from the electronic token of the device, and the slave device sends the signal port from the electronic token of the device to the next slave device. Therefore, only one signal wire needs to be added in the chain-shaped RS485 communication cable. The main equipment continuously sends out fixed frequency f at the signal port of the electronic token 0 Is a square wave of (2); the slave device 1 receives the electronic token signal issued by the master device, detects the frequency of the signal, and multiplies the frequency of the received signal to obtain f 1 Continuously emitting fixed frequency f through an electronic token issuing signal port of the electronic token 1 Is a square wave of (2); the slave device 2 receives the electronic token signal issued by the slave device 1, detects the frequency of the signal, and multiplies the received signal to obtain f 2 Continuously emitting fixed frequency f through an electronic token issuing signal port of the electronic token 2 And so on, each slave device can acquire a set of frequencies, each of which varies in frequency and varies in a fixed multiple along the connection order of the slave devices. Frequency f transmitted by the master device 0 And the multiple X of each slave device transformation is preset, and the frequency calculated value received by each slave device is f 0 X n-1 Knowing the frequency f received from the device 0 And X, a value of n can naturally be obtained, which represents the location of the slave device, and can be used as the communication address, for example, the slave device 1 communication address is 1, the slave device 2 communication address is 2, and the slave device n communication address is n. A specific ordering may be performed, for example, slave 1 communication address 001, slave 2 communication address 002, and slave 20 communication address 020. The slave devices are sequenced according to the fixed change of the signal frequency through the electronic token transmission signals, the slave devices can calculate the positions of the slave devices through detecting the frequency, and the communication addresses of the slave devices are determined according to preset rules, so that the automatic addressing of multi-device communication is realized.
As one embodiment, X is a positive integer, preferably X is 2, the frequency of the signal sent by the main device is 1Hz, and the frequencies of the signals received by the auxiliary devices are 1Hz, 2Hz, 4Hz and … 2 in sequence (n-1) Hz, the slave device can judge the position of itself in the communication network according to the frequency of the signalIn the step S4, the algorithm of the communication address addr may be expressed as addr=M has the values of 0, 1 and 2 … n-1. In the scheme, the number of the slave devices is 2-32, the tested master device sends out 1Hz frequency, and each slave device is amplified by 2 times and can be connected with 32 slave devices.
As an embodiment, X is a fraction smaller than 1, i.e. the frequency of the signal transmitted by the electronic token decreases successively.
Working principle: the master device and the slave device are connected in an electronic token mode, a signal with the frequency changing according to a specific rule is sequentially transmitted, the slave device determines own communication address according to the frequency of the received signal, the rapid and automatic allocation of the addresses of the slave devices of the RS485 network is realized, and the allocated addresses are consistent with the physical wiring sequence of the devices.
Although embodiments of the present invention have been disclosed above, it is not limited to the details and embodiments shown and described, it is well suited to various fields of use for which the invention would be readily apparent to those skilled in the art, and accordingly, the invention is not limited to the specific details and illustrations shown and described herein, without departing from the general concepts defined in the claims and their equivalents.

Claims (7)

1. An electronic token based multi-device communication automatic addressing method, wherein the multi-device comprises a master device and n slave devices, and the method is characterized by comprising the following steps:
s1, connecting a master device and a slave device through a cable, wherein electronic token signal lines are connected between the master device and the slave device 1, between the slave device 1 and the slave device 2 … and between the slave device n-1 and the slave device n;
s2, the master device sends out a fixed frequency f to the slave device 1 through the electronic token signal line 0 The slave device 1 receives the electronic token signal issued by the master device, detects the frequency of the signal, and converts the frequency of the received signal by X times to obtain a fixed frequency f 1 But the square wave signal of (a)After which the slave device 2 is sent out a fixed frequency f through the electronic token signal line 1 X noteq 0 or 1;
s3, and so on, receiving the frequency f from the equipment 2 1 Is converted by frequency X times and then emits a fixed frequency f to the slave device 3 2 Until receiving a square wave signal of frequency f from device n n-1 Is a square wave signal of (a);
s4, each slave device determines the communication address of the slave device according to the frequency of the square wave signal received by the slave device.
2. The electronic token based multi-device communication automatic addressing method of claim 1, wherein: the number of slave devices is 2-32.
3. The electronic token based multi-device communication automatic addressing method of claim 1, wherein: the master device is connected with the slave device through an RS485 communication cable.
4. The electronic token based multi-device communication automatic addressing method of claim 1, wherein: the master device is provided with an electronic token issuing signal interface, the slave device 1 and the slave device 2 and … are respectively provided with an electronic token receiving signal interface and an electronic token issuing signal interface from the slave device n-1, and the slave device n is provided with an electronic token receiving signal interface.
5. The electronic token based multi-device communication automatic addressing method of claim 1, wherein: and X is 2.
6. The electronic token based multi-device communication automatic addressing method of claim 5, wherein: the frequency of the signal sent by the main equipment is 1Hz, and the frequency of the signal received by each slave equipment is sequentially 1Hz, 2Hz, 4Hz and … 2 (n-1) Hz。
7. According to claimThe electronic token-based multi-device communication automatic addressing method of claim 6, which is characterized by comprising the following steps: in the step S4, the algorithm of the communication address addr is addr=M has the values of 0, 1 and 2 … n-1.
CN202410138049.7A 2024-02-01 2024-02-01 Multi-device communication automatic addressing method based on electronic token Pending CN117692433A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410138049.7A CN117692433A (en) 2024-02-01 2024-02-01 Multi-device communication automatic addressing method based on electronic token

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410138049.7A CN117692433A (en) 2024-02-01 2024-02-01 Multi-device communication automatic addressing method based on electronic token

Publications (1)

Publication Number Publication Date
CN117692433A true CN117692433A (en) 2024-03-12

Family

ID=90126844

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410138049.7A Pending CN117692433A (en) 2024-02-01 2024-02-01 Multi-device communication automatic addressing method based on electronic token

Country Status (1)

Country Link
CN (1) CN117692433A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110137520A (en) * 2019-05-06 2019-08-16 奇瑞汽车股份有限公司 A kind of battery management system slave addresses calibration system and method
CN113873051A (en) * 2021-08-30 2021-12-31 苏州浪潮智能科技有限公司 Address allocation method and device, electronic equipment and readable storage medium
CN114884921A (en) * 2022-04-26 2022-08-09 珠海科创电力电子有限公司 Method, circuit and bus system for automatically allocating bus address

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110137520A (en) * 2019-05-06 2019-08-16 奇瑞汽车股份有限公司 A kind of battery management system slave addresses calibration system and method
CN113873051A (en) * 2021-08-30 2021-12-31 苏州浪潮智能科技有限公司 Address allocation method and device, electronic equipment and readable storage medium
CN114884921A (en) * 2022-04-26 2022-08-09 珠海科创电力电子有限公司 Method, circuit and bus system for automatically allocating bus address

Similar Documents

Publication Publication Date Title
KR20060099918A (en) Building management system
EP2434687A1 (en) Data communication method, communication equipment and communication system
US20060080379A1 (en) Network system and method allocating addresses
US8626972B2 (en) I2C multi-slot circuit system and method for transmitting I2C signals
CN115529293A (en) Dynamic addressing method and system for combined battery pack
CN117692433A (en) Multi-device communication automatic addressing method based on electronic token
CN112511662B (en) System communication address generation and distribution method and device and air conditioning system
CN115189985B (en) Modbus multi-master-station data planning and forwarding device
CN113923073B (en) Method for distributing ID (identity) to CAN (controller area network) bus and CAN bus system
JP2000269996A (en) System, communication unit, equipment method for generating logical map information and tool device
KR101312035B1 (en) System for supervisory control
CN206805761U (en) A kind of data transmission device with master and slave wireless module
JP2018121155A (en) Vehicle controller
KR20140066357A (en) Method for updating firmware of multiple micro controller unit and electronic control unit using the same
CN113253652A (en) Unit communication control device, method and unit
CN114884770B (en) Multi-machine communication system and communication method based on system bus
JPH04287150A (en) Synchronous serial bus system
CN115865866B (en) Address allocation method and device
JPS5824061B2 (en) Data communication control method
CN214954608U (en) Communication control device of unit and unit
JP2005067879A (en) Elevator transmission control device
CN117119074A (en) Data receiving and transmitting method, device, equipment and storage medium
CN116418621A (en) Multi-split system and communication method thereof
CN115658583A (en) LIN automatic addressing system and method combined with single-wire bidirectional protocol
CN117851322A (en) Data transmission method and device between avionics bus and RS422 equipment

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