CN105024897A - Scanning method for network equipment on RS485 bus - Google Patents

Scanning method for network equipment on RS485 bus Download PDF

Info

Publication number
CN105024897A
CN105024897A CN201410155527.1A CN201410155527A CN105024897A CN 105024897 A CN105024897 A CN 105024897A CN 201410155527 A CN201410155527 A CN 201410155527A CN 105024897 A CN105024897 A CN 105024897A
Authority
CN
China
Prior art keywords
bus
scan
response packet
far
network equipment
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
CN201410155527.1A
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.)
Shenzhen Compatriots Ltd Co That Communicates By Letter
China Grentech Corp Ltd
Original Assignee
Shenzhen Compatriots Ltd Co That Communicates By Letter
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 Shenzhen Compatriots Ltd Co That Communicates By Letter filed Critical Shenzhen Compatriots Ltd Co That Communicates By Letter
Priority to CN201410155527.1A priority Critical patent/CN105024897A/en
Publication of CN105024897A publication Critical patent/CN105024897A/en
Pending legal-status Critical Current

Links

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention relates to a scanning method for network equipment on an RS485 bus. The network equipment includes a main control unit and a plurality of remote units. The scanning method includes the following steps: the remote units respectively generate a unique identification number; the main control unit sends a scanning data packet to the RS485 bus, and receives a reply packet from the RS485 bus in a first period of time; after receiving the scanning data packet, each remote unit generates a reply packet, fills in the generated unique identification number in the reply packet, and then sends the reply packet to the RS485 bus; and the main control unit parses the received reply packets, and acquires and stores the unique identification number of each remote unit. The remote units connected to the RS484 bus are identified through the main control unit and the remote units and based on automatic scanning, so that the workload of engineering personnel is reduced greatly.

Description

The scan method of the network equipment in RS485 bus
[technical field]
The present invention relates to the device scan of the RS485 bus broadcast networks such as electric tuning antenna control system, repeater network overlay system, module monitors, more particularly, the method for main control unit in RS485 bus (comprise electrical tilt antenna system centralized control unit or hand held controller, repeater near-end machine or connect the main monitoring of some modules) scanning recognition far-end unit (modules comprising electrical tilt antenna Remote Control Unit, repeater remote termination or be connected with main monitoring) is related to.
[background technology]
In electric tuning antenna control system, centralized control unit (CCU) or hand held controller need to scan through the Remote Control Unit (RCU) that RS485 bus links together, and accurately the RCU intactly scanned in bus is the prerequisite of subsequent query setting operation.
In the network overlay system of repeater, a repeater incoming end (i.e. main frame, or near-end machine) often can be used to coordinate multiple stage capped end (namely from machine, or remote termination) to carry out quorum sensing inhibitor.Before " opening station to report " to network management center, engineering staff needs the device numbering first setting each capped end, guarantees that the connection of incoming end and each capped end is normal.When the capped end number connected in a master-slave system is more, arranging device numbering to separately successively each capped end wastes time and energy.If near-end machine can automatic scan connect capped end number, and for its distributing equipment number, then greatly can reduce the workload of engineering staff.
[summary of the invention]
The object of this invention is to provide the scan method of the network equipment in a kind of RS485 bus, by this scan method, main control unit can automatic scan identification far-end unit, greatly can reduce the workload of engineering staff.
For reaching above-mentioned purpose, the technical solution used in the present invention is as follows:
A scan method for the network equipment in RS485 bus, the described network equipment comprises main control unit and some far-end units, it is characterized in that, described scan method comprises the following steps:
The each self-generating unique identifier of described some far-end units;
Described main control unit sends scan-data bag to described RS485 bus, in first time period, then receive the response packet in described RS485 bus;
Far-end unit generates response packet after receiving described scan-data bag, and the unique identifier that self generates is inserted response packet, is then sent in described RS485 bus;
Described main control unit resolves the response packet received, and obtains and stores the unique identifier of far-end unit.
In order to avoid the situation causing communication failure because of bus collision to greatest extent, in above-mentioned RS485 bus the network equipment scan method in, preferably, also comprise: transmission packet before judge that whether described RS485 bus idle; Start to send packet when described RS485 bus free; And again judge that whether described RS485 bus is idle when described RS485 bus busy waits for a period of time.
In above-mentioned RS485 bus the network equipment scan method in, judge that described RS485 bus is whether idle preferably by following methods: obtain current time; The time interval calculating current time and receive for the last time between packet; When the described time interval is not less than the first set point, judge described RS485 bus free, otherwise judge that described RS485 bus is done.
In above-mentioned RS485 bus the network equipment scan method in, described first set point is preferably relevant to the length of the described message transmission rate of RS485 bus, the number of far-end unit and packet.
In order to avoid the situation causing communication failure because of bus collision to greatest extent, in above-mentioned RS485 bus the network equipment scan method in, preferably, far-end unit waits for one section of random time before sending response packet, and this random time is relevant to the message transmission rate of the far-end unit number in RS485 bus, RS485 bus and the length of response packet.
In above-mentioned RS485 bus the network equipment scan method in, preferably, also comprise: main control unit is resolved after response packet, judges whether response packet collides and whether scan new far-end unit; When response packet collides or scan new far-end unit, scan counter is reset, again send scan-data bag to described RS485 bus, repeat described scanning process; When response packet does not collide and do not scan new far-end unit, scan counter counts; And when the value of scan counter reaches the second set point, terminate scanning.
In above-mentioned RS485 bus the network equipment scan method in, judge whether response packet collides preferably by following methods: detect the beginning flag of response packet, end mark and check results, when beginning flag and end mark are incomplete or check results is incorrect, when judging that this response packet transmits in described RS485 bus, there occurs collision.
In above-mentioned RS485 bus the network equipment scan method in, preferably, also comprise: described main control unit RS485 bus described in transmission scan-data bag forward direction sends initialization package; And after far-end unit receives described initialization package, self is set to zero-address state.
The inventive method is connected to the far-end unit in RS485 bus by main control unit and far-end unit in conjunction with automatic scan identification, therefore, it is possible to greatly reduce the workload of engineering staff.
[accompanying drawing explanation]
Fig. 1 is the flow chart performed by main control unit in preferred embodiment scan method;
Fig. 2 is the flow chart performed by far-end unit in preferred embodiment scan method;
Fig. 3 is the flow chart judging in preferred embodiment scan method that whether RS485 bus is idle;
Fig. 4 is data collision overhaul flow chart in preferred embodiment scan method.
[embodiment]
Below in conjunction with drawings and Examples, the present invention is further described.
In this RS485 bus, the scan method of the network equipment is connected to the far-end unit in RS485 bus by main control unit and far-end unit in conjunction with automatic scan identification, wherein, as shown in Figure 1, the handling process in far-end unit as shown in Figure 2 for handling process in main control unit.
With reference to Fig. 1, the handling process in main control unit comprises:
Step S101, initialization scan number of times (by scan counter COUNT zero setting).Do not arrange in scan counter embodiment at some and namely do not need this step.
Step S102, judges whether to receive scan command.
Step S103, after receiving scan command, sends initialization package to RS485 bus, with all far-end units of initialization, is set to by far-end unit.In some systems, just only under zero-address state far-end unit can respond the scan command that proximal device sent by bus, far-end unit not responding scanning order under other state, in order to have better versatility, so arrange this step S103.
Step S104, judges whether to stop scanning, when the value of scan counter reaches the second set point or receive when terminating scan command, stops scanning.
Step S105, sends a scan-data bag to RS485 bus.
Step S106, at first time period T recvresponse packet in the described RS485 bus of interior reception.
Step S107, resolves the response packet that receives, obtains and stores the unique identifier of far-end unit.
Step S108, judges whether response packet collides and whether scan new far-end unit.
Step S109, when response packet collides or scan new far-end unit, resets scan counter COUNT, goes to step S104(and namely again sends scan-data bag to described RS485 bus, repeat described scanning process).
Step S110, when response packet does not collide and do not scan new far-end unit, the value of scan counter COUNT adds one, then goes to step S104.
With reference to Fig. 2, the handling process in far-end unit comprises:
Step S201, generates unique identifier (or being sequence number).This unique identifier can use one or more in hardware encoding information, time, random number, adopts certain algorithm to obtain.Such as: minute, second of unique identifier=current time in system and microsecond number sum.In software field, existing a lot of method calculating unique identifier by hardware encoding information, time or random number, such as method generating key etc., these methods all can be applicable to the present invention.
Step S202, when (that is, after receiving described initialization package) after receiving the initialization command from main control unit, is placed in zero-address state by self.
Step S203, generates response packet after receiving the scan-data bag of main control unit, and the unique identifier that self generates is inserted response packet.
Step S204, waits for one section of random time T rnd, this random time T rndwith the number N of the far-end unit in RS485 bus dev, the message transmission rate (i.e. baud rate) of RS485 bus and response packet length relevant.Typically, under the condition that reply data packet length is constant, bus baud rate is higher, sends the packet used time fewer; And far-end unit number is more in bus, the probability of collision is larger, and sending response packet needs the random time of wait also just correspondingly elongated.In certain embodiments, random time T is calculated by the following method rnd: suppose that the upper limit transmission time of response packet is that 20ms(comprises transmission and program resolution data bag time), then can in order to random number to far-end unit number N devdelivery, is then multiplied by 20ms as random time T rnd.
Step S205, is sent to response packet in RS485 bus.
In handling process in said distal ends unit, reduced the situation causing communication failure because of bus collision by step S204.In certain embodiments, can also detect by bus free the situation avoiding to greatest extent causing communication failure because of bus collision, that is: before transmission packet, judge that whether RS485 bus is idle; Start to send packet when RS485 bus free; Again judge that whether RS485 bus is idle when RS485 bus busy waits for a period of time.Fig. 3 shows a kind of bus free testing process.
As shown in Figure 3, this bus free testing process comprises:
Step S301, records time of reception T when receiving packet pre.
Step S302, obtains current time T when being ready for sending packet cur.
Step S303, the time interval (T calculating current time and receive for the last time between packet cur– T pre).The first set point T is not less than when the described time interval thr(i.e. T cur– T pre>=T thr) time, judge described RS485 bus free; Otherwise judge that described RS485 bus is done.
Step S304, again obtains current time when RS485 bus busy waits for a period of time, again compares judgement.
The first set point T in above-mentioned steps S303 thrthe preferably Transmission Time Interval Tg of a typical data bag, it is relevant to the length of the message transmission rate of RS485 bus, the number of far-end unit and packet.First set point T thralso can be the fixed value rule of thumb set.Suppose that Bus Speed is 9600bps, there are 16 far-end units, reply data packet length is fixed as 24 bytes, then transmit each packets need 20 milliseconds, because each far-end unit arranges random delay when sending response packet, and the scanning bag of no longer answer bus after successful respond scanning bag, the probability of rear collision is more and more less, according to far-end unit number, can by the first set point T thrbe set as 80 milliseconds.First set point T thrtoo large or too little all bad, too conference causes far-end unit transmission response packet wait for too for a long time and then cause scan operation consuming time too of a specified duration; Too littlely can strengthen response packet collision probability, cause repeatedly sending scanning bag.
As shown in Figure 4, at above-mentioned steps S108, judge whether response packet collides by the following method:
Step S401, carries out data splicing, analysis after receiving packet.
Step S402, detects beginning flag and the end mark of response packet, there occurs collision when not full-time this response packet of judgement of beginning flag and end mark transmits in RS485 bus.
Step S403, when the check results of response packet is incorrect, there occurs collision when judging that this response packet transmits in RS485 bus.
Below detailed description is compared to invention has been in conjunction with specific embodiments; but these specific descriptions should not be construed as limiting the scope of the invention; those skilled in the art can also carry out modifying or being equal to replacing according to explanation of the present invention, and protection scope of the present invention is as the criterion with claims.

Claims (8)

1. the scan method of the network equipment in RS485 bus, the described network equipment comprises main control unit and some far-end units, it is characterized in that, described scan method comprises the following steps:
The each self-generating unique identifier of described some far-end units;
Described main control unit sends scan-data bag to described RS485 bus, in first time period, then receive the response packet in described RS485 bus;
Far-end unit generates response packet after receiving described scan-data bag, and the unique identifier that self generates is inserted response packet, is then sent in described RS485 bus;
Described main control unit resolves the response packet received, and obtains and stores the unique identifier of far-end unit.
2. the scan method of the network equipment in RS485 bus according to claim 1, it is characterized in that, described scan method also comprises:
Before transmission packet, judge that whether described RS485 bus is idle;
Start to send packet when described RS485 bus free; And
Again judge that whether described RS485 bus is idle when described RS485 bus busy waits for a period of time.
3. the scan method of the network equipment in RS485 bus according to claim 2, is characterized in that, judges whether idle method comprises described RS485 bus:
Obtain current time;
The time interval calculating current time and receive for the last time between packet;
When the described time interval is not less than the first set point, judge described RS485 bus free, otherwise judge that described RS485 bus is done.
4. the scan method of the network equipment in RS485 bus according to claim 3, it is characterized in that, described first set point is relevant to the length of the described message transmission rate of RS485 bus, the number of far-end unit and packet.
5. the scan method of the network equipment in RS485 bus according to claim 1, it is characterized in that, far-end unit waits for one section of random time before sending response packet, and this random time is relevant to the message transmission rate of the far-end unit number in RS485 bus, RS485 bus and the length of response packet.
6. the scan method of the network equipment in RS485 bus according to claim 1, it is characterized in that, described scan method also comprises:
Main control unit judges whether response packet collides and whether scan new far-end unit after resolving response packet;
When response packet collides or scan new far-end unit, scan counter is reset, again send scan-data bag to described RS485 bus, repeat described scanning process;
When response packet does not collide and do not scan new far-end unit, scan counter counts; And
When the value of scan counter reaches the second set point, terminate scanning.
7. the scan method of the network equipment in RS485 bus according to claim 6, it is characterized in that, judge that the method whether response packet collides is: detect the beginning flag of response packet, end mark and check results, when beginning flag and end mark are incomplete or check results is incorrect, when judging that this response packet transmits in described RS485 bus, there occurs collision.
8. the scan method of the network equipment in RS485 bus according to claim 1, it is characterized in that, described scan method also comprises:
Described main control unit RS485 bus described in transmission scan-data bag forward direction sends initialization package; And
After far-end unit receives described initialization package, self is set to zero-address state.
CN201410155527.1A 2014-04-17 2014-04-17 Scanning method for network equipment on RS485 bus Pending CN105024897A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410155527.1A CN105024897A (en) 2014-04-17 2014-04-17 Scanning method for network equipment on RS485 bus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410155527.1A CN105024897A (en) 2014-04-17 2014-04-17 Scanning method for network equipment on RS485 bus

Publications (1)

Publication Number Publication Date
CN105024897A true CN105024897A (en) 2015-11-04

Family

ID=54414622

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410155527.1A Pending CN105024897A (en) 2014-04-17 2014-04-17 Scanning method for network equipment on RS485 bus

Country Status (1)

Country Link
CN (1) CN105024897A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106021148A (en) * 2016-05-12 2016-10-12 深圳市兴源智能仪表股份有限公司 Automatic search method for communication address of bus equipment
CN107360180A (en) * 2017-08-01 2017-11-17 上海斐讯数据通信技术有限公司 A kind of portal authentication method and system based on radio reception device monitoring
CN112888063A (en) * 2021-03-02 2021-06-01 三维通信股份有限公司 Remote terminal network access method, system, electronic device and storage medium
CN113543202A (en) * 2021-07-29 2021-10-22 陕西天基通信科技有限责任公司 Method and system for reporting SN (serial number)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101163075A (en) * 2006-10-10 2008-04-16 中兴通讯股份有限公司 Method of implementing embedded device address installation by RS 485 bus competition
CN101626581A (en) * 2008-07-08 2010-01-13 中国移动通信集团公司 Method, device and system for scanning equipment in electrically adjustable antenna interface
CN101888018A (en) * 2009-05-14 2010-11-17 中兴通讯股份有限公司 Electric tilt antenna control device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101163075A (en) * 2006-10-10 2008-04-16 中兴通讯股份有限公司 Method of implementing embedded device address installation by RS 485 bus competition
CN101626581A (en) * 2008-07-08 2010-01-13 中国移动通信集团公司 Method, device and system for scanning equipment in electrically adjustable antenna interface
CN101888018A (en) * 2009-05-14 2010-11-17 中兴通讯股份有限公司 Electric tilt antenna control device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106021148A (en) * 2016-05-12 2016-10-12 深圳市兴源智能仪表股份有限公司 Automatic search method for communication address of bus equipment
CN107360180A (en) * 2017-08-01 2017-11-17 上海斐讯数据通信技术有限公司 A kind of portal authentication method and system based on radio reception device monitoring
CN112888063A (en) * 2021-03-02 2021-06-01 三维通信股份有限公司 Remote terminal network access method, system, electronic device and storage medium
CN113543202A (en) * 2021-07-29 2021-10-22 陕西天基通信科技有限责任公司 Method and system for reporting SN (serial number)

Similar Documents

Publication Publication Date Title
CN101626581B (en) Method, device and system for scanning equipment in electrically adjustable antenna interface
CN101345581B (en) Fault location method and system for passive optical network
CN105024897A (en) Scanning method for network equipment on RS485 bus
CN102740337B (en) The long-distance maintenance method of base station and system
CN101690009A (en) Communication system and communication method
EP2698948A1 (en) Method and device for determining failure elimination based on oam protocol
CN106302032B (en) A kind of point-to-multipoint poll means of communication
KR101961053B1 (en) Method, device and system for detecting rogue optical network unit
CN106549967A (en) A kind of IEC104 stipulations analysis system and methods based on event-driven mechanism
CN107800588B (en) Cross-platform network performance test system and method based on Y.1731 protocol
CN104753701A (en) Data processing method, device and system for optical network unit (ONU)
CN109981404A (en) Ad hoc network structure and its diagnostic method
CN101404601B (en) Ethernet communication method and apparatus
US20140219383A1 (en) Transmission line address overlap detection system and substation terminal used in the system
US8213792B2 (en) Automatic ONT self disabling system, method, and computer readable medium
CN113965466B (en) Data transmission system adaptive to network bandwidth
CN105516255A (en) Method for pushing configuration from MoCA central office to terminal device and corresponding device
CN104581796B (en) A kind of sending method, CSE and the system of M2M application request
CN111654551B (en) Transmission control method and system for stress dispersion locking data of railway jointless track
CN104796773A (en) Transmission and processing method for multi-device input events
JP3777809B2 (en) Method for detecting line abnormality in duplex communication system
CN101247287B (en) Fault detection method of operation management maintenance mechanism
JP2007158943A (en) Optical subscriber line terminal equipment and fault detecting method of optical subscriber line (sl) terminating device
JPH08106306A (en) Data transmitter
CN105306135A (en) Link polling detection method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20151104