CN106453012A - Serial bus communication method and apparatus - Google Patents

Serial bus communication method and apparatus Download PDF

Info

Publication number
CN106453012A
CN106453012A CN201610844463.5A CN201610844463A CN106453012A CN 106453012 A CN106453012 A CN 106453012A CN 201610844463 A CN201610844463 A CN 201610844463A CN 106453012 A CN106453012 A CN 106453012A
Authority
CN
China
Prior art keywords
slave station
port
designated
response message
preset duration
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.)
Granted
Application number
CN201610844463.5A
Other languages
Chinese (zh)
Other versions
CN106453012B (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.)
Jiangsu Chuangrei Xinyuan Intelligent Technology Co ltd
Original Assignee
Nanjing Chuangruida Electric Power Technology 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 Nanjing Chuangruida Electric Power Technology Co Ltd filed Critical Nanjing Chuangruida Electric Power Technology Co Ltd
Priority to CN201610844463.5A priority Critical patent/CN106453012B/en
Publication of CN106453012A publication Critical patent/CN106453012A/en
Application granted granted Critical
Publication of CN106453012B publication Critical patent/CN106453012B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40169Flexible bus arrangements
    • H04L12/40176Flexible bus arrangements involving redundancy
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/403Bus networks with centralised control, e.g. polling

Abstract

The invention provides a serial bus communication method and apparatus which relate to the serial communication technology field. The method of the invention is applied to a main station for communications with a plurality of slave stations through buses. The method comprises the following steps: according to a preset rule, identifying two ports as a main port and a standby port; when the main station is powered on, through the main port, identifying the slave stations as first slave stations and second slave stations; and through the slave port, identifying the slave stations as third slave stations and second slave stations; through the main port, polling the second slave stations in a preset number and the first slave stations wherein the preset number is smaller than that of the second slave stations; identifying the first slave stations without response as the second slave stations; identifying the second slave stations with response as the first slave stations; through the slave port, polling in turn the second slave stations in a preset number and the third slave stations; identifying the third slave stations without response as the second slave stations; and identifying the second slave stations with response as the third slave stations; and through the main port, polling again in turn the second slave stations in a preset number and the first slave stations.

Description

A kind of serial bus communication method and device
Technical field
The present invention relates to serial communication technology field, in particular to a kind of serial bus communication method and device.
Background technology
In existing dual bus serial communication, main website is periodically polled each slave station, when slave station exceedes Preset Time not During response, main website can resend message several times, if main website does not receive the response of slave station yet, will judge slave station state as exception. The time for being spent when aforesaid way is to inquiring in the slave station of abnormality is more, when the slave station in abnormality relatively When many, it will take considerable time, reduce communication efficiency.
Content of the invention
In view of this, it is an object of the invention to provide a kind of serial bus communication method and device, to solve above-mentioned asking Topic.
To achieve these goals, the embodiment of the present invention is adopted the following technical scheme that:
A kind of serial bus communication method, is applied to the main website with multiple slave station communications, the main website by bus Including two ports, methods described includes:
According to preset rules, described two ports are individually identified as master port and standby port;
In upper electricity by each slave station of the master port poll, the slave station for having response is designated the first slave station, will not had The slave station of response is designated the second slave station;
In upper electricity by each slave station of the standby port poll, the slave station for having response is designated the 3rd slave station, will not had The slave station for having response is designated the second slave station;
By the second slave station and each first slave station of the master port poll predetermined number, wherein, the predetermined number is little Quantity in second slave station;
Monitor whether that there is preset duration does not send the first slave station of response message and with the presence or absence of the preset duration Interior send response message the second slave station, the first slave station that the preset duration is not sent response message be designated second from Stand, the second slave station that response message is sent in the preset duration is designated the first slave station;
By the second slave station of predetermined number described in the standby port poll and each 3rd slave station;And
Monitor whether there is the 3rd slave station that the preset duration does not send response message, and with the presence or absence of described default The second slave station of response message is sent in duration, and the 3rd slave station that the preset duration is not sent response message is designated second Slave station, the second slave station for sending response message in the preset duration is designated the 3rd slave station, and salty by the main side Second slave station of new poll predetermined number and each first slave station.
Another embodiment of the present invention provide a kind of serial bus communication device, be applied to by bus with multiple from Stand the main website of communication, the main website includes two ports, and the serial bus communication device includes:
Port-mark module, for being individually identified as master port and standby end according to preset rules by described two ports Mouthful;
First slave station mark module, in upper electricity by each slave station of the master port poll, having the slave station of response The first slave station is designated, the slave station not responded to is designated the second slave station;
Second slave station mark module, in upper electricity by each slave station of the standby port poll, by have response from Station identifications are the 3rd slave station, and the slave station not responded to is designated the second slave station;
First poller module, for the second slave station by the master port poll predetermined number and each first slave station, its In, the predetermined number is less than the quantity of second slave station;
First monitoring modular, does not send first slave station and whether of response message for monitoring whether to exist preset duration There is the second slave station for sending response message in the preset duration, by the preset duration do not send the first of response message from Station identifications are the second slave station, and the second slave station for sending response message in the preset duration is designated the first slave station;
Second poller module, for by the second slave station of predetermined number described in the standby port poll and each 3rd from Stand;And
Second monitoring modular, for monitoring whether to there is the 3rd slave station that the preset duration does not send response message, with And with the presence or absence of the second slave station of response message is sent in the preset duration, the preset duration is not sent response message 3rd slave station is designated the second slave station, and the second slave station for sending response message in the preset duration is designated the 3rd slave station, And the second slave station by the master port again poll predetermined number and each first slave station.
Serial bus communication method provided in an embodiment of the present invention and device pass through each slave station of master port poll in upper electricity, The slave station for having response is designated the first slave station, the slave station not responded to is designated the second slave station.In upper electricity by standby The each slave station of port polling, the slave station for having response is designated the 3rd slave station, and the slave station not responded to is designated the second slave station.This When being polled to each slave station by master port or standby port afterwards, for the second slave station, each poll is only to predetermined number The second slave station send inquiry, the predetermined number less than the second slave station quantity.By above-mentioned design, significantly reduce logical The letter time, improve communication efficiency.
Description of the drawings
In order to be illustrated more clearly that the technical scheme of the embodiment of the present invention, below by to be used attached needed for embodiment Figure does simple introduction, it will be appreciated that the following drawings illustrate only certain embodiments of the present invention, therefore should not be construed as Restriction to scope, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis These accompanying drawings obtain other related accompanying drawings.
Fig. 1 be main website provided in an embodiment of the present invention with multiple slave stations interact schematic diagram.
Fig. 2 is a kind of block diagram of main website provided in an embodiment of the present invention.
Fig. 3 is a kind of connection block diagram of serial bus communication device provided in an embodiment of the present invention.
Fig. 4 is another connection block diagram of serial bus communication device provided in an embodiment of the present invention.
Fig. 5 is a kind of schematic flow sheet of serial bus communication method provided in an embodiment of the present invention.
Fig. 6 is another schematic flow sheet of serial bus communication method provided in an embodiment of the present invention.
Fig. 7 is the sub-step schematic diagram of step S410 in Fig. 5.
Fig. 8 is the sub-step schematic diagram of step S420 in Fig. 5.
Fig. 9 is the sub-step schematic diagram of step S430 in Fig. 5.
Icon:100- main website;101- memorizer;102- storage control;103- processor;104- Peripheral Interface;105- Input-output unit;106- detection components;200- serial bus communication device;210- port-mark module;211- poll submodule Block;212- port identification submodule;220- the first slave station mark module;221- master port poll submodule;222- the 3rd is monitored Submodule;The first slave station of 223- divides submodule;230- the second slave station mark module;231- standby port poll submodule; 232- the 4th monitors submodule;The second slave station of 233- divides submodule;The first poller module of 240-;The first monitoring modular of 250-; The second poller module of 260-;The second monitoring modular of 270-;280- numbering module;290- inquires module;300- slave station.
Specific embodiment
Purpose, technical scheme and advantage for making the embodiment of the present invention is clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, clear, complete description is carried out to the technical scheme in the embodiment of the present invention, it is clear that the embodiment of the description It is a part of embodiment of the present invention, and not all embodiment.Reality of the present invention generally described and illustrated in accompanying drawing herein The component for applying example can be arranged and be designed with a variety of configurations.
Therefore, the detailed description of embodiments of the invention below to providing in the accompanying drawings is not intended to limit claimed The scope of the present invention, but be merely representative of the selected embodiment of the present invention.Based on the embodiment in the present invention, this area is common The every other embodiment obtained under the premise of creative work is not made by technical staff, belongs to the model of present invention protection Enclose.
It should be noted that:Similar label and letter represent similar terms in following accompanying drawing, therefore, once a certain Xiang Yi It is defined in individual accompanying drawing, then which need not be defined further and explain in subsequent accompanying drawing.
Refer to Fig. 1, be main website provided in an embodiment of the present invention 100 with multiple slave stations 300 interact schematic diagram.The master Stand and 100 communicated with the plurality of slave station 300 by bus, the main website 100 includes two ports, two of the main website 100 Port is communicated with slave station each described 300 by bus respectively.
Fig. 2 is referred to, is a kind of block diagram of main website 100 provided in an embodiment of the present invention.The main website 100 includes Serial bus communication device 200, memorizer 101, storage control 102, processor 103, Peripheral Interface 104, input and output list Unit 105 and detection components 106.
The memorizer 101, storage control 102, processor 103, Peripheral Interface 104, input-output unit 105 and inspection Survey each element of component 106 to be directly or indirectly electrically connected with each other, to realize transmission or the interaction of signal.For example, These elements can pass through one or more communication bus each other or holding wire is realized being electrically connected with.The serial bus communication Device 200 includes at least one software that can be stored in the form of software or firmware (firmware) in the memorizer 101 Functional module.The processor 103 is used for executing the executable module for storing in memorizer 101, and the such as universal serial bus leads to Software function module or computer program that T unit 200 includes.
Wherein, memorizer 101 may be, but not limited to, random-access memory (Random Access memory, RAM), read only memory (Read Only Memory, ROM), programmable read only memory (Programmable Read-Only Memory, PROM), erasable read-only memory (Erasable Programmable Read-Only Memory, EPROM), Electricallyerasable ROM (EEROM) (Electric Erasable Programmable Read-Only Memory, EEPROM) etc.. Wherein, memorizer 101 is used for storage program, and the processor 103 executes described program after execute instruction is received, this The method of the flow definition disclosed in bright embodiment any embodiment is can apply in processor 103, or by processor 103 realize.
Processor 103 can be a kind of IC chip, the disposal ability with signal.Above-mentioned processor 103 is permissible It is general processor, including central processing unit (Central Processing Unit, abbreviation CPU), network processing unit (Network Processor, abbreviation NP) etc..Can also be digital signal processor (DSP), special IC (ASIC), Ready-made programmable gate array (FPGA) or other PLDs, discrete gate or transistor logic, discrete hard Part component.Can realize or execute disclosed each method in the embodiment of the present invention, step and logic diagram.General processor Can be microprocessor or the processor 103 can also be any conventional processor etc..
The Peripheral Interface 104 is by various input/output devices coupled to processor 103 and memorizer 101.At some In embodiment, Peripheral Interface 104, processor 103 and storage control 102 can be realized in one single chip.Other one In a little embodiments, they can be realized by independent chip respectively.
It is appreciated that structure shown in Fig. 2 is only illustrate, the main website 100 can also include more more than shown in Fig. 2 or Less, or with the configuration different from shown in Fig. 2.Each component shown in Fig. 2 can adopt hardware, software or its combination real Existing.
It should be noted that each slave station 300 has and 100 identical component of the main website, and each group in each slave station 300 The connected mode of part is identical with the connected mode of each component in the main website 100, and here is omitted.
Fig. 3 is referred to, is a kind of functional module frame of serial bus communication device 200 that present pre-ferred embodiments are provided Figure.The serial bus communication device 200 is applied to the main website 100 for communicating by bus, institute with the plurality of slave station 300 Stating main website 100 includes two ports.The serial bus communication device 200 includes port-mark module 210, first from station identifications Module 220, the second slave station mark module 230, the first poller module 240, the first monitoring modular 250, the second poller module 260 with And second monitoring modular 270.
Wherein, the port-mark module 210 is used for, according to preset rules, described two ports are individually identified as main side Mouth and standby port.
When implementing, the main website 100 by the master port and standby port alternately each slave station 300 of poll, and according to Whether each slave station 300 responds and for each slave station 300 to be individually identified as the first slave station, the second slave station and the 3rd slave station.
Alternatively, in embodiments of the present invention, the port-mark module 210 can include poll submodule 211 and end Mouth identification submodule 212.
The poll submodule 211 is used for respectively by each slave station 300 of described two port pollings.
The port identification submodule 212 is used for being firstly received the port-mark of response message in described two ports For master port, another port is designated standby port.
Wherein, the main website 100 can pass through each slave station 300 of described two port pollings respectively in poll first, respectively The inquiry sent by main website 100 is responded by slave station 300, and now, main website 100 will be firstly received sound in described two ports Answer the fracture of information that master port is designated, another port is designated standby port.
The first slave station mark module 220 is used for, in upper electricity by each slave station 300 of the master port poll, having sound The slave station 300 that answers is designated the first slave station, and the slave station 300 not responded to is designated the second slave station.
It should be noted that each described slave station 300 includes two ports, one of port is by bus and the master Stand 100 main side port communications, another port is communicated with the standby port of the main website 100 by bus.
Wherein, after master port and standby port is identified, the main website 100 is by the master port successively to each slave station 300 send inquiry, and the slave station 300 not responded to is designated the second slave station.That is, being identified as the slave station 300 of the first slave station There is response with the port of the main side port communications, i.e., being capable of normal work.It is identified as the slave station 300 of the second slave station and the master The port of port communication does not respond to, i.e., cannot normal work.
Alternatively, in embodiments of the present invention, the first slave station mark module 220 can include master port poll submodule Block the 221, the 3rd monitors submodule 222 and the first slave station divides submodule 223.
The master port poll submodule 221 is used in upper electricity by each slave station 300 of the master port poll.
The 3rd monitoring submodule 222 is used for the slave station 300 for monitoring whether to there is the non-response message of the preset duration, When there is the slave station 300 that the preset duration does not send response message, send to the slave station 300 again through the master port Inquiry, and record the inquiry number of times for sending to the slave station 300.
First slave station divides submodule 223 to be used for reaching preset times when the inquiry number of times for sending to the slave station 300 When, if the response message that the slave station 300 sends is had been received by, the slave station 300 is designated the first slave station, otherwise by the slave station 300 are designated second slave station.
Wherein, in upper electricity, by each slave station 300 of master port poll, and whether responded according to each slave station 300 and identified For the first slave station and the second slave station.But each slave station 300 needs certain time on startup, only send once to each slave station 300 Whether inquiry possibly cannot determine the corresponding port of the slave station 300 being capable of normal work.Therefore, upper electricity when may need to Each slave station 300 sends multiple inquiry.
For example, the preset times can be 3 times, when the main website 100 is sent to each slave station 300 by the master port During inquiry, if first time for being sent by master port of 300 pairs of main websites 100 of a certain slave station and/or second inquiry have response, Then the slave station 300 is designated the first slave station.If 300 pairs of main websites 100 of a certain slave station are ask by three times that master port sends Ask all and no respond, then the slave station 300 is designated the second slave station.
The second slave station mark module 230 is used for passing through each slave station 300 of the standby port poll in upper electricity, will have The slave station 300 of response is designated the 3rd slave station, and the slave station 300 not responded to is designated the second slave station.
Wherein, after the first slave station and the second slave station is identified, the main website 100 is by the standby port successively to each Slave station 300 sends inquiry, and the slave station 300 for having response is designated the 3rd slave station, and the slave station 300 not responded to is designated second Slave station.That is, the port that communicates with the standby port of the slave station 300 for being identified as the 3rd slave station can normal work, marked Knowing port that the slave station 300 for the second slave station communicated with the standby port cannot normal work.
Therefore, being identified as the slave station 300 of the second slave station, include cannot normal work with the port of the main side port communications Slave station 300, the port for communicating with the standby port cannot normal work slave station 300, and two ports all cannot be just The slave station 300 for often working.
Alternatively, in embodiments of the present invention, the second slave station mark module 230 can include standby port poll Module the 231, the 4th monitors submodule 232 and the second slave station divides submodule 233.
Wherein, the standby port poll submodule 231 is used in upper electricity, by each slave station of the standby port poll 300.
The 4th monitoring submodule 232 is used for the slave station 300 for monitoring whether to there is the non-response message of the preset duration, When there is the slave station 300 that the preset duration does not send response message, again through the standby port to the slave station 300 Go out inquiry, and record the inquiry number of times for sending to the slave station 300.
Second slave station divides submodule 233 to be used for reaching described presetting when the inquiry number of times for sending to the slave station 300 During number of times, if the response message that the slave station 300 sends is had been received by, the slave station 300 is designated the 3rd slave station, otherwise The slave station 300 is designated second slave station.
Wherein, in upper electricity, by each slave station 300 of the standby port poll, and whether general is responded according to each slave station 300 Which is designated the 3rd slave station and the second slave station.In the same manner, when being polled to each slave station 300, for the slave station 300 not responded to Need to send accuracy of the multiple inquiry to ensure to identify result.
So that the preset times are 4 times as an example, when the main website 100 is gone out to 300 method of each slave station by the standby port During inquiry, if a certain slave station first time that the main website is sent by standby port and/or second and/or third time are inquired There is response, then the slave station 300 is designated the 3rd slave station.If 300 pairs of main websites 100 of a certain slave station are sent by standby port Four inquiries all do not respond to, then the slave station 300 is designated the second slave station.
First poller module 240 be used for by the second slave station of the master port poll predetermined number and each first from Stand.
Wherein, the predetermined number improves communication effect less than the quantity of second slave station in order to reduce call duration time Rate, only sends inquiry to the second slave station of predetermined number in each wheel inquiry.For example, when second slave station is multiple, The predetermined number is less than 1/3rd of the quantity of second slave station.Again for example, the predetermined number can be 1~4.
First monitoring modular 250 be used for monitoring whether to exist preset duration do not send the first slave station of response message with And with the presence or absence of the second slave station of response message is sent in the preset duration, the preset duration is not sent response message First slave station is designated the second slave station, and the second slave station for sending response message in the preset duration is designated the first slave station.
Wherein, end of the slave station 300 of the first slave station through after a period of time, with the main side port communications is identified as before Mouth may break down, it is impossible to the inquiry that normal response main website 100 is sent by master port.Be identified as before second from The slave station 300 that stands, may be recovered normal with the port of the main side port communications through after a period of time, being capable of normal response The inquiry that main website 100 is sent by master port.
Alternatively, the preset duration can be 30 milliseconds to 50 milliseconds, and the embodiment of the present invention is not restricted to this.
It is thus desirable to re-starting mark according to the current response condition of each slave station 300 to each slave station 300.For described pre- If the second slave station of quantity, if a certain second slave station can respond the main website 100 by the master in the preset duration The inquiry that port sends, then be designated the first slave station by second slave station.For each first slave station, if a certain first slave station exceeds Inquiry that the main website 100 by the master port sent still cannot respond to after the preset duration, then by the first slave station mark Know for the second slave station.
Second poller module 260 is used for by the second slave station of predetermined number described in the standby port poll and each 3rd slave station.
Second monitoring modular 270 be used for monitoring whether to exist the preset duration do not send the 3rd of response message from Standing, and with the presence or absence of the second slave station of response message is sent in the preset duration, the preset duration is not sent response 3rd slave station of information is designated the second slave station, and the second slave station for sending response message in the preset duration is designated the 3rd Slave station, and the second slave station by the master port again poll predetermined number and each first slave station.
Wherein, the slave station 300 of the 3rd slave station being identified as before through after a period of time, communicates with the standby port Port may have been broken down, it is impossible to respond the inquiry that main website 100 is sent by standby port.Be identified as before second from The slave station 300 that stands is through after a period of time, and the port for communicating with the standby port may be recovered normal, normally can ring The inquiry for answering main website 100 to send by standby port.
It is thus desirable to re-starting mark according to the current response condition of each slave station 300 to each slave station 300.For each 3rd Slave station, if a certain 3rd slave station still cannot respond to what the main website 100 was sent by standby port after exceeding the preset duration Inquiry, then be designated the second slave station by the 3rd slave station.For the second slave station of the predetermined number, if a certain second slave station energy Enough respond, in the preset duration, the inquiry that the main website 100 is sent by standby port, then second slave station is designated 3rd slave station.
Alternatively, as shown in figure 4, the serial bus communication device 200 can also include numbering module 280 and inquiry mould Block 290.
Wherein, the numbering module 280 is used for when arbitrary slave station 300 is designated second slave station, to the slave station 300 address information is numbered and is stored.
The main website 100 in the second slave station by master port or standby port poll predetermined number, need according to Certain order selects the second slave station of each poll.It is alternatively possible to arbitrary slave station 300 is being designated second slave station When, the address information of the slave station 300 is numbered, and is stored after numbering is associated with address information.The inquiry module 290 For when each second slave station is inquired, less second slave station is numbered in first inquiry.
The numbering of each second slave station can be inquired about, first to less numbering institute when each second slave station is inquired by the main website 100 The address of corresponding second slave station sends inquiry.
By above-mentioned design, for cannot the slave station 300 inquired of normal response main website 100 be the second slave station, main website 100 exists When being polled, the second slave station of a poll predetermined number, and whole second slave stations of non-polled, reduce call duration time.
Fig. 5 is referred to, is a kind of schematic flow sheet of serial bus communication method that present pre-ferred embodiments are provided.Institute State method and step defined in the relevant flow process of method to be realized by the processor 103.Below by the tool shown in Fig. 5 Body flow process is described in detail.
Step S410:According to preset rules, described two ports are individually identified as master port and standby port.
In the present embodiment, the port-mark module 410 that step S410 can be shown in Fig. 3 is executed.
Step S420:In upper electricity by each slave station 300 of the master port poll, the slave station 300 for having response is designated First slave station, the slave station 300 not responded to is designated the second slave station.
In the present embodiment, the first slave station mark module 220 that step S420 can be shown in Fig. 3 is executed.
Step S430:In upper electricity by each slave station 300 of the standby port poll, the slave station 300 for having response is identified For the 3rd slave station, the slave station 300 not responded to is designated the second slave station.
In the present embodiment, the second slave station mark module 230 that step S430 can be shown in Fig. 3 is executed.
Step S440:By the second slave station and each first slave station of the master port poll predetermined number.
In the present embodiment, the first poller module 240 that step S440 can be shown in Fig. 3 is executed.
Step S450:Monitor whether that there is preset duration does not send the first slave station of response message and with the presence or absence of described The second slave station of response message is sent in preset duration, and the first slave station that the preset duration is not sent response message is designated Second slave station, the second slave station for sending response message in the preset duration is designated the first slave station.
In the present embodiment, the first monitoring modular 250 that step S450 can be shown in Fig. 3 is executed.
Step S460:By the second slave station and each 3rd slave station of the standby port poll predetermined number.
In the present embodiment, the second poller module 260 that step S460 can be shown in Fig. 3 is executed.
Step S470:Monitor whether there is the 3rd slave station that the preset duration does not send response message, and whether deposit The second slave station of response message is sent in the preset duration, and the preset duration is not sent the 3rd slave station of response message The second slave station is designated, the second slave station for sending response message is designated the 3rd slave station, and passes through institute in the preset duration State master port the second slave station of poll predetermined number and each first slave station again.
In the present embodiment, the second monitoring modular 270 that step S470 can be shown in Fig. 3 is executed.
Alternatively, as shown in fig. 6, the serial bus communication method can also include step S480 and step S490.
Step S480:When arbitrary slave station 300 is designated second slave station, the address information of the slave station 300 is numbered And stored.
In the present embodiment, the numbering module 280 that step S480 can be shown in Fig. 4 is executed.
Step S490:In each second slave station of poll, first inquiry is sent to less second slave station of numbering.
In the present embodiment, the inquiry module 290 that step S490 can be shown in Fig. 4 is executed.
Alternatively, as shown in fig. 7, step S410 can include sub-step S501 and sub-step S502.
Step S501:Respectively by each slave station 300 of described two port pollings.
In the present embodiment, the poll submodule 211 that sub-step S501 can be shown in Fig. 3 is executed.
Step S502:The port-mark for being firstly received response message in described two ports is master port, will be another Port-mark is standby port.
In the present embodiment, the port identification submodule 212 that sub-step S502 can be shown in Fig. 3 is executed.
Alternatively, as shown in figure 8, step S420 can include sub-step S601, sub-step S602 and sub-step S603.
Sub-step S601:During upper electricity, by each slave station 300 of the master port poll.
In the present embodiment, the master port poll submodule 221 that sub-step S601 can be shown in Fig. 3 is executed.
Sub-step S602:Monitor whether there is the slave station 300 that the preset duration does not send response message, described existing When preset duration does not send the slave station 300 of response message, inquiry is sent again through the master port to the slave station 300, and remember Record the inquiry number of times for sending to the slave station 300.
In the present embodiment, the 3rd monitoring submodule 222 that sub-step S602 can be shown in Fig. 3 is executed.
Sub-step S603:When the inquiry number of times for sending to the slave station 300 reaches preset times, if having been received by the slave station 300 send response messages, then the slave station 300 is designated the first slave station, otherwise by the slave station 300 be designated described second from Stand.
In the present embodiment, the first slave station division submodule 223 that sub-step S603 can be shown in Fig. 3 is executed.
Alternatively, as shown in figure 9, step S430 can include sub-step S701, sub-step S702 and sub-step S703.
Sub-step S701:During upper electricity, by each slave station 300 of the standby port poll.
In the present embodiment, sub-step S701 can have the standby port poll submodule 231 shown in Fig. 3 to execute.
Sub-step S702:Monitor whether there is the slave station 300 that the preset duration does not send response message, described existing When preset duration does not send the slave station 300 of response message, inquiry is sent again through the standby port to the slave station 300, and Record the inquiry number of times for sending to the slave station 300.
In the present embodiment, sub-step S702 can have the 4th monitoring submodule 232 shown in Fig. 3 to execute.
Sub-step S703:When the inquiry number of times for sending to the slave station 300 reaches the preset times, if having been received by this The response message that slave station 300 sends, then be designated the 3rd slave station by the slave station 300, otherwise the slave station 300 be designated institute State the second slave station.
In the present embodiment, sub-step S703 can have the second slave station division submodule 233 shown in Fig. 3 to execute.
In sum, serial bus communication method provided in an embodiment of the present invention and device pass through master port wheel in upper electricity Ask each slave station 300, the slave station 300 for having response be designated the first slave station, by the slave station 300 not responded to be designated second from Stand.Pass through each slave station 300 of standby port poll in upper electricity, the slave station 300 for having response is designated the 3rd slave station, will be without sound The slave station 300 that answers is designated the second slave station.When being polled to each slave station 300 thereafter through master port or standby port, right In the second slave station, each poll only sends inquiry to the second slave station of predetermined number, and the predetermined number is less than the number of the second slave station Amount.By above-mentioned design, the time that main website 100 is expended on the slave station 300 of abnormal work is significantly reduced, so as to improve Communication efficiency.
In several embodiments that the embodiment of the present invention is provided, it should be understood that disclosed system and method, also may be used To realize by another way.System and method embodiment described above is only schematic, for example, in accompanying drawing Flow chart and block diagram show the system of the multiple embodiments according to the present invention, the possibility of method and computer program product is realized Architectural framework, function and operation.At this point, each square frame in flow chart or block diagram can represent module, a program Section or a part for code, a part for the module, program segment or code is comprising one or more for realizing patrolling for regulation Collect the executable instruction of function.It should also be noted that at some as the function of in the implementation that replaces, being marked in square frame Can occur to be different from the order that marked in accompanying drawing.For example, two continuous square frames can essentially be held substantially in parallel OK, they can also execute sometimes in the opposite order, and this is depending on involved function.It is also noted that block diagram and/or The combination of each square frame and block diagram and/or the square frame in flow chart in flow chart, can be with the function of executing regulation or dynamic The special hardware based system that makees, or can combining realizing with specialized hardware and computer instruction realizing.
In addition, each functional module in each embodiment of the present invention can integrate to form an independent portion Divide, or modules individualism, it is also possible to which two or more modules are integrated to form an independent part.
If the function realized using in the form of software function module and as independent production marketing or use when, permissible It is stored in a computer read/write memory medium.Based on such understanding, technical scheme is substantially in other words The part contributed by prior art or the part of the technical scheme can be embodied in the form of software product, the meter Calculation machine software product is stored in a storage medium, is used including some instructions so that a computer equipment (can be individual People's computer, electronic equipment, or network equipment etc.) execute all or part of step of each embodiment methods described of the present invention Suddenly.And aforesaid storage medium includes:USB flash disk, portable hard drive, read only memory (ROM, Read-Only Memory), deposit at random Access to memory (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with the medium of store program codes. It should be noted that herein, term " including ", "comprising" or its any other variant are intended to the bag of nonexcludability Contain, so that a series of process including key elements, method, article or equipment not only include those key elements, but also including Other key elements being not expressly set out, or also include the key element intrinsic for this process, method, article or equipment. In the absence of more restrictions, the key element for being limited by sentence "including a ...", it is not excluded that including the key element Process, method, also there is other identical element in article or equipment.
The preferred embodiments of the present invention are the foregoing is only, the present invention is not limited to, for the skill of this area For art personnel, the present invention can have various modifications and variations.All within the spirit and principles in the present invention, made any repair Change, equivalent, improvement etc., should be included within the scope of the present invention.It should be noted that:Similar label and letter exist Representing similar terms in figure below, therefore, once being defined in a certain Xiang Yi accompanying drawing, being then not required in subsequent accompanying drawing Which is defined further and be explained.
The above, the only specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, and any Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained Cover within protection scope of the present invention.Therefore, protection scope of the present invention described should be defined by scope of the claims.

Claims (10)

1. a kind of serial bus communication method, it is characterised in that be applied to the main website with multiple slave station communications by bus, The main website includes two ports, and methods described includes:
According to preset rules, described two ports are individually identified as master port and standby port;
In upper electricity by each slave station of the master port poll, the slave station for having response is designated the first slave station, will not responded to Slave station be designated the second slave station;
In upper electricity by each slave station of the standby port poll, the slave station for having response is designated the 3rd slave station, will be without sound The slave station that answers is designated the second slave station;
By the second slave station and each first slave station of the master port poll predetermined number, wherein, the predetermined number is less than institute State the quantity of the second slave station;
Monitor whether that there is preset duration does not send the first slave station of response message and send out with the presence or absence of in the preset duration The second slave station of response message is sent, the first slave station that the preset duration is not sent response message is designated the second slave station, will The second slave station for sending response message in the preset duration is designated the first slave station;
By the second slave station of predetermined number described in the standby port poll and each 3rd slave station;And
Monitor whether there is the 3rd slave station that the preset duration does not send response message, and whether there is the preset duration Interior send response message the second slave station, the 3rd slave station that the preset duration is not sent response message be designated second from Stand, the second slave station for sending response message is designated the 3rd slave station, and passes through the master port again in the preset duration Second slave station of poll predetermined number and each first slave station.
2. serial bus communication method according to claim 1, it is characterised in that described according to preset rules by described two The step of individual port is individually identified as master port and standby port, including:
Respectively by each slave station of described two port pollings;And
The port-mark that response message is firstly received in described two ports is master port, another port is designated standby Port.
3. serial bus communication method according to claim 1, it is characterised in that described pass through master port wheel in upper electricity Each slave station is ask, the slave station for having response is designated the first slave station, the step of the slave station not responded to is designated the second slave station, bag Include:
During upper electricity, by each slave station of the master port poll;
Monitoring whether there is the slave station that the preset duration does not send response message, response is not sent there is the preset duration During the slave station of information, inquiry is sent again through the master port to the slave station, and record the inquiry number of times for sending to the slave station; And
When the inquiry number of times for sending to the slave station reaches preset times, if having been received by the response message that the slave station sends, The slave station is designated the first slave station, otherwise the slave station is designated second slave station.
4. serial bus communication method according to claim 3, it is characterised in that described in upper electricity by described standby The each slave station of port polling, the slave station for having response is designated the 3rd slave station, and the slave station not responded to is designated the second slave station Step, including:
During upper electricity, by each slave station of the standby port poll;
Monitoring whether there is the slave station that the preset duration does not send response message, response is not sent there is the preset duration During the slave station of information, inquiry is sent again through the standby port to the slave station, and record the inquiry time for sending to the slave station Number;And
When the inquiry number of times for sending to the slave station reaches the preset times, if having been received by the response letter that the slave station sends Breath, then be designated the 3rd slave station by the slave station, otherwise the slave station be designated second slave station.
5. serial bus communication method according to claim 4, it is characterised in that methods described also includes:
When arbitrary slave station is designated second slave station, the address information of the slave station is numbered and is stored;And
In each second slave station of poll, first inquiry is sent to less second slave station of numbering.
6. a kind of serial bus communication device, it is characterised in that be applied to the main website with multiple slave station communications by bus, The main website includes two ports, and the serial bus communication device includes:
Port-mark module, for being individually identified as master port and standby port according to preset rules by described two ports;
First slave station mark module, in upper electricity by each slave station of the master port poll, by have response from station identifications For the first slave station, the slave station not responded to is designated the second slave station;
Second slave station mark module, in upper electricity by each slave station of the standby port poll, by the slave station mark for having response Know for the 3rd slave station, the slave station not responded to is designated the second slave station;
First poller module, for the second slave station by the master port poll predetermined number and each first slave station, wherein, institute State quantity of the predetermined number less than second slave station;
First monitoring modular, does not send the first slave station of response message and whether there is for monitoring whether to exist preset duration The second slave station of response message is sent in the preset duration, and the preset duration is not sent the first slave station mark of response message Know for the second slave station, the second slave station that response message is sent in the preset duration is designated the first slave station;
Second poller module, for by the second slave station of predetermined number described in the standby port poll and each 3rd slave station; And
Second monitoring modular, for monitoring whether to there is the 3rd slave station that the preset duration does not send response message, Yi Jishi No have the second slave station for sending response message in the preset duration, and the preset duration is not sent the 3rd of response message the Slave station is designated the second slave station, the second slave station for sending response message is designated the 3rd slave station, and leads in the preset duration Cross the master port the second slave station of poll predetermined number and each first slave station again.
7. serial bus communication device according to claim 6, it is characterised in that the port-mark module includes:
Poll submodule, for respectively by each slave station of described two port pollings;And
Port identification submodule, for the port-mark for being firstly received response message in described two ports is master port, Another port is designated standby port.
8. serial bus communication device according to claim 6, it is characterised in that the first slave station mark module bag Include:
Master port poll submodule, in upper electricity, by each slave station of the master port poll;
3rd monitoring submodule, for monitoring whether the slave station that there is the non-response message of the preset duration, described pre- existing If duration does not send the slave station of response message, send inquiry again through the master port to the slave station, and record to this from The inquiry number of times that station sends;And
First slave station division module, during for reaching preset times when the inquiry number of times for sending to the slave station, if having been received by this The response message that slave station sends, then be designated the first slave station by the slave station, otherwise the slave station be designated second slave station.
9. serial bus communication device according to claim 8, it is characterised in that the second slave station mark module bag Include:
Standby port poll submodule, in upper electricity, by each slave station of the standby port poll;
4th monitoring submodule, for monitoring whether the slave station that there is the non-response message of the preset duration, described pre- existing If duration does not send the slave station of response message, inquiry is sent again through the standby port to the slave station, and record to this The inquiry number of times that slave station sends;And
Second slave station divides submodule, during for reaching the preset times when the inquiry number of times for sending to the slave station, if connecing The response message that the slave station sends is received, then the slave station is designated the 3rd slave station, otherwise the slave station is designated described Second slave station.
10. serial bus communication device according to claim 9, it is characterised in that the serial bus communication device is also Including:
Numbering module, for when arbitrary slave station is designated second slave station, going forward side by side to the address information numbering of the slave station Row storage;And
Inquiry module, for when each second slave station is inquired, less second slave station is numbered in first inquiry.
CN201610844463.5A 2016-09-22 2016-09-22 A kind of serial bus communication method and device Active CN106453012B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610844463.5A CN106453012B (en) 2016-09-22 2016-09-22 A kind of serial bus communication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610844463.5A CN106453012B (en) 2016-09-22 2016-09-22 A kind of serial bus communication method and device

Publications (2)

Publication Number Publication Date
CN106453012A true CN106453012A (en) 2017-02-22
CN106453012B CN106453012B (en) 2019-10-22

Family

ID=58165930

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610844463.5A Active CN106453012B (en) 2016-09-22 2016-09-22 A kind of serial bus communication method and device

Country Status (1)

Country Link
CN (1) CN106453012B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114265808A (en) * 2021-12-22 2022-04-01 杭州和利时自动化有限公司 Communication method, device, Profibus DP master station and medium
CN114928557A (en) * 2022-04-07 2022-08-19 北京航空航天大学杭州创新研究院 Equipment off-line detection method for self-adaptive response interval time

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050030933A1 (en) * 2003-08-06 2005-02-10 Hideo Seyama Communication system, communication device, and communication method
CN101212366A (en) * 2007-12-21 2008-07-02 杭州华三通信技术有限公司 Failure detection method, system, and main node in Ethernet loop network
CN101309306A (en) * 2008-07-16 2008-11-19 哈尔滨工业大学 Method for allocating addresses from node device in Modbus communication network
CN102158364A (en) * 2011-05-05 2011-08-17 瑞斯康达科技发展股份有限公司 Time slice scheduling-based device polling method and device
EP2241950B1 (en) * 2005-06-09 2011-09-07 Omron Corporation Communication master station startup period control method
CN102347855A (en) * 2011-07-21 2012-02-08 福建星网锐捷网络有限公司 Method, device and network equipment for realizing bidirectional forwarding detection
US9325567B2 (en) * 2010-12-20 2016-04-26 Schneider Electric Automation Gmbh Communication system, method for operating such a communication system, and communication module

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050030933A1 (en) * 2003-08-06 2005-02-10 Hideo Seyama Communication system, communication device, and communication method
EP2241950B1 (en) * 2005-06-09 2011-09-07 Omron Corporation Communication master station startup period control method
CN101212366A (en) * 2007-12-21 2008-07-02 杭州华三通信技术有限公司 Failure detection method, system, and main node in Ethernet loop network
CN101309306A (en) * 2008-07-16 2008-11-19 哈尔滨工业大学 Method for allocating addresses from node device in Modbus communication network
US9325567B2 (en) * 2010-12-20 2016-04-26 Schneider Electric Automation Gmbh Communication system, method for operating such a communication system, and communication module
CN102158364A (en) * 2011-05-05 2011-08-17 瑞斯康达科技发展股份有限公司 Time slice scheduling-based device polling method and device
CN102347855A (en) * 2011-07-21 2012-02-08 福建星网锐捷网络有限公司 Method, device and network equipment for realizing bidirectional forwarding detection

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114265808A (en) * 2021-12-22 2022-04-01 杭州和利时自动化有限公司 Communication method, device, Profibus DP master station and medium
CN114928557A (en) * 2022-04-07 2022-08-19 北京航空航天大学杭州创新研究院 Equipment off-line detection method for self-adaptive response interval time
CN114928557B (en) * 2022-04-07 2023-12-15 北京航空航天大学杭州创新研究院 Equipment offline detection method for self-adaptive response interval time

Also Published As

Publication number Publication date
CN106453012B (en) 2019-10-22

Similar Documents

Publication Publication Date Title
CN103399546B (en) Triple redundance control method and system
CN105159240B (en) The job scheduling system of automatic industrial equipment
US20080101251A1 (en) System, apparatus and method for mixed mode communication on a single network
CN106130786A (en) The detection method of a kind of network failure and device
CN105223949A (en) Electric equipment and communication failure diagnostic method thereof and device
CN106453012A (en) Serial bus communication method and apparatus
CN114024834A (en) Fault positioning method and device, electronic equipment and readable storage medium
CN205983124U (en) Comprehensive supervision system
CN109032899A (en) The method and apparatus of indicating equipment state
US20160048362A1 (en) Programmable display device
CN205507525U (en) A failure diagnosis device for field bus system
CN112134764B (en) Method and device for determining connectivity of test environment
CN109617227B (en) UPS monitoring data management system
CN106357481A (en) Power utilization security management method and system
US9229898B2 (en) Causation isolation using a configuration item metric identified based on event classification
JP2020061717A (en) Abnormal factor determination device, control system, and abnormal factor determination method
WO2020221656A1 (en) Method, apparatus and system for acquiring digitized data of factory
CN205635947U (en) Two -for -one twister intelligent monitoring system
CN113960987B (en) IO terminal module diagnosis information visualization system
CN116298703B (en) Intelligent distribution method and equipment for cable monitor
JP7398019B1 (en) Maintenance support device and maintenance support method
CN114675623A (en) Fault detection and elimination method, device, equipment and medium for intelligent vehicle control unit
CN107342924A (en) CAN nonpolarity communication means and device, electronic equipment
CN202563335U (en) Manipulator and pressing machine automatic control and management system
CN111277472A (en) CAN network fault detection method for wheel type multipurpose engineering vehicle

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230602

Address after: Room 301, Building 9, No. 38, Huashang Road, Airport Economic Development Zone, Jiangning District, Nanjing, Jiangsu Province, 210000

Patentee after: Jiangsu chuangrei Xinyuan Intelligent Technology Co.,Ltd.

Address before: Room 1602, No. 215, Jiangdong Middle Road, Jianye District, Nanjing, Jiangsu 210000

Patentee before: NANJING CREATESTAR ELECTRIC POWER TECHNOLOGY CO.,LTD.

TR01 Transfer of patent right