CN104283749B - Business disk upgrade method based on the half-duplex bus of RS 485 - Google Patents

Business disk upgrade method based on the half-duplex bus of RS 485 Download PDF

Info

Publication number
CN104283749B
CN104283749B CN201410500140.5A CN201410500140A CN104283749B CN 104283749 B CN104283749 B CN 104283749B CN 201410500140 A CN201410500140 A CN 201410500140A CN 104283749 B CN104283749 B CN 104283749B
Authority
CN
China
Prior art keywords
data
task module
current
business disk
send
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410500140.5A
Other languages
Chinese (zh)
Other versions
CN104283749A (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.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies 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 Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN201410500140.5A priority Critical patent/CN104283749B/en
Publication of CN104283749A publication Critical patent/CN104283749A/en
Application granted granted Critical
Publication of CN104283749B publication Critical patent/CN104283749B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of business disk upgrade method based on the half-duplex bus of RS 485, it is related to the serial communication fields of RS 485.This method comprises the following steps:Business disk upgrading software of user's selection based on the half-duplex bus of RS 485, user's selection in business disk upgrades software need the software document upgraded.Send task module and communication data packet corresponding with Current software file is obtained from transmission message queue module, and RS485 transmission message packets are constructed according to communication data packet and send RS485 transmission message packets to reception task module.After receiving the parameter that task module determines RS485 transmission message packets, RS485 transmission message packets are distributed to corresponding business disk.The software of business disk sends message packet according to the RS485 received and upgraded.Not only the scope of application than wide, can reduce the maintenance cost of communication equipment to the present invention;And batch upgrade can be carried out to the software of multiple business disks, operating efficiency is higher, is easy to people to use.

Description

Business disk upgrade method based on RS-485 half-duplex bus
Technical field
The present invention relates to RS-485 serial communications field, and in particular to a kind of business disk based on RS-485 half-duplex bus Upgrade method.
Background technology
RS-485 is one kind that EIA (Electronic Industries Association, Electronic Industries Association) is worked out Standard for serial communication, the half-duplex bus based on RS-485 are generally used for the data channel between communication equipment.Referring to Fig. 1 institutes Show, communication equipment includes control module (i.e. main control unit) and some business modules (i.e. business disk, business disk 1, business disk 2 and industry Business disk 3 etc.).Each business disk is communicated by RS-485 half-duplex bus with main control unit, and the software of business disk passes through RS- 485 half-duplex bus are upgraded.
But there is following defect when being communicated and upgraded by RS-485 half-duplex bus in business disk:
(1), it is necessary to which main control unit and business disk are docked at into machine frame outside communication equipment when the software of business disk is upgraded Communication interface on, if communication equipment does not have communication interface, the software of business disk can not upgrade.Therefore, existing business disk Software can only be upgraded under conditions of with communication interface, its scope of application is relatively simple.
(2), it is necessary to which main control unit and business disk manually are docked at into communication equipment machine when main control unit and business disk are communicated In the communication interface of frame, when business disk quantity is more, the operating process of the more business disk of grafting is more complicated and existing Main control unit the software of the business disk of grafting can only once be upgraded, if desired upgrade the soft of other business disks For part, it is necessary to change business disk, its operating efficiency is relatively low, and is not easy to people's use.
The content of the invention
For defect present in prior art, it is an object of the invention to provide one kind to be based on RS-485 half-duplex bus Business disk upgrade method, not only the scope of application can reduce the maintenance cost of communication equipment than wide;And can be to more The software of individual business disk carries out batch upgrade, and operating efficiency is higher, is easy to people to use.
To achieve the above objectives, the present invention provides a kind of business disk upgrade method based on RS-485 half-duplex bus, carries For a kind of communication system, the communication system includes sending message queue module, sends task module, receives task module and determine When device;
The transmission message queue module is used for:When main control unit needs to send communication data to business disk, according to default Main control unit application layer communication protocol, by the application layer communication information of main control unit and purpose business disk address be encapsulated as communicate number According to;
The transmission task module is used for:Communication data is obtained from sending in message queue module, checks current RS-485 The communications status of half-duplex bus:
If the communications status of current RS-485 half-duplex bus is the free time, by RS-485 half-duplex bus to the task of reception Module sends communication data, and it is busy to mark current RS-485 half-duplex bus communications status;Record the purpose of this transmission The sequence number of the data frame of business disk address and communication data, start timer;
If the communications status of current RS-485 half-duplex bus is busy, carried out etc. according to time delay set in advance Treat, after time delay, check again for the bus communication state of current RS-485 half-duplex bus;
The reception task module is used for:Receive and send the communication data that task module is sent, when receiving communication data After complete data frame, the frame head inspection result of data frame is determined:
If frame head inspection result is that frame head data is illegal, present communications data are abandoned:
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, data frame The address of sequence number and purpose business disk that current RS-485 half-duplex bus records, the sequence number of data frame are consistent, it is determined that current Communication data is expected reply data, and present communications data are sent to the processing of corresponding business disk;Control transmission task mould Block stops timer, sets RS-485 bus communications state as the free time;
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, data frame The address for the purpose business disk that sequence number records with current RS-485 half-duplex bus, the sequence number of data frame are inconsistent, it is determined that when Preceding communication data is not expected reply data, abandons present communications data;
The timer is used for:Set data to send time-out time, sent sending task module to task module is received Start after communication data;If task module is received in time-out time receives expected communication data, it is stopped;If super When time inscribed task module of receiving do not receive expected communication data, then control sends task module and marks current RS-485 half couple The communications status of work bus is the free time;
Included using the business disk communication means of the communication system:
A, when main control unit needs to send data to business disk, message queue module is sent according to default main control unit application Layer communication protocol, communication data is encapsulated as by the application layer communication information of main control unit and purpose business disk address;Go to step B;
B, the preset delay time in task module is sent, send task module and obtained from transmission message queue module Take communication data;Go to step C;
C, the communications status that task module checks current RS-485 half-duplex bus is sent:
If the communications status of current RS-485 half-duplex bus is the free time, by RS-485 half-duplex bus to the task of reception Module sends communication data, and it is busy to mark current RS-485 half-duplex bus communications status;Record the mesh of this transmission Business disk address and communication data data frame sequence number, start timer, in timer set data send it is overtime when Between, go to step D;
If the communications status of current RS-485 half-duplex bus is busy, waited according to time delay, time delay Later, step C is re-executed;
D, receive task module and judge the complete data frame of communication data whether is received in time-out time, if so, going to Step E, it is the free time otherwise to send task module and mark the communications status of current RS-485 half-duplex bus, is terminated;
E, the frame head inspection result that task module determines data frame is received:
If frame head inspection result is that frame head data is illegal, present communications data are abandoned, are terminated;
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, data frame The address of sequence number and purpose business disk that current RS-485 half-duplex bus records, the sequence number of data frame are consistent, it is determined that current Communication data is expected reply data, and present communications data are sent to the processing of corresponding business disk;Task module is sent to stop Only timer, terminate;
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, data frame The address for the purpose business disk that sequence number records with current RS-485 half-duplex bus, the sequence number of data frame are inconsistent, it is determined that when Preceding communication data is not expected reply data, abandons present communications data, is terminated;
Comprise the following steps using the business disk upgrade method of the business disk communication means:
S1:Business disk upgrading software of user's selection based on RS-485 half-duplex bus, user upgrade software in business disk Middle selection needs the software document upgraded;
S2:Send task module and obtain communication data corresponding with Current software file from transmission message queue module Bag, send task module and RS485 transmission message packets are constructed according to communication data packet and send RS485 transmission message packets To reception task module;
S3:After receiving the parameter that task module determines RS485 transmission message packets, RS485 is sent into message packet distribution To corresponding business disk;
S4:The software of business disk sends message packet according to the RS485 received and upgraded;
Step S2 specifically includes following steps:
S201:Send task module and obtain communication data packet from transmission message queue module, send task module and obtain Purpose business disk supports the maximum bag length of master slave communication protocol;
S202:Send task module and determine whether the length of present communications packet exceedes maximum bag and grow, if so, going to step Rapid S203, otherwise go to step S204;
S203:Send task module and subpackage and compression are carried out to present communications packet, go to step S204;
S204:Send task module and RS485 transmission message packets are constructed according to communication data packet, all RS485 are sent Message packet forms RS485 transmit queues, goes to step S205;
S205:Send the RS485 that task module determines to be currently needed for sending according to the order of RS485 transmit queues and send and disappear Message is ceased, goes to step S206;
S206:Send task module and lock and read RS485 sessions corresponding with current RS485 transmission message packets and remember Record, goes to step S207;
S207:Send task module and judge that current RS485 sends the attribute of the attribute and current sessions record of message packet It is whether identical, if so, going to step S208, otherwise go to step S210;
S208:The working condition that task module determines timer is sent, if timer starts, stops timer;If timing Device is not actuated, sends task module and sends current RS485 transmissions message packet by RS485 drivers;And start timer, If receiving the response for receiving task module in the time-out time that timer is set, current RS485 conversation recordings are unlocked, are gone to Step S209;If not receiving the response for receiving task module in time-out time, unlock and clear current RS485 sessions are remembered Record, goes to step S209;
S209:Judge that the RS485 in RS485 transmit queues sends whether message packet all sends, if so, step S2 is tied Beam, go to step S3;Otherwise step S205 is performed again;
S210:Current RS485 conversation recordings are unlocked, are waited according to the time delay pre-set, time delay mistake Afterwards, step S206 is re-executed.
On the basis of above-mentioned technical proposal, conversation recording described in step S206 includes slot number, message code and session Id information.
On the basis of above-mentioned technical proposal, step S3 specifically includes following steps:
S301:Receive task module and receive RS485 transmission message packets, obtain the maximum burst length of current business disk;
S302:Task module is received according to maximum burst length, judges that current RS485 sends whether message packet is burst Message, if so, going to step S303, otherwise go to step S304;
S303:Receive task module to recombinate current RS485 transmission message packets, go to step S304;
S304:The more current RS485 of task module is received to send in the corresponding RS485 transmission records of message packet Whether message attributes are identical, if so, going to step S305, otherwise go to step S306;
S305:Receive task module and remove RS485 transmissions record corresponding with current RS485 transmission message packets, go to Step S306;
S306:Receive task module and judge that current RS485 sends whether message packet is compressed packet, if so, going to step Rapid S307, otherwise go to step S308;
S307:Receive task module to decompress current RS485 transmission message packets, go to step S308;
S308:Receive task module and the RS485 transmission message packets after decompression are distributed to corresponding business disk, terminate.
On the basis of above-mentioned technical proposal, the software of business disk described in step S4 is sent according to the RS485 received to disappear It is further comprising the steps of after breath message is upgraded:After the software upgrade success of business disk, return and upgrade successfully to main control unit Information, after the software upgrading failure of business disk, upgrading failure information is returned to main control unit.
Compared with prior art, the advantage of the invention is that:
(1) main control unit of the invention can be multiplexed RS-485 half-duplex bus and directly send communication number to the port of business disk According to, compared with it can only carry out upgrading to the software of business disk by the communication interface outside communication equipment in the prior art, this hair It is bright the software of business disk to be upgraded in the case of the communication interface outside without using communication equipment, not only it is applicable model Enclose than wide, and the maintenance cost of communication equipment can be reduced.
(2) when the present invention upgrades to the software of business disk, main control unit can send to multiple business disks and communicate simultaneously Data, compared with it once can only carry out upgrading to the software of a business disk in the prior art, the present invention can be to multiple business The software of disk carries out batch upgrade, and its operating efficiency is higher, is easy to people to use.
Brief description of the drawings
Fig. 1 is the structured flowchart that communication equipment is communicated and upgraded by RS-485 half-duplex bus in background technology;
Fig. 2 is the flow chart of step S2 in the embodiment of the present invention;
Fig. 3 is the flow chart of step S3 in the embodiment of the present invention.
Embodiment
The present invention is described in further detail below in conjunction with drawings and Examples.
In RS-485 half-duplex bus systems, main control unit (i.e. " master " equipment of communication equipment) actively to business disk (i.e. " from " equipment of communication equipment) data are sent, business disk is the data recovery response of itself only to purpose, does not allow actively to send Data.
The communication system based on RS-485 half-duplex bus in the embodiment of the present invention, including transmission message queue module, Send task module, receive task module and timer.
Message queue module is sent to be used for:When main control unit needs to send communication data to business disk, according to default master Manipulate stock quotations application layer communication protocol, the application layer communication information of main control unit and purpose business disk address are encapsulated as communication data.
Task module is sent to be used for:Communication data is obtained from sending in message queue module, checks current RS-485 half couple The communications status of work bus:
If the communications status of current RS-485 half-duplex bus is the free time, by RS-485 half-duplex bus to the task of reception Module sends communication data, and it is busy to mark current RS-485 half-duplex bus communications status;Record the purpose of this transmission The sequence number of the data frame of business disk address and communication data, start timer.
If the communications status of current RS-485 half-duplex bus is busy, carried out etc. according to time delay set in advance Treat, after time delay, check again for the bus communication state of current RS-485 half-duplex bus.
Task module is received to be used for:Receive and send the communication data that task module is sent, when receiving the complete of communication data After data frame, the frame head inspection result of data frame is determined:
If frame head inspection result be frame head data it is illegal (such as frame length in frame head data, purpose business disk address or The parameters such as the sequence number mistake of data frame), then abandon present communications data.
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, data frame The address of sequence number and purpose business disk that current RS-485 half-duplex bus records, the sequence number of data frame are consistent, it is determined that current Communication data is expected reply data, and present communications data are sent to the processing of corresponding business disk;Control transmission task mould Block stops timer, sets RS-485 bus communications state as the free time.
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, data frame The address for the purpose business disk that sequence number records with current RS-485 half-duplex bus, the sequence number of data frame are inconsistent, it is determined that when Preceding communication data is not expected reply data, abandons present communications data.
Timer is used for:Set data to send time-out time, communication is sent to task module is received sending task module Start after data;If task module is received in time-out time receives expected communication data, it is stopped;If in time-out Interior reception task module does not receive expected communication data, then it is total to send the current RS-485 half-duplexs of task module mark for control The communications status of line is the free time.
Application layer communication protocol regulation communication data in the embodiment of the present invention includes frame head and the quiet lotus of data, frame head bag Include:
Length is the address (address) of 2 bytes, and address is used for the address of identification service disk, sends task module hair The address of business disk is extended this as when sending communication data, after receiving task module reception communication data, only when in the communication data When address is identical with the address of identification service disk, communication data is just handled, the ground of current business disk is filled in when handling communication data Location.
Length is the length (length) of 2 bytes, and length is used for the total length of mark data frame, and total length includes frame head Length and the quiet lotus of data length etc..Because the quiet lotus partial-length of data is variable, therefore length can be used in receiving terminal knowledge The end position of other complete data frame.
Length is the sequence (sequence number of data frame) of 2 bytes, and sequence is used to send in transmission task module and led to A new sequence number is generated during letter data and is filled in into the frame head of communication data, after receiving task module reception communication data, Only when the sequence number of the data frame in the communication data is identical with the sequence number in sequence, just it is defined as expected answer number According to.
Length is the fragment Num (burst number) of 2 bytes, and fragment Num are used to limit main control unit and business disk The communication resource, due to the limited length of maximum data frame transmitted in RS-485 half-duplex bus, therefore work as number to be sent According to length exceed maximum length when, it is necessary to be retransmited after burst.Total score after fragment Num record communication data bursts Piece number, fragment Num are the 0 non-burst of expression.
Length is the Fragment No (burst sequence number) of 2 bytes, and Fragment No start setting up from 1, and it is used to identify Sequence number of this current slice in all bursts.
Length is the type (data type) of 2 bytes, and type is used for the type for identifying the quiet lotus of follow-up data.
The quiet lotus of data of communication data is used for the details for carrying communication data, and the length of the quiet lotus of data is according to content Difference changes, and the quiet lotus of data is generally configuration or the control command that main control unit issues to business disk, or business disk is to master Manipulate stock quotations the status information of response.Payload in the present embodiment is carried as software version information and software version file.
The business disk communication means based on RS-485 half-duplex bus for said system in the embodiment of the present invention, bag Include following steps:
A, when main control unit needs to send data to business disk, message queue module is sent according to default main control unit application Layer communication protocol, is encapsulated as communication data by the application layer communication information of main control unit and purpose business disk address, goes to step B.
B, the preset delay time in task module is sent, send task module and obtained from transmission message queue module Communication data is taken, goes to step C.
C, the communications status that task module checks current RS-485 half-duplex bus is sent:
If the communications status of current RS-485 half-duplex bus is the free time, by RS-485 half-duplex bus to the task of reception Module sends communication data, and it is busy to mark current RS-485 half-duplex bus communications status;Record the mesh of this transmission Business disk address and communication data data frame sequence number, start timer, in timer set data send it is overtime when Between, go to step D.
If the communications status of current RS-485 half-duplex bus is busy, waited according to time delay, time delay Later, step C is re-executed.
D, receive task module and judge the complete data frame of communication data whether is received in time-out time, if so, going to Step E, it is the free time otherwise to send task module and mark the communications status of current RS-485 half-duplex bus, is terminated.
E, the frame head inspection result that task module determines data frame is received:
If frame head inspection result is that frame head data is illegal, present communications data are abandoned, are terminated.
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, data frame The address of sequence number and purpose business disk that current RS-485 half-duplex bus records, the sequence number of data frame are consistent, it is determined that current Communication data is expected reply data, and present communications data are sent to the processing of corresponding business disk;Task module is sent to stop Only timer, terminate.
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, data frame The address for the purpose business disk that sequence number records with current RS-485 half-duplex bus, the sequence number of data frame are inconsistent, it is determined that when Preceding communication data is not expected reply data, abandons present communications data, is terminated.
The business disk upgrade method using above-mentioned communication means in the embodiment of the present invention, comprises the following steps:
S1:Business disk upgrading software of user's selection based on RS-485 half-duplex bus, user upgrade software in business disk Middle selection needs the software document upgraded.
S2:Send task module and obtain communication data corresponding with Current software file from transmission message queue module Bag, send task module and RS485 transmission message packets are constructed according to communication data packet and send RS485 transmission message packets To reception task module.
S3:After receiving the parameter that task module determines RS485 transmission message packets, RS485 is sent into message packet distribution To corresponding business disk.
S4:The software of business disk sends message packet (upgrading software document bag) according to the RS485 received and upgraded, After the software upgrade success of business disk, returned to main control unit and upgrade successfully information, after the software upgrading failure of business disk, to master control Disk returns to upgrading failure information.
Participate in shown in Fig. 2, step S2 specifically includes following steps:
S201:Send task module and obtain communication data packet from transmission message queue module, send task module and obtain Purpose business disk supports the maximum bag length of master slave communication protocol.
S202:Send task module and determine whether the length of present communications packet exceedes maximum bag and grow, if so, going to step Rapid S203, otherwise go to step S204.
S203:Send task module and subpackage and compression are carried out to present communications packet, go to step S204.
S204:Send task module and RS485 transmission message packets are constructed according to communication data packet, all RS485 are sent Message packet forms RS485 transmit queues, goes to step S205.
S205:Send the RS485 that task module determines to be currently needed for sending according to the order of RS485 transmit queues and send and disappear Message is ceased, goes to step S206.
S206:Lock and read RS485 conversation recordings corresponding with current RS485 transmission message packets, conversation recording bag Slot number, message code and session id information etc. are included, goes to step S207.
S207:Send task module and judge that current RS485 sends the attribute of the attribute and current sessions record of message packet Whether (address of purpose business disk, the sequence number of data frame) be identical, if so, going to step S208, otherwise goes to step S210.
S208:The working condition that task module determines timer is sent, if timer starts, stops timer;If timing Device is not actuated, sends task module and sends current RS485 transmissions message packet by RS485 drivers.Start timer, if The response for receiving task module is received in the time-out time that timer is set, then unlocks current RS485 conversation recordings, goes to step Rapid S209;If not receiving the response for receiving task module in time-out time, unlock and understand current RS485 conversation recordings, Go to step S209.
S209:Judge that the RS485 in RS485 transmit queues sends whether message packet all sends, if so, step S2 is tied Beam, go to step S3;Otherwise step S205 is gone to.
S210:Current RS485 conversation recordings are unlocked, are waited according to the time delay pre-set, time delay mistake Afterwards, step S206 is re-executed.
Shown in Figure 3, step S3 specifically includes following steps:
S301:Receive task module and receive RS485 transmission message packets, obtain the maximum burst length of current business disk.
S302:Task module is received according to maximum burst length, judges that current RS485 sends whether message packet is burst Message, if so, going to step S303, otherwise go to step S304.
S303:Receive task module to recombinate current RS485 transmission message packets, go to step S304.
S304:The more current RS485 of task module is received to send in the corresponding RS485 transmission records of message packet Whether message attributes (address of purpose business disk, the sequence number of data frame) are identical, if so, going to step S305, otherwise go to step Rapid S306.
S305:Receive task module and remove RS485 transmissions record corresponding with current RS485 transmission message packets, go to Step S306.
S306:Receive task module and judge that current RS485 sends whether message packet is compressed packet, if so, going to step Rapid S307, otherwise go to step S308.
S307:Receive task module to decompress current RS485 transmission message packets, go to step S308.
S308:Receive task module and the RS485 transmission message packets after decompression are distributed to corresponding business disk, terminate.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from On the premise of the principle of the invention, some improvements and modifications can also be made, these improvements and modifications are also considered as the protection of the present invention Within the scope of.The content not being described in detail in this specification belongs to prior art known to professional and technical personnel in the field.

Claims (4)

1. a kind of business disk upgrade method based on RS-485 half-duplex bus, there is provided a kind of communication system, the communication system Including sending message queue module, sending task module, reception task module and timer;
The transmission message queue module is used for:When main control unit needs to send communication data to business disk, according to default master Manipulate stock quotations application layer communication protocol, the application layer communication information of main control unit and purpose business disk address are encapsulated as communication data;
The transmission task module is used for:Communication data is obtained from sending in message queue module, checks current RS-485 half couple The communications status of work bus:
If the communications status of current RS-485 half-duplex bus is the free time, by RS-485 half-duplex bus to receiving task module Communication data is sent, it is busy to mark current RS-485 half-duplex bus communications status;Record the purpose business of this transmission The sequence number of the data frame of disk address and communication data, start timer;
If the communications status of current RS-485 half-duplex bus is busy, is waited, prolonged according to time delay set in advance After the slow time, the bus communication state of current RS-485 half-duplex bus is checked again for;
The reception task module is used for:Receive and send the communication data that task module is sent, when receiving the complete of communication data After data frame, the frame head inspection result of data frame is determined:
If frame head inspection result is that frame head data is illegal, present communications data are abandoned:
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, the sequence number of data frame The sequence number of address, data frame with the purpose business disk of current RS-485 half-duplex bus record is consistent, it is determined that present communications Data are expected reply data, and present communications data are sent to the processing of corresponding business disk;Control sends task module and stopped Only timer, RS-485 bus communications state is set for the free time;
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, the sequence number of data frame The sequence number of address, data frame with the purpose business disk of current RS-485 half-duplex bus record is inconsistent, it is determined that current logical Letter data is not expected reply data, abandons present communications data;
The timer is used for:Set data to send time-out time, communication is sent to task module is received sending task module Start after data;If task module is received in time-out time receives expected communication data, it is stopped;If in time-out Interior reception task module does not receive expected communication data, then it is total to send the current RS-485 half-duplexs of task module mark for control The communications status of line is the free time;
Included using the business disk communication means of the communication system:
A, when main control unit needs to send data to business disk, send message queue module and led to according to default main control unit application layer Believe agreement, the application layer communication information of main control unit and purpose business disk address are encapsulated as communication data;Go to step B;
B, the preset delay time in task module is sent, it is logical from acquisition in message queue module is sent to send task module Letter data;Go to step C;
C, the communications status that task module checks current RS-485 half-duplex bus is sent:
If the communications status of current RS-485 half-duplex bus is the free time, by RS-485 half-duplex bus to receiving task module Communication data is sent, and it is busy to mark current RS-485 half-duplex bus communications status;Record the purpose industry of this transmission The sequence number of the data frame of business disk address and communication data, starts timer, sets data to send time-out time in timer, turns To step D;
If the communications status of current RS-485 half-duplex bus is busy, waited according to time delay, after time delay, Re-execute step C;
D, receive task module and judge the complete data frame of communication data whether is received in time-out time, if so, going to step E, it is the free time otherwise to send task module and mark the communications status of current RS-485 half-duplex bus, is terminated;
E, the frame head inspection result that task module determines data frame is received:
If frame head inspection result is that frame head data is illegal, present communications data are abandoned, are terminated;
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, the sequence number of data frame The sequence number of address, data frame with the purpose business disk of current RS-485 half-duplex bus record is consistent, it is determined that present communications Data are expected reply data, and present communications data are sent to the processing of corresponding business disk;Task module is sent to stop determining When device, terminate;
If frame head inspection result is that frame head data is legal, and the address of the purpose business disk in frame head data, the sequence number of data frame The sequence number of address, data frame with the purpose business disk of current RS-485 half-duplex bus record is inconsistent, it is determined that current logical Letter data is not expected reply data, abandons present communications data, is terminated;
It is characterized in that:Comprise the following steps using the business disk upgrade method of the business disk communication means:
S1:Business disk upgrading software of user's selection based on RS-485 half-duplex bus, user select in business disk upgrades software Select the software document for needing to upgrade;
S2:Task module is sent from acquisition communication data packet corresponding with Current software file in message queue module is sent, is sent out Send task module to construct RS485 transmission message packets according to communication data packet and send RS485 transmission message packets to reception Task module;
S3:Receive after task module determines the parameter that RS485 sends message packet, RS485 transmission message packets are distributed to pair The business disk answered;
S4:The software of business disk sends message packet according to the RS485 received and upgraded;
Step S2 specifically includes following steps:
S201:Send task module and obtain communication data packet from transmission message queue module, send task module and obtain purpose Business disk supports the maximum bag length of master slave communication protocol;
S202:Send task module and determine whether the length of present communications packet exceedes maximum bag and grow, if so, going to step S203, otherwise go to step S204;
S203:Send task module and subpackage and compression are carried out to present communications packet, go to step S204;
S204:Send task module and RS485 transmission message packets are constructed according to communication data packet, all RS485 are sent into message Message forms RS485 transmit queues, goes to step S205;
S205:Send task module and determine that the RS485 for being currently needed for sending sends Izvestia according to the order of RS485 transmit queues Text, go to step S206;
S206:Send task module to lock and read RS485 conversation recordings corresponding with current RS485 transmission message packets, turn To step S207;
S207:Send task module and judge whether current RS485 sends attribute that the attribute of message packet records with current sessions It is identical, if so, going to step S208, otherwise go to step S210;
S208:The working condition that task module determines timer is sent, if timer starts, stops timer;If timer is not Start, send task module and current RS485 transmissions message packet is sent by RS485 drivers;And start timer, if The response for receiving task module is received in the time-out time that timer is set, then unlocks current RS485 conversation recordings, goes to step S209;If not receiving the response for receiving task module in time-out time, unlock and understand current RS485 conversation recordings, turn To step S209;
S209:Judge that the RS485 in RS485 transmit queues sends whether message packet all sends, if so, step S2 terminates, Go to step S3;Otherwise step S205 is performed again;
S210:Current RS485 conversation recordings are unlocked, are waited according to the time delay pre-set, after time delay, weight It is new to perform step S206.
2. business disk upgrade method as claimed in claim 1, it is characterised in that:Conversation recording described in step S206 includes groove Position number, message code and session id information.
3. business disk upgrade method as claimed in claim 1, it is characterised in that step S3 specifically includes following steps:
S301:Receive task module and receive RS485 transmission message packets, obtain the maximum burst length of current business disk;
S302:Task module is received according to maximum burst length, judges that current RS485 sends whether message packet is burst report Text, if so, going to step S303, otherwise go to step S304;
S303:Receive task module to recombinate current RS485 transmission message packets, go to step S304;
S304:Receive the message in the corresponding RS485 transmission records of the more current RS485 transmissions message packet of task module Whether attribute is identical, if so, going to step S305, otherwise goes to step S306;
S305:Receive task module and remove RS485 transmissions record corresponding with current RS485 transmission message packets, go to step S306;
S306:Receive task module and judge that current RS485 sends whether message packet is compressed packet, if so, going to step S307, otherwise go to step S308;
S307:Receive task module to decompress current RS485 transmission message packets, go to step S308;
S308:Receive task module and the RS485 transmission message packets after decompression are distributed to corresponding business disk, terminate.
4. the business disk upgrade method as described in any one of claims 1 to 3, it is characterised in that business disk described in step S4 Software sent according to the RS485 that receives after message packet upgraded, it is further comprising the steps of:The software upgrading of business disk After success, returned to main control unit and upgrade successfully information, after the software upgrading failure of business disk, returned to upgrading to main control unit and unsuccessfully believe Breath.
CN201410500140.5A 2014-09-25 2014-09-25 Business disk upgrade method based on the half-duplex bus of RS 485 Active CN104283749B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410500140.5A CN104283749B (en) 2014-09-25 2014-09-25 Business disk upgrade method based on the half-duplex bus of RS 485

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410500140.5A CN104283749B (en) 2014-09-25 2014-09-25 Business disk upgrade method based on the half-duplex bus of RS 485

Publications (2)

Publication Number Publication Date
CN104283749A CN104283749A (en) 2015-01-14
CN104283749B true CN104283749B (en) 2017-12-01

Family

ID=52258252

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410500140.5A Active CN104283749B (en) 2014-09-25 2014-09-25 Business disk upgrade method based on the half-duplex bus of RS 485

Country Status (1)

Country Link
CN (1) CN104283749B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106095713B (en) * 2016-06-06 2019-05-03 深圳市硅格半导体股份有限公司 Message communication method and device
CN106953809B (en) * 2017-02-24 2020-04-14 烽火通信科技股份有限公司 485 time-sharing communication-based equipment resource acquisition method
CN109245985B (en) * 2018-08-24 2020-12-29 烽火通信科技股份有限公司 Communication method and system between single disks in equipment
CN111628919B (en) * 2020-05-12 2022-02-11 中电科航空电子有限公司 Method for realizing Arinc485 protocol state machine
CN111600696B (en) * 2020-05-29 2023-04-07 深圳市优必选科技股份有限公司 Design circuit and method based on half-duplex communication bus and robot
CN113970666A (en) * 2021-10-22 2022-01-25 深圳市新威尔电子有限公司 RS485 communication signal-based program design method
CN114500159B (en) * 2022-02-17 2023-12-15 杭州老板电器股份有限公司 Wired communication method and device of central range hood system and electronic equipment
CN115314384A (en) * 2022-06-13 2022-11-08 珠海派诺科技股份有限公司 Device upgrading method and device upgrading system under RS485 bus and collector

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1671141A (en) * 2005-02-28 2005-09-21 邹润民 Multi-host communication system
CN101089763A (en) * 2006-06-15 2007-12-19 上海广茂达伙伴机器人有限公司 Miniature servo control system based on field base and method
CN101262398A (en) * 2007-12-14 2008-09-10 华南理工大学 Monitoring sub-station communication network for pollution source monitoring system
US8086670B1 (en) * 2002-03-06 2011-12-27 Rockwell Software Inc. System and methodology providing optimized data exchange with industrial controller

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8086670B1 (en) * 2002-03-06 2011-12-27 Rockwell Software Inc. System and methodology providing optimized data exchange with industrial controller
CN1671141A (en) * 2005-02-28 2005-09-21 邹润民 Multi-host communication system
CN101089763A (en) * 2006-06-15 2007-12-19 上海广茂达伙伴机器人有限公司 Miniature servo control system based on field base and method
CN101262398A (en) * 2007-12-14 2008-09-10 华南理工大学 Monitoring sub-station communication network for pollution source monitoring system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"基于RS-485网络的单片机远程系统升级功能设计";朱伟;《电子世界》;20120930;第26-27页 *

Also Published As

Publication number Publication date
CN104283749A (en) 2015-01-14

Similar Documents

Publication Publication Date Title
CN104283749B (en) Business disk upgrade method based on the half-duplex bus of RS 485
CN101542980B (en) Method for the operation of an ethernet-compatible field bus device
CN105490791B (en) SRS signal sending and triggering method, device, user equipment and base station
CN105978860B (en) A kind of implementation method of electric system software interface adapter
CN106686691A (en) Random access response RAR transmission method and related device
TWI255974B (en) A device and method for communicating data in a process control system
CN114138700B (en) Flow control method, device, equipment and storage medium for serial port data transmission
CN104410581A (en) Configuration information design and information extraction of AFDX (Avionics Full Duplex Switched Ethernet) network
CN109495494A (en) A kind of frame structure configuration method, transmitting device and the system of the transmission of VDES data
WO2003007629A3 (en) Method and apparatus for exchanging software information in a packet data communication system
CN103731809A (en) Data transmitting method, data receiving method and equipment
CN102413054B (en) Method, device and system for controlling data traffic as well as gateway equipment and switchboard equipment
CN111064788A (en) Signal transmission method, robot, and computer-readable storage medium
CN107786464A (en) A kind of method and device for realizing inter-node communication
CN104601206A (en) method and an apparatus for controlling messages between host and controller
CN105471654B (en) A kind of configuration data automatic loading method based on FC network
CN108260164B (en) Manage the method, apparatus and computer readable storage medium of Internet of Things base station
CN110458250A (en) A kind of instant fabrication method of social security card
CN107371269A (en) Method, user equipment and the base station of transmitting and scheduling
CN109361746A (en) A kind of document transmission method of Internet of Things, work board and readable storage medium storing program for executing
EP1624642A3 (en) Apparatus, method and system for providing information in accordance with one of a plurality of protocols
CN108055172A (en) A kind of bidirectional forwarding detection (BFD) method and device
CN104348711B (en) Message receiving apparatus and method
CN104902476A (en) Control method for Bluetooth security management
CN107547315B (en) Method and device for optimizing data communication

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