CN102904766B - Baud rate identification method and device for serial communication and monitoring equipment - Google Patents

Baud rate identification method and device for serial communication and monitoring equipment Download PDF

Info

Publication number
CN102904766B
CN102904766B CN201110211789.1A CN201110211789A CN102904766B CN 102904766 B CN102904766 B CN 102904766B CN 201110211789 A CN201110211789 A CN 201110211789A CN 102904766 B CN102904766 B CN 102904766B
Authority
CN
China
Prior art keywords
baud rate
common divisor
greatest common
data
default
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.)
Expired - Fee Related
Application number
CN201110211789.1A
Other languages
Chinese (zh)
Other versions
CN102904766A (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.)
Shenzhen Infinova Ltd
Original Assignee
Shenzhen Infinova 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 Shenzhen Infinova Ltd filed Critical Shenzhen Infinova Ltd
Priority to CN201110211789.1A priority Critical patent/CN102904766B/en
Publication of CN102904766A publication Critical patent/CN102904766A/en
Application granted granted Critical
Publication of CN102904766B publication Critical patent/CN102904766B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention is applicable to the technical field of communication and provides a Baud rate identification method and device for serial communication and monitoring equipment. The method comprises the following steps: (1) carrying out width acquisition of preset times on received high-low level pulse signals respectively; (2) carrying out minimization on the acquired data, and obtaining the greatest common divisor of the minimized data; (3) obtaining a first Baud rate corresponding to the greatest common divisor according to the corresponding relationship between a preset greatest common divisor and a preset Baud rate; (4) re-executing the previous two steps, and obtaining a second Baud rate according to the corresponding relationship between the preset greatest common divisor and the preset Baud rate; and (5) when the first Baud rate is different from the second Baud rate and the number of acquisition times of the second Baud rate is less than that of the preset Baud rate, updating the first Baud rate to the second Baud rate, and returning to execute the step (4) until the first Baud rate and the obtained second Baud rate are the same. Thus, the flexibility and universality of the Baud rate identification method are improved.

Description

Serial communication baud rate recognition methodss, device and monitoring device
Technical field
The invention belongs to communication technical field, more particularly to a kind of serial communication baud rate recognition methodss, device and monitoring Equipment.
Background technology
In protection and monitor field, what the control to monitoring device was mainly realized by serial RS485 or RS422, this The offering question of baud rate is related to.Because the data of serial communication are step-by-step sequential deliveries, therefore each data bit Between need strict timing, just can guarantee that correct communication, only when communicating pair baud rate is identical, data could be realized Correct transmission with receive.For example, at front end surveillance device (slave), such as there is special for arranging inside quick, head The hardware dial-up of the baud rate of front end surveillance device, different baud rates is selected by toggle switch, such as in quick, head The Configuration of baud rate in portion is 2400, and it is 2400 could to realize the control to headend equipment that main frame will also arrange baud rate.However, The change problem of baud rate is also following, headend equipment, namely slave is arranged in various varying environments, changes baud rate phase Work as trouble, especially installed in very high and extremely difficult dismounting position such as stadiums roof, under such environment Changing baud rate means that user will pay great manpower and materials cost, in order to solve this problem, generates baud rate certainly Adaptive technique, and the premise of baud rate self-adapting technology is to require to recognize the baud that the data that main frame sends are adopted from function Rate, and by the baud rate that the Configuration of baud rate of its own is main frame, so as to realize monitoring of the main frame to slave.
The method of the baud rate that the data that traditional slave identification main frame sends are adopted mainly has following two:
1st, symbol width real-time detection method.The method requires that main frame sends a certain data according to agreement, and slave is by MCU's The symbol width of input data, then calculates the baud rate of examining system communication on intervalometer measurement RXD pins.The method mesh Front application applies unrealistic in monitoring field than wide, because one is all sent out before user can not possibly be required per secondary control Fixed data.
2nd, the standard baud rate method of exhaustion.The standard baud rate method of exhaustion is applied to the baud rate of host computer side must be a limited number of Change between individual fixed numbers, such as the standard value between 2400~19200, after signal procedure starts, MCU is attempted one by one with difference The specific character that sends of baud rate Receiving Host, till it can be properly received, therefore, the method with there is certain office It is sex-limited.
Therefore, because existing baud rate recognition methodss are higher to data demand that serial communication device sends, cause baud The relatively low problem of the motility of rate identification and versatility.
The content of the invention
The purpose of the embodiment of the present invention is to provide a kind of serial communication baud rate recognition methodss, device and monitoring device, Aim to solve the problem that because existing baud rate recognition methodss are higher to the data demand that serial communication device sends, cause baud rate to recognize Motility and the relatively low problem of versatility.
The embodiment of the present invention is achieved in that a kind of serial communication baud rate recognition methodss, and methods described includes following Step:
Step 1:Low and high level pulse signal width to receiving respectively carries out the collection of preset times, after obtaining collection Data;
Step 2:The data are carried out with minimum process, the greatest common divisor of the data after minimum is processed is obtained;
Step 3:According to the corresponding relation between default greatest common divisor and baud rate, obtain and the greatest common divisor Corresponding first baud rate;
Step 4:Step 1, step 2 are re-executed, and according to the corresponding pass between default greatest common divisor and baud rate System, obtains the second baud rate corresponding with the greatest common divisor;
Step 5:Judge that whether first baud rate is identical with second baud rate, is, then second baud rate For effective baud rate, otherwise, when the number of times for judging that second baud rate is obtained obtains number of times less than default baud rate, will First baud rate is updated to second baud rate, and goes to execution step 4.
The another object of the embodiment of the present invention is to provide a kind of serial communication baud rate identifying device, and described device includes Collecting unit, data processing unit, the first baud rate acquiring unit, the second baud rate acquiring unit, identification decision unit and Baud rate updating block, wherein:
Collecting unit, for respectively carrying out the collection of preset times to the low and high level pulse signal width for receiving, obtains Data after collection;
Data processing unit, the data for exporting to collecting unit carry out minimum process, after obtaining minimum process Data greatest common divisor;
First baud rate acquiring unit, for according to the corresponding relation between default greatest common divisor and baud rate, obtaining Take the first baud rate corresponding with the greatest common divisor of data processing unit output;
Second baud rate acquiring unit, for triggering the collecting unit and the data processing unit, according to default Greatest common divisor and baud rate between corresponding relation, obtain corresponding with the greatest common divisor that data processing unit is exported the Two baud rates;
Identification decision unit, for when first baud rate and second ripple of the first baud rate acquiring unit output When second baud rate of special rate acquiring unit output is identical, judge second baud rate as effective baud rate;And
Baud rate updating block, for when first baud rate and described second of the first baud rate acquiring unit output When second baud rate of baud rate acquiring unit output is differed, and judge the number of times of the second baud rate acquisition less than default Baud rate when obtaining number of times, first baud rate is updated to into second baud rate, trigger second baud rate and obtain Take unit.
The another object of the embodiment of the present invention is to provide a kind of prison including above-mentioned serial communication baud rate identifying device Control equipment.
The step of embodiment of the present invention passes through the serial communication baud rate recognition methodss 1:To the low and high level arteries and veins for receiving Rushing signal width respectively carries out the collection of preset times, obtains the data after collection;Step 2:Minimum process is carried out to the data Afterwards, the greatest common divisor of the data after minimum is processed is obtained;Step 3:According between default greatest common divisor and baud rate Corresponding relation, obtain corresponding with the greatest common divisor the first baud rate;Step 4:Re-execute step 1, step 2, and root According to the corresponding relation between default greatest common divisor and baud rate, the second baud corresponding with the greatest common divisor is obtained Rate;Step 5:Judge that whether first baud rate is identical with second baud rate, is, then second baud rate is effective baud Rate, otherwise, when the number of times for judging that second baud rate is obtained obtains number of times less than default baud rate, by first baud rate The second baud rate is updated to, execution step 4 is gone to, is solved because existing baud rate recognition methodss send to serial communication device Data demand it is higher, cause motility and the relatively low problem of versatility that baud rate recognizes, so as to break away to sending number According to restriction, improve motility and the versatility of baud rate recognition methodss.
Description of the drawings
Fig. 1 is the flowchart of the serial communication baud rate recognition methodss that first embodiment of the invention is provided;
Fig. 2 is the structure chart of the serial communication baud rate identifying device that second embodiment of the invention is provided;
Fig. 3 is the concrete of data processing unit in the serial communication baud rate identifying device that second embodiment of the invention is provided Structure chart.
Specific embodiment
In order that the objects, technical solutions and advantages of the present invention become more apparent, it is right below in conjunction with drawings and Examples The present invention is further elaborated.It should be appreciated that specific embodiment described herein is only to explain the present invention, and It is not used in the restriction present invention.
The embodiment of the present invention respectively carries out the collection of preset times by the low and high level pulse signal width to receiving, right Data after the collection of acquisition carry out minimum process, the greatest common divisor of the data after the minimum is processed are obtained, according to pre- If greatest common divisor and baud rate between corresponding relation, corresponding with the greatest common divisor the first baud rate is obtained, at this After first baud rate is obtained, repeating signal collection and greatest common divisor are obtained and the greatest common divisor pair the step of obtain The second baud rate answered, judges that whether first baud rate is identical with second baud rate, is, then second baud rate is effective Baud rate, otherwise, when the number of times for judging that second baud rate is obtained obtains number of times less than default baud rate, by this first Baud rate is updated to second baud rate, returns and performs the step of obtaining the second baud rate, until first baud rate with this Two baud rates are identical so that the motility of baud rate recognition methodss obtains larger raising with versatility.
A kind of serial communication baud rate recognition methodss are embodiments provided, methods described comprises the steps:
Step 1:Low and high level pulse signal width to receiving respectively carries out the collection of preset times, after obtaining collection Data;
Step 2:The data are carried out with minimum process, the greatest common divisor of the data after minimum is processed is obtained;
Step 3:According to the corresponding relation between default greatest common divisor and baud rate, obtain and the greatest common divisor Corresponding first baud rate;
Step 4:Step 1, step 2 are re-executed, and according to the corresponding pass between default greatest common divisor and baud rate System, obtains the second baud rate corresponding with the greatest common divisor;
Step 5:Judge that whether first baud rate is identical with second baud rate, is, then second baud rate For effective baud rate, otherwise, when the number of times for judging that second baud rate is obtained obtains number of times less than default baud rate, will First baud rate is updated to second baud rate, and goes to execution step 4.
The embodiment of the present invention additionally provides a kind of serial communication baud rate identifying device, described device include collecting unit, Data processing unit, the first baud rate acquiring unit, the second baud rate acquiring unit, identification decision unit and baud rate update Unit, wherein:
Collecting unit, for respectively carrying out the collection of preset times to the low and high level pulse signal width for receiving, obtains Data after collection;
Data processing unit, the data for exporting to collecting unit carry out minimum process, after obtaining minimum process Data greatest common divisor;
First baud rate acquiring unit, for according to the corresponding relation between default greatest common divisor and baud rate, obtaining Take the first baud rate corresponding with the greatest common divisor of data processing unit output;
Second baud rate acquiring unit, for triggering the collecting unit and the data processing unit, according to default Greatest common divisor and baud rate between corresponding relation, obtain corresponding with the greatest common divisor that data processing unit is exported the Two baud rates;
Identification decision unit, for when first baud rate and second ripple of the first baud rate acquiring unit output When second baud rate of special rate acquiring unit output is identical, judge second baud rate as effective baud rate;And
Baud rate updating block, for when first baud rate and described second of the first baud rate acquiring unit output Second baud rate of baud rate acquiring unit output is differed, and judges the number of times of the second baud rate acquisition less than default When baud rate obtains number of times, first baud rate is updated to into second baud rate, triggers second baud rate and obtain Unit.
The embodiment of the present invention additionally provides a kind of monitoring device including above-mentioned serial communication baud rate identifying device.
The embodiment of the present invention passes through step 1:Low and high level pulse signal width to receiving respectively carries out preset times Collection, obtains the data after collection;Step 2:The data are carried out after minimum process, obtain the data after minimum is processed Greatest common divisor;Step 3:According to the corresponding relation between default greatest common divisor and baud rate, obtain and the highest common divisor Corresponding first baud rate of number;Step 4:Re-execute step 1, step 2, and according to default greatest common divisor and baud rate it Between corresponding relation, obtain corresponding with the greatest common divisor the second baud rate;Step 5:Judge first baud rate and be somebody's turn to do Whether the second baud rate is identical, is, then second baud rate is effective baud rate, otherwise, when judgement second baud rate is obtained When the number of times for taking obtains number of times less than default baud rate, first baud rate is updated to into the second baud rate, and goes to execution Step 4, so as to the motility and versatility that solve the problems, such as baud rate identification are relatively low, improves baud rate recognition methodss Motility and versatility.
Implementing for the present invention is described in detail below in conjunction with specific embodiment:
Embodiment one:
In serial communication technology field, serial communication data form is as follows:1 start bit, 8 data bit, 1 stopping Position, no parity position.Wherein start bit is always 0, and stop position is always the level height of 1,8 data bit by the number for transmitting According to decision.The baud rate of data measured is wanted, as long as obtaining the transmission time of bits per inch evidence, i.e., per the bit wide of bit data.Example Such as, pulse width by FPGA count realize, when using crystal oscillator be 48M HZ, data baud rate be 2400,4800,9600, 19200th, during 38400Baud, correspondence is about 26us~417us per bit transmission times, correspondence is counted as 20000 per bit width, 10000th, 5000,2500,1250 etc..In theory no matter baud rate be how many, collected pulse widths be all 1250 integer Times.
Fig. 1 shows the flow process of realizing of the serial communication baud rate recognition methodss that first embodiment of the invention is provided, detailed description It is as follows:
In step S101, the low and high level pulse signal width to receiving respectively carries out the collection of preset times, obtains Data after collection.
Wherein, the low and high level pulse signal can be to come from the pulse signal that 485 chips send, pulse signal width Counted by FPGA, single-chip microcomputer positioned at slave etc. and realized, high level pulse or low level pulse signal width are being carried out During collection, it is assumed that the bit wide of 1bit is the pulse duration of t, the then pulse width for collecting namely collection, is m × t, Wherein 1≤m≤9, because 9 bit wides of the digit of high impulse from 1 bit wide for only there was only stop position to all data bit all for 1 Degree, limiting case is that the m of all 1 high impulses of data bit is up to 9 kinds of situations, and it is also 9 that the m of low pulse in the same manner is maximum, so as to Determine that m is 9 to the maximum.Because start bit is always 0 in 485 communication protocols, stop position is always 1, namely the data bit of the signal Number is always 9 low levels or high level, when being acquired to high level or low level pulse signal, at least gathers 9 It is secondary, namely the preset times are that, no less than 9 times, but in view of number of times during situation more than 9, the pulse data of collection occurs weight Recurrent images, therefore general times of collection takes 9.
In embodiments of the present invention, before step S101, the recognition methodss of the serial communication baud rate also include:
The solicited message from MCU is received, judges whether the solicited message is that baud rate identification obtains request, when the request When information is that baud rate identification obtains request, execution step S101 is not otherwise performed.
Specifically, after the completion of self-inspection, for example, spherical camera self-inspection, the MCU in slave can be issued slave by serial ports FPGA solicited messages in slave, the solicited message can expand for baud rate identification acquisition or rotation speed of the fan, warning message etc. Exhibition function information obtains request, and FPGA judges whether the solicited message is that baud rate identification obtains request, is, then FPGA pair The baud rate that the control signal that RS485 sends is adopted is identified obtaining, and otherwise, does not carry out baud rate identification and obtains.
In step s 102, the data are carried out after minimum process, obtains the most grand duke of the data after minimum is processed Approximate number.
Step S102 is specially:
By the data divided by default divisor, corresponding business and remainder are obtained;
When the remainder is in default scope, the corresponding business of the remainder is added 1, otherwise business is constant, after acquisition is processed The greatest common divisor of business.
In specific implementation process, because the value that pulsewidth is counted is all than larger, namely the data for obtaining compare than larger FPGA resource is expended, so need to carry out the data minimum process, the convenient follow-up calculating for obtaining greatest common divisor, and by Counted by FPGA, single-chip microcomputer etc. in pulse width and realized, when the use of crystal oscillator being 48M HZ, correspondence is counted as per bit width 20000th, 10000,5000,2500,1250 etc., then the integral multiple that default divisor is 1250 is selected, for example unify divided by 1250, When maximum pulse width is 180000, the maximum of the business for obtaining is 144, so as to carry out minimum process to the data for obtaining. Further, with reference to practical situation, most wide pulse width theoretical value 180000, i.e., in the case of baud rate 2400, data are 00, Start bit is 0, low pulse totally 9, is counted as in the case of 20000 per bit width, and pulsewidth is fixed on 180000;Or data are FF, stop position is 1, high impulse totally 9, adds the time interval between byte and byte, so when count value is more than 180000 When, error is such as considered, when count value is more than 180050, you can force the data obtained to be changed to 180000, it is to avoid more big data Calculating.
Further, since being up to 48MHz using the count frequency of FPGA, counting is point-device, and most data are all It is not 1250 integral multiple, so data are asked with business, this step is remmed also it is critical that a step, can not omit, For example after by the data divided by 1250, the corresponding business of each data and remainder are obtained, when the remainder is in default scope When interior, for example, be the optimum default scope of the embodiment of the present invention [625 1250) when, the corresponding business of the remainder is added 1, it is no Then, business is constant, the greatest common divisor of the business after acquisition process.
During greatest common divisor is specifically sought, greatest common divisor can be directly sought to all business for obtaining, it is also possible to Business after this is processed carries out size sequence, and identical numerical value only retains one, constitutes an array, due to only to high level with And low level pulse signal width is acquired, and the data for gathering have repetition, then the length of the array is up to 9, to this Data inside array seek greatest common divisor, are set to g, then as the gathered high level in g × 1250 and low level continue Time or for pulse width in most narrow spaces, the pulsewidth for 1bit pulsewidths integral multiple.
In step s 103, according to the corresponding relation between default greatest common divisor and baud rate, obtain and the minimum Corresponding first baud rate of greatest common divisor of the data after change process.
Wherein, the corresponding relation between the default greatest common divisor and baud rate, such as following table once being not limited to the institute of table one Show relation, the table one is the situation that default divisor is 1250,1bit bit wides:
Greatest common divisor Baud rate (Baud) Pulse width (bit)
1 38400 1250
2 19200 2500
4 9600 5000
8 4800 10000
16 2400 20000
Table one
In step S104, the low and high level pulse signal width to receiving respectively carries out the collection of preset times, obtains Data after collection.
In step S105, the data are carried out with minimum process, obtain the highest common divisor of the data after minimum is processed Number.
In step s 106, and according to the corresponding relation between default greatest common divisor and baud rate, obtain with this most Corresponding second baud rate of big common divisor.
In step s 107, judge that whether first baud rate is identical with second baud rate, is, then execution step S108, second baud rate is effective baud rate;It is no, then execution step S109.
When first baud rate is identical with second baud rate, then it is assumed that second baud rate is effective baud rate, and The baud rate is exported to MCU, now, itself Configuration of baud rate is the effective baud rate for obtaining by MCU, namely the ripple of host computer side Special rate, and stop sending baud rate identification acquisition request, request, acquisition are obtained according to the identification of the baud rate of MCU so as to complete The baud rate of host computer side, and then realize the purpose of main frame and the serial communication of slave.
In step S109, judge whether the number of times that second baud rate is obtained obtains number of times more than default baud rate, No, then execution step S110, exits the baud rate identification step, is, then execution step S111.
In step S111, first baud rate is updated to into second baud rate, and goes to execution step S104.
Wherein, the default baud rate obtains number of times to prevent endless loop, is set according to user, and actual baud rate is obtained Typically be not in such case during taking, in addition, work as being more than default ripple in the number of times for judging second baud rate acquisition When special rate obtains number of times, the baud rate identification step is exited, information can be exported to host computer side, for example " baud rate cannot Identification!" etc. information, to remind user.
In embodiments of the present invention, the serial communication baud rate recognition methodss solve existing slave and send in identification main frame Data adopted baud rate when, to serial communication device send data demand it is higher, cause baud rate recognize it is flexible Property and the relatively low problem of versatility, so as to the high low pulse signal of Real-time Collection, and during identification baud rate, using more For practicality, also more flexible greatest common divisor method, existing baud rate recognition methodss have been broken away to sending the restriction of data, realized The raising of motility and versatility to baud rate identification, with stronger adaptivity, and ensure that identification is obtained Baud rate effectiveness.
One of ordinary skill in the art will appreciate that realizing that all or part of step in above-described embodiment method can be Related hardware is instructed to complete by program, described program can be stored in a computer read/write memory medium, Described storage medium, such as ROM/RAM, disk, CD.
Embodiment two:
Fig. 2 shows the structure of the serial communication baud rate identifying device that second embodiment of the invention is provided, for the ease of Illustrate, illustrate only the part related to the embodiment of the present invention.
The serial communication baud rate identifying device can be used for monitoring device, or other with baud rate identification function In safety monitoring equipment, such as high-speed dome camera etc., the software unit that can be operate in these monitoring devices also may be used To be integrated in these monitoring devices as independent suspension member or run in the application system of these monitoring devices, the serial Communication baud rate identifying device includes collecting unit 21, data processing unit 22, the first baud rate acquiring unit 23, the second baud Rate acquiring unit 24, identification decision unit 25 and baud rate updating block 26, wherein:
Collecting unit 21, for respectively carrying out the collection of preset times to the low and high level pulse signal width for receiving, obtains Take the data after collection.
Wherein, the low and high level pulse signal can be to come from the pulse signal that 485 chips send, pulse signal width Counted by FPGA, single-chip microcomputer etc. and realized, the preset times are no less than 9 times.
Data processing unit 22, for carrying out after minimum process to the data that collecting unit 21 is exported, obtains and minimizes The greatest common divisor of the data after process.
The concrete structure of data processing unit 22 includes minimizing processing unit 221 and greatest common divisor acquiring unit 222, as shown in figure 3, wherein:
Processing unit 221 is minimized, divided by default divisor, corresponding business and remainder are obtained for by the data;And
Greatest common divisor acquiring unit 222, for when the remainder is in default scope, the corresponding business of the remainder being added 1, otherwise business is constant, the greatest common divisor of the business after acquisition process.
Wherein, the default divisor is 1250 integral multiple, for example, selects the divisor 1250, now the model of the remainder Enclose for 0~1249, then, any number in the scope is selected as the separation of the default scope, with reference to specific experiment feelings Condition, select the default scope for [625 1250) when, baud rate obtains the serious forgiveness highest of result, and because maximum pulse width is 180000, then the maximum of the business for obtaining is 144.
First baud rate acquiring unit 23, for according to the corresponding relation between default greatest common divisor and baud rate, Obtain first baud rate corresponding with the greatest common divisor of the output of data processing unit 22.
Corresponding relation between the default greatest common divisor and baud rate sets according to default divisor, if this is default Divisor is 1250, then corresponding relation is as shown in upper table one.
Second baud rate acquiring unit 24, for triggering the collecting unit 21 and the data processing unit 22, according to pre- If greatest common divisor and baud rate between corresponding relation, obtain with data processing unit export greatest common divisor it is corresponding Second baud rate.
Identification decision unit 25, for when first baud rate and second ripple of the output of the first baud rate acquiring unit 23 When second baud rate of the special output of rate acquiring unit 24 is identical, judge second baud rate as effective baud rate.
Wherein, when first baud rate is identical with second baud rate, then it is assumed that second baud rate is effective baud Rate, and the baud rate is exported to MCU, now, itself Configuration of baud rate is the effective baud rate for obtaining by MCU, namely main frame The baud rate of side, and stop transmission baud rate identification acquisition request, please according to the identification acquisition of the baud rate of MCU so as to complete Ask, obtain the baud rate of host computer side, and then realize the purpose of main frame and the serial communication of slave.
Baud rate updating block 26, for when the first baud rate of the first baud rate acquiring unit 23 output with this second Second baud rate of the output of baud rate acquiring unit 24 is differed, and judges the number of times of second baud rate acquisition less than default When baud rate obtains number of times, first baud rate is updated to into second baud rate, triggers the second baud rate acquiring unit 24.
Wherein, the default baud rate obtains number of times to prevent endless loop, is set according to user, when judge this When the number of times that two baud rates are obtained obtains number of times more than default baud rate, the baud rate identification step is exited, can export and carry Show information to host computer side, such as " baud rate None- identified!" etc. information, to remind user.
The serial communication baud rate identifying device also includes:
Request judging unit, for receiving the solicited message from MCU, obtains when the solicited message is judged for baud rate identification When taking request, triggering collection unit 21;Otherwise, the collecting unit 21 is not triggered.
Specifically, the collecting unit 21, data processing unit 22, the first baud rate can be obtained single by the embodiment of the present invention First 23, second baud rate acquiring unit 24, identification decision unit 25, baud rate updating block 26 and request judging unit are integrated In FPGA or single-chip microcomputer, and to meet the demand of monitoring real-time control, using than single-chip microcomputer speed faster, possess parallel place The FPGA of reason ability can more greatly reduce the control response time, it is ensured that the smoothness of manipulation realizing the judgement of baud rate Property.
In specific implementation process, FPGA and MCU is located in slave, and 485 chip-counts are forwarded using serial ports RX and TX According to FPGA can constantly detect the pulse data that 485 chips send;Baud rate information is transmitted using serial ports RX2 and TX2 or have it Its expanded function information, for example, transmits the information such as warning message and rotation speed of the fan, temperature, completes in ball machine or slave self-inspection Afterwards, judge whether the request that reception MCU sends is that baud rate identification obtains request, is then internally to use the ripple using serial ports TX2 Special rate identifying device measures the baud rate of received data, and baud rate information is passed to into MCU by serial ports RX2, otherwise, it is not necessary to Identification baud rate.
A kind of serial communication baud rate recognition methodss are embodiments provided, by the step of the method 1:To receiving To low and high level pulse signal width respectively carry out the collection of preset times, obtain the data after collection;Step 2:To the data After carrying out minimum process, the greatest common divisor of the data after minimum is processed is obtained;Step 3:According to default highest common divisor Corresponding relation between number and baud rate, obtains the first baud rate corresponding with the greatest common divisor;Step 4:Re-execute step Rapid 1, step 2, and according to the corresponding relation between default greatest common divisor and baud rate, obtain and the greatest common divisor pair The second baud rate answered;Step 5:Judge that whether first baud rate is identical with second baud rate, is, then second baud rate For effective baud rate, otherwise, when the number of times for judging that second baud rate is obtained obtains number of times less than default baud rate, by this First baud rate is updated to the second baud rate, and goes to execution step 4, solves because existing baud rate recognition methodss are to serial The data demand that communication equipment sends is higher, causes the motility of baud rate identification and the problem that versatility is relatively low, so as to carry The motility of high baud rate recognition methodss and versatility.
Presently preferred embodiments of the present invention is the foregoing is only, not to limit the present invention, all essences in the present invention Any modification, equivalent and improvement made within god and principle etc., should be included within the scope of the present invention.

Claims (10)

1. a kind of serial communication baud rate recognition methodss, it is characterised in that methods described comprises the steps:
Step 1:Low and high level pulse signal width to receiving respectively carries out the collection of preset times, obtains the number after collection According to;
Step 2:The data are carried out with minimum process, the greatest common divisor of the data after minimum is processed is obtained;
Step 3:According to the corresponding relation between default greatest common divisor and baud rate, obtain corresponding with the greatest common divisor The first baud rate;
Step 4:Step 1, step 2 are re-executed, and according to the corresponding relation between default greatest common divisor and baud rate, is obtained Take the second baud rate corresponding with the greatest common divisor;
Step 5:Judge that whether first baud rate is identical with second baud rate, is, then second baud rate is have Effect baud rate, otherwise, when the number of times for judging that second baud rate is obtained obtains number of times less than default baud rate, will be described First baud rate is updated to second baud rate, and goes to execution step 4.
2. the method for claim 1, it is characterised in that before the step 1, methods described also includes:
The solicited message from MCU is received, when the solicited message is judged for baud rate identification acquisition request, execution step 1.
3. the method for claim 1, it is characterised in that the preset times are no less than 9 times.
4. the method for claim 1, it is characterised in that carry out to the data after minimum process, obtains and minimizes The step of greatest common divisor of the data after process, is specially:
By the data divided by default divisor, corresponding business and remainder are obtained;
When the remainder is in default scope, the corresponding business of the remainder is added 1, otherwise business is constant, after acquisition is processed The greatest common divisor of business.
5. method as claimed in claim 4, it is characterised in that the default divisor is 1250 integral multiple.
6. a kind of serial communication baud rate identifying device, it is characterised in that described device includes collecting unit, data processing list Unit, the first baud rate acquiring unit, the second baud rate acquiring unit, identification decision unit and baud rate updating block, wherein:
Collecting unit, for respectively carrying out the collection of preset times to the low and high level pulse signal width for receiving, obtains collection Data afterwards;
Data processing unit, the data for exporting to collecting unit carry out minimum process, obtain the number after minimum is processed According to greatest common divisor;
First baud rate acquiring unit, for according to the corresponding relation between default greatest common divisor and baud rate, obtain with Corresponding first baud rate of greatest common divisor of data processing unit output;
Second baud rate acquiring unit, for triggering the collecting unit and the data processing unit, according to it is default most Big corresponding relation between common divisor and baud rate, obtains the second ripple corresponding with the greatest common divisor of data processing unit output Special rate;
Identification decision unit, for when first baud rate and second baud rate of the first baud rate acquiring unit output When second baud rate of acquiring unit output is identical, judge second baud rate as effective baud rate;And
Baud rate updating block, for when first baud rate and second baud of the first baud rate acquiring unit output Second baud rate of rate acquiring unit output is differed, and judges that the number of times that second baud rate is obtained is less than default baud When rate obtains number of times, first baud rate is updated to into second baud rate, triggers the second baud rate acquiring unit.
7. device as claimed in claim 6, it is characterised in that described device also includes:
Request judging unit, for receiving the solicited message from MCU, obtains when the solicited message is judged for baud rate identification During request, triggering collection unit.
8. device as claimed in claim 6, it is characterised in that the data processing unit also includes:
Processing unit is minimized, divided by default divisor, corresponding business and remainder are obtained for by the data;And
Greatest common divisor acquiring unit, for when the remainder is in default scope, adding 1 by the corresponding business of the remainder, Otherwise business is constant, the greatest common divisor of the business after acquisition process.
9. device as claimed in claim 8, it is characterised in that the default divisor is 1250 integral multiple.
10. a kind of monitoring device, it is characterised in that the monitoring device includes the identification dress described in any one of claim 6 to 9 Put.
CN201110211789.1A 2011-07-27 2011-07-27 Baud rate identification method and device for serial communication and monitoring equipment Expired - Fee Related CN102904766B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110211789.1A CN102904766B (en) 2011-07-27 2011-07-27 Baud rate identification method and device for serial communication and monitoring equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110211789.1A CN102904766B (en) 2011-07-27 2011-07-27 Baud rate identification method and device for serial communication and monitoring equipment

Publications (2)

Publication Number Publication Date
CN102904766A CN102904766A (en) 2013-01-30
CN102904766B true CN102904766B (en) 2017-05-17

Family

ID=47576815

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110211789.1A Expired - Fee Related CN102904766B (en) 2011-07-27 2011-07-27 Baud rate identification method and device for serial communication and monitoring equipment

Country Status (1)

Country Link
CN (1) CN102904766B (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559164A (en) * 2013-11-05 2014-02-05 深圳市科曼医疗设备有限公司 Method and device for identifying serial port baud rate
CN106034092B (en) * 2015-03-17 2019-11-26 杭州讯能科技有限公司 A kind of method, equipment and the system of serial port baud rate automatic identification
CN106941399B (en) * 2017-03-15 2020-04-24 广州致远电子有限公司 Baud rate measuring method and device for double-rate CAN FD
CN107422874B (en) * 2017-07-24 2023-10-24 广东迪控电子科技有限公司 Multifunctional key communication method
CN109389866B (en) * 2018-12-12 2020-11-13 江西理工大学 System and method for detecting shooting of unmanned aerial vehicle
CN109976247A (en) * 2019-04-22 2019-07-05 国网上海市电力公司 A kind of power distribution station communication failure automatic monitored control system and method
US11080224B2 (en) * 2019-08-27 2021-08-03 American Megatrends International, Llc Method, baseboard management controller and system for establishing a serial-over-LAN connection
CN110958156B (en) * 2019-11-14 2023-05-09 中国航空工业集团公司西安航空计算技术研究所 Baud rate detection method and device for serial communication interface
CN112941816B (en) * 2019-12-11 2024-02-13 重庆海尔洗衣机有限公司 Control method for laundry treating apparatus
CN111431783B (en) * 2020-04-02 2021-12-31 希尔塔(苏州)信息技术有限公司 CAN bus baud rate self-adaption method
CN112003954B (en) * 2020-10-27 2021-02-19 苏州纳芯微电子股份有限公司 Data communication method, data communication system, and computer-readable storage medium
CN112540641B (en) * 2020-10-29 2024-04-12 珠海格力电器股份有限公司 Clock precision correction method, device and storage medium
CN115598600B (en) * 2022-11-28 2023-03-28 四川九洲电器集团有限责任公司 Secondary radar signal dynamic coding system, method, electronic equipment and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101399635A (en) * 2008-09-28 2009-04-01 中兴通讯股份有限公司 Baud rate adaptation method, apparatus and host for communication
CN101409716A (en) * 2008-11-25 2009-04-15 中国网络通信集团公司 Method for matching communication velocity of wireless communication module and external application module
CN101710857A (en) * 2009-11-05 2010-05-19 厦门敏讯信息技术股份有限公司 Serial communication baud rate adaptive method and device thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7415543B2 (en) * 2003-11-12 2008-08-19 Lsi Corporation Serial port initialization in storage system controllers

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101399635A (en) * 2008-09-28 2009-04-01 中兴通讯股份有限公司 Baud rate adaptation method, apparatus and host for communication
CN101409716A (en) * 2008-11-25 2009-04-15 中国网络通信集团公司 Method for matching communication velocity of wireless communication module and external application module
CN101710857A (en) * 2009-11-05 2010-05-19 厦门敏讯信息技术股份有限公司 Serial communication baud rate adaptive method and device thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
串行通信波特率的自动识别;乔渠,等;《单片机与嵌入式系统应用》;20070201(第2期);第33-35页 *

Also Published As

Publication number Publication date
CN102904766A (en) 2013-01-30

Similar Documents

Publication Publication Date Title
CN102904766B (en) Baud rate identification method and device for serial communication and monitoring equipment
EP0706276B1 (en) Method and apparatus for network analysis
CN102306136B (en) Baud rate self-adaption method based on input capture function of singlechip
CN109921915B (en) Method and device for testing wake-up function of real-time clock module and electronic equipment
CN102571292B (en) Communication maintenance scheme matching method, link monitor and wireless sensor network
US6744398B1 (en) Distancing and positioning systems and methods
WO2008125916A4 (en) System, method and computer program product for detection of seismic events from a network
CN106708671A (en) Method and device for detecting bus behavior of system on chip
CN107390090A (en) A kind of circuitry fault detection method and system
CN108809617A (en) A kind of delay compensation method and terminal
CN101819710B (en) Two-way serial communication protocol based communication method for fire alarm system
CN109217922A (en) A kind of method and device that optical module reports Received Loss Of Signal to alert
CN104270287B (en) A kind of packet out-ordering detection method and device
CN101719858B (en) Synchronous processing method of bit timing of control area network (CAN) controller
CN111274132B (en) Method and device for testing reliability of device driver data cleaning function
CN108369565A (en) Communication device, communication means, program and communication system
CN105183688A (en) Serial port network based IO digital quantity monitoring port extension method
CN106953809A (en) A kind of device resource acquisition method based on 485 tdm communications
CN105430685A (en) Interference source number estimation method based on control chart
CN101478448B (en) Control method and apparatus for Ethernet switching equipment
CN109617905A (en) Processing method, device and the realization device of multicast attack
US5778172A (en) Enhanced real-time topology analysis system or high speed networks
US20220206551A1 (en) System and method to detect malicious can controller behavior from adversarial clock control
CN202486603U (en) Well group monitoring system based on internet of things
CN109525350B (en) Module synchronization control method based on asynchronous serial port synchronization source

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170517

Termination date: 20210727

CF01 Termination of patent right due to non-payment of annual fee