CN108170630A - A kind of serial communication baud rate adaptation method, system and equipment - Google Patents
A kind of serial communication baud rate adaptation method, system and equipment Download PDFInfo
- Publication number
- CN108170630A CN108170630A CN201711463331.9A CN201711463331A CN108170630A CN 108170630 A CN108170630 A CN 108170630A CN 201711463331 A CN201711463331 A CN 201711463331A CN 108170630 A CN108170630 A CN 108170630A
- Authority
- CN
- China
- Prior art keywords
- baud rate
- communication
- module
- serial
- hrc
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
- G06F13/4291—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using a clocked protocol
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
- Synchronisation In Digital Transmission Systems (AREA)
- Information Transfer Systems (AREA)
Abstract
The invention discloses a kind of serial communication baud rate adaptation methods to include:S1:Judge the communication module of serial ports whether in adaptive state;If so, into S2;If it is not, then enter S3;S2:The baud rate of communication module is calculated by preset byte;S3:Judge whether communication module is communicated with the baud rate correct;If so, into S4;If it is not, then enter S2;S4:Current HRC values inside serial ports are measured by preset byte;S5:Judge whether the difference of current HRC values and the HRC values of last moment is less than preset value;If so, using current HRC values as the HRC values of last moment.Serial communication baud rate adaptation method disclosed by the invention is in the case where internal clock source is unstable, it is ensured that the real-time and anti-interference of serial communication.The invention also discloses a kind of serial communication baud rate self-adapting system and equipment and a kind of computer readable storage mediums, equally can realize above-mentioned technique effect.
Description
Technical field
The present invention relates to fields of communication technology, more specifically to a kind of serial communication baud rate adaptation method, are
System and equipment and a kind of computer readable storage medium.
Background technology
Serial communication because it is at low cost, be easily achieved, be common a kind of communication pattern in current embedded system.It is going here and there
In port communications, " baud rate " is the unit for describing communication speed.In the communications, the identical ability of the baud rate of only communicating pair
Can ensure that being normally carried out for communication, this brings inconvenience for the use of serial communication equipment, especially when to a side to the opposing party
When baud rate is unknown.If the adaptive of serial communication baud rate can be realized, the use of serial communication equipment can be undoubtedly improved
Flexibility and versatility.
The common two ways of baud rate self-adapting is at present:The standard baud rate method of exhaustion and symbol width detect in real time
Method.Baud rate method of exhaustion requirement communication equipment baud rate can only change between limited fixed value, after serial device starts, by
The characteristic character that a trial is sent out with different baud rate reception data terminals, until can be properly received.This method effect
Rate is very low, and high place is required for real-time Communication for Power, can not ensure the promptness of communication.
Symbol width real-time detection method requires data terminal to send characteristic character according to agreement, and serial device measures input number
According to symbol width, then calculate baud rate to be measured.This method application at present is than wide.But if because external circuit
The distortion of waveform is caused, then the baud rate calculated just has larger error, influences the success rate of communication.
Meanwhile both the above adaptive approach is all based on system and is operated on a stable clock source, but at present
Many MCU (English full name:Micro Control Unit, Chinese full name:Micro-control unit) in order to save cost, all adopt in succession
Designed with no crystal oscillator, be used as the clock source of system by internal HRC (clock source), internal HRC can have with temperature about ±
5% frequency variation, and this variation can influence the correctness of baud rate.
Therefore, how in the case where internal clock source is unstable, it is ensured that the real-time and anti-interference of serial communication be
Those skilled in the art's problem to be solved.
Invention content
The purpose of the present invention is to provide a kind of serial communication baud rate adaptation method, system and equipment and a kind of calculating
Machine readable storage medium storing program for executing, in the case where internal clock source is unstable, it is ensured that the real-time and anti-interference of serial communication.
To achieve the above object, an embodiment of the present invention provides a kind of serial communication baud rate adaptation method, including:
S101:Judge the communication module of the serial ports whether in adaptive state;If so, into S102;If it is not, then
Into S103;
S102:The baud rate of the communication module is calculated by preset byte;
S103:Judge whether the communication module is communicated with the baud rate correct;If so, into S104;If it is not, then
Into S102;
S104:Current HRC values inside the serial ports are measured by the preset byte;
S105:Judge whether the difference of current HRC values and the HRC values of last moment is less than preset value;It if so, will be current
HRC value of the HRC values as last moment.
Wherein, judge whether the communication module of the serial ports includes in adaptive state:
Judge whether the serial ports carries out reset operation, judge whether the communication module is wrong with current baud rate communication
Accidentally;
If being, the communication module of the serial ports is in adaptive state.
Wherein, the S102 includes:
The first collection point between two failing edges of communication waveforms of the communication module is calculated by the 0x7D bytes
Number.
Wherein, it before the S105, further includes:
The HRC values of last moment are judged whether, if so, the step of performing the S105.
Wherein, the S104 includes:
The second acquisition points of the communication waveforms 8bit failing edges of the communication waveforms are calculated by 0x7D bytes.
Wherein, if there are the last moment HRC values, the S105 includes:
Judge that second acquisition at current time is counted with whether the difference of the second acquisition points of last moment is less than currently
The 5% of the second acquisition points at moment;If so, using the second acquisition points at current time as the second acquisition of last moment
Points.
Wherein, if there is no last moment HRC values, pass through the communication waveforms that 0x7D bytes calculate the communication waveforms
After second acquisition points of 8bit failing edges, further include:
Calculate the proportionate relationship of the first acquisition points and the described second acquisition points;
Judge whether the proportionate relationship is 4:1;
If so, it counts the described second acquisition points as the second acquisition of last moment.
To achieve the above object, an embodiment of the present invention provides a kind of serial communication baud rate self-adapting system, including:
First judgment module, for judging the communication module of the serial ports whether in adaptive state;If so, start
The workflow of computing module;If it is not, then start the workflow of the second judgment module;
The computing module, for passing through the baud rate that preset byte calculates the communication module;
Second judgment module, for judging whether the communication module is correct with baud rate communication;If so,
Start the workflow of measurement module;If it is not, then start the workflow of computing module;
The measurement module, for measuring the current HRC values inside the serial ports by the preset byte;
Module is adjusted, for judging whether the difference of the HRC values of current HRC values and last moment is less than preset value;If so,
Then using current HRC values as the HRC values of last moment.
To achieve the above object, an embodiment of the present invention provides a kind of serial communication baud rate self-adapting equipment, including:
Memory, for storing computer program;
Processor realizes the step such as above-mentioned serial communication baud rate adaptation method during for performing the computer program
Suddenly.
To achieve the above object, an embodiment of the present invention provides a kind of computer readable storage mediums, and the computer can
It reads to be stored with computer program on storage medium, such as above-mentioned serial communication wave is realized when the computer program is executed by processor
Special rate adaptive approach.
By above scheme it is found that a kind of serial communication baud rate adaptation method provided in an embodiment of the present invention includes:
S101:Judge the communication module of the serial ports whether in adaptive state;If so, into S102;If it is not, then enter
S103;S102:The baud rate of the communication module is calculated by preset byte;S103:Judge the communication module with the wave
Whether special rate communication is correct;If so, into S104;If it is not, then enter S102;S104:Institute is measured by the preset byte
State the current HRC values inside serial ports;S105:Judge current HRC values and the HRC values of last moment difference whether be less than it is default
Value;If so, using current HRC values as the HRC values of last moment.
Serial communication baud rate adaptation method provided in an embodiment of the present invention employs baud rate fine tuning technology, is applicable in
In be not using occasion of the stable clock source as system clock, by accurately measuring the variation of HRC, to baud rate into
Row fine tuning.It can be seen that serial communication baud rate adaptation method provided in an embodiment of the present invention is unstable in internal clock source
In the case of, it is ensured that the real-time and anti-interference of serial communication.The invention also discloses a kind of serial communication baud rate is adaptive
System and equipment and a kind of computer readable storage medium are answered, equally can realize above-mentioned technique effect.
Description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, to embodiment or will show below
There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention, for those of ordinary skill in the art, without creative efforts, can be with
Other attached drawings are obtained according to these attached drawings.
Fig. 1 is a kind of flow chart of serial communication baud rate adaptation method disclosed by the embodiments of the present invention;
Fig. 2 is the flow chart of another serial communication baud rate adaptation method disclosed by the embodiments of the present invention;
Fig. 3 is the calculating schematic diagram of baud rate disclosed by the embodiments of the present invention and HRC values;
Fig. 4 is a kind of structure chart of serial communication baud rate self-adapting system disclosed by the embodiments of the present invention;
Fig. 5 is a kind of structure chart of serial communication baud rate self-adapting equipment disclosed by the embodiments of the present invention.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present invention, the technical solution in the embodiment of the present invention is carried out clear, complete
Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art are obtained every other without creative efforts
Embodiment shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a kind of serial communication baud rate adaptation method, in the unstable feelings of internal clock source
Under condition, it is ensured that the real-time and anti-interference of serial communication.
Referring to Fig. 1, a kind of flow chart of serial communication baud rate adaptation method disclosed by the embodiments of the present invention, such as Fig. 1
It is shown, including:
S101:Judge the communication module of the serial ports whether in adaptive state;If so, into S102;If it is not, then
Into S103;
In specific implementation, when serial ports carries out resetting operation or communication module with current baud rate communication generation mistake,
Communication module is in adaptive state.Certainly, those skilled in the art can also according to truth condition, when other events trigger,
Communication module is in adaptive state, is not specifically limited herein.When the communication module of serial ports is in adaptive state, enter
S102, otherwise into S103.
S102:The baud rate of the communication module is calculated by preset byte;
In specific implementation, can baud rate be calculated by first special byte 0x7D of communication protocol, calculated
The baud rate is stored after the current baud rate of communication module, next serial ports will communicated with this baud rate, until
Communication mistake, that is, communication module occurs and is in adaptive state, removes current baud rate and current HRC values, reenters S102.
It should be noted that the present embodiment does not limit preset byte specifically, which can be above-mentioned
0x7D bytes, naturally it is also possible to be other bytes with similar functions, those skilled in the art can be according to actual conditions spirit
Selection living.
S103:Judge whether the communication module is communicated with the baud rate correct;If so, into S104;If it is not, then
Into S102;
S104:Current HRC values inside the serial ports are measured by the preset byte;
In specific implementation, under the premise of communication correctly, the current HRC inside serial ports is measured by above-mentioned preset byte
Value.
S105:Judge whether the difference of current HRC values and the HRC values of last moment is less than preset value;It if so, will be current
HRC value of the HRC values as last moment.
In specific implementation, current HRC values and the HRC values of last moment are compared, if the two difference is less than preset value,
Think that the frequency of the HRC inside serial ports as time-varying has occurred in temperature or the variation of other condition, needs to carry out baud rate micro-
It adjusts;If greater than preset value, then it is assumed that be that EMC or other interference cause HRC value measuring errors, which is abandoned.It needs
It is noted that the present embodiment is not defined the preset value, and the 5% of preferably current HRC values, certain people in the art
Member can flexibly be set according to actual conditions.
Serial communication baud rate adaptation method provided in an embodiment of the present invention employs baud rate fine tuning technology, is applicable in
In be not using occasion of the stable clock source as system clock, by accurately measuring the variation of HRC, to baud rate into
Row fine tuning.It can be seen that serial communication baud rate adaptation method provided in an embodiment of the present invention is unstable in internal clock source
In the case of, it is ensured that the real-time and anti-interference of serial communication.
The embodiment of the invention discloses a kind of serial communication baud rate adaptation method, relative to a upper embodiment, this reality
It applies example and further instruction and optimization has been made to technical solution.Specifically:
Referring to Fig. 2, the flow chart of another kind serial communication baud rate adaptation method provided in an embodiment of the present invention is such as schemed
Shown in 2, including:
S201:Judge whether the serial ports carries out reset operation, judge that the communication module is with current baud rate communication
No mistake;If being, into S202;If it is not, then enter S203;
S202:It is adopted by first between two failing edges of communication waveforms of the 0x7D bytes calculating communication module
Collection points;
In specific implementation, it is normal in order to ensure that will communicate under circumstances, it will usually many filters are added in periphery
Wave circuit, these circuits can cause communication waveforms the distortion of different situations, as shown in figure 3, such as with the variation of working environment
Calculating waveform of the fruit using T1 as baud rate, then can generate larger error, since the situation that identical edge is distorted is essentially identical,
Waveform is calculated using T2 as baud rate can be relatively more accurate.Therefore, spcial character 0x7D can just be produced in start bit and the first bit
Raw failing edge twice both can ensure that the accuracy that baud rate measures, and also ensure that the real-time of communication.
Baud rate calculation formula is as follows:
Wherein, fHRCFor the frequency of practical internal clock source HRC, the unknown parameters;NT2Adopting between two failing edges
Number of samples, i.e., the first acquisition points.From formula as can be seen that in the case that if baud rate is constant, the size of the value is actually
It is by fHRCInfluence.
Then baud rate formula in practical application:
By test two failing edges points, this points divided by 2 be exactly system under current clock frequency, Mei Geduo
A few clock number samples signal, accordingly even when in current fHRCIn the case of unknown, correct communication can be also realized.Wave
The variation of special rate, then the sampling interval can also change, so as to achieve the effect that baud rate self-adapting.
S203:Judge whether the communication module is communicated with the baud rate correct;If so, into S204;If it is not, then
Into S202;
S204:The second acquisition points of the communication waveforms 8bit failing edges of the communication waveforms are calculated by 0x7D bytes;
In specific implementation, serial communication circuit is sampled three times in the intermediate point of data waveform, and two are taken according in three
Principle obtains data.Therefore, even if waveform receives interference and produces some small burrs, communication will not be impacted.But
It is that, in baud rate self-adapting mechanism, which is then likely to cause the mistake of baud rate calculating.
But if fruit chip is using internal HRC as clock source, when exterior temperature change, fHRCHave ± 5% left side
Right variation.If by baud rate formula in above-mentioned practical application it is found that fHRCChanged, then NT2Also deviation can occur,
But system will not often carry out baud rate self-adapting, NT2Value will not be with fHRCVariation and synchronize variation, therefore just need
There are one reliable methods to NT2It is finely adjusted, the baud rate calculation formula through overcompensation is as follows:
Wherein, NT3It is to count in real time the acquisition of the failing edge of 8bit, i.e., the second acquisition points, the value is relative in baud
Rate is adaptively the N measuredT2Precision higher;nT2To pass through NT3Calculate new baud rate value.
S251:The HRC values of last moment are judged whether, if so, into S252;If it is not, then enter S253;
S252:Judge whether the second acquisition points at current time and the difference of the second acquisition points of last moment are less than
The 5% of the second acquisition points at current time;If so, using the second acquisition points at current time as the second of last moment
Acquisition points;
S253:Calculate the proportionate relationship of the first acquisition points and the described second acquisition points;Judge that the ratio is closed
Whether system is 4:1;If so, it counts the described second acquisition points as the second acquisition of last moment.
When there are during last moment, comparing current time NT3With the N of last momentT3If the two difference is less than ± 5%.
Then it is considered fHRCMeasurement variation caused by variation is adjusted, otherwise, then using the baud rate calculation formula of above-mentioned compensation
It is considered to interfere, does not adjust.
As first record NT3During value, by comparing NT2And NT3Between proportionate relationship, if proportionate relationship be 1:4, then
It is correct data to think the data, otherwise, then it is assumed that is interference data, does not keep a record.
By above-mentioned adjustment mode, can real-time compensation because internal HRC is varied with temperature, be also avoided that severe
In the case of EMC, to the Error Compensation of baud rate.
A kind of serial communication baud rate self-adapting system provided in an embodiment of the present invention is introduced below, is described below
A kind of serial communication baud rate self-adapting system can phase with a kind of above-described serial communication baud rate adaptation method
Mutual reference.
Referring to Fig. 4, a kind of structure chart of serial communication baud rate self-adapting system provided in an embodiment of the present invention, such as Fig. 4
It is shown, including:
First judgment module 401, for judging the communication module of the serial ports whether in adaptive state;If so,
Start the workflow of computing module 402;If it is not, then start the workflow of the second judgment module 303;
The computing module 402, for passing through the baud rate that preset byte calculates the communication module;
Second judgment module 403, for judging whether the communication module is correct with baud rate communication;If
It is then to start the workflow of measurement module;If it is not, then start the workflow of computing module;
The measurement module 404, for measuring the current HRC values inside the serial ports by the preset byte;
Module 405 is adjusted, for judging whether the difference of the HRC values of current HRC values and last moment is less than preset value;If
It is, then using current HRC values as the HRC values of last moment.
Serial communication baud rate self-adapting system provided in an embodiment of the present invention employs baud rate fine tuning technology, is applicable in
In be not using occasion of the stable clock source as system clock, by accurately measuring the variation of HRC, to baud rate into
Row fine tuning.It can be seen that serial communication baud rate adaptation method provided in an embodiment of the present invention is unstable in internal clock source
In the case of, it is ensured that the real-time and anti-interference of serial communication.
On the basis of above-described embodiment, preferably, first judgment module 401 is specially to judge institute
State whether serial ports carries out reset operation, judge the communication module with current baud rate communication whether mistake;If being, start
The workflow of computing module 402;Otherwise start the module of the workflow of the second judgment module 403.
On the basis of above-described embodiment, preferably, the computing module 402 is specifically by described
0x7D bytes calculate the module of the first acquisition points between two failing edges of communication waveforms of the communication module.
On the basis of above-described embodiment, preferably, further include:
Third judgment module, for judging whether the HRC values of last moment, if so, starting the adjustment module
Workflow.
On the basis of above-described embodiment, preferably, the measurement module 404 is specifically by 0x7D words
Section calculates the module of the second acquisition points of the communication waveforms 8bit failing edges of the communication waveforms.
On the basis of above-described embodiment, preferably, if there are the HRC values of the last moment, institute
Stating the difference that adjustment module 405 is specially the second acquisition points and the second acquisition points of last moment that judge current time is
The 5% of no the second acquisition points less than current time;If so, using the second acquisition points at current time as last moment
Second acquisition points module.
On the basis of above-described embodiment, preferably, if there is no the HRC values of last moment, also wrap
It includes:
Ratio module, for calculating the proportionate relationship of the first acquisition points and the described second acquisition points;Judge institute
State whether proportionate relationship is 4:1;If so, it counts the described second acquisition points as the second acquisition of last moment.
It is provided in an embodiment of the present invention referring to Fig. 5 present invention also provides a kind of serial communication baud rate self-adapting equipment
A kind of structure chart of serial communication baud rate self-adapting equipment, as shown in figure 5, including:
Memory 501, for storing computer program;
Processor 502, for perform it is described be exactly computer program when can realize the step of above-described embodiment provides.
Certain serial communication baud rate self-adapting equipment can also include the components such as various network interfaces, power supply.
Serial communication baud rate self-adapting equipment provided in an embodiment of the present invention employs baud rate fine tuning technology, is applicable in
In be not using occasion of the stable clock source as system clock, by accurately measuring the variation of HRC, to baud rate into
Row fine tuning.It can be seen that serial communication baud rate adaptation method provided in an embodiment of the present invention is unstable in internal clock source
In the case of, it is ensured that the real-time and anti-interference of serial communication.
Present invention also provides a kind of computer readable storage mediums, are stored thereon with computer program, the computer
Program can realize the step of above-described embodiment provides when being executed by processor.The storage medium can include:USB flash disk, movement
Hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory,
RAM), the various media that can store program code such as magnetic disc or CD.
Each embodiment is described by the way of progressive in this specification, the highlights of each of the examples are with other
The difference of embodiment, just to refer each other for identical similar portion between each embodiment.
The foregoing description of the disclosed embodiments enables professional and technical personnel in the field to realize or use the present invention.
A variety of modifications of these embodiments will be apparent for those skilled in the art, it is as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention
The embodiments shown herein is not intended to be limited to, and is to fit to and the principles and novel features disclosed herein phase one
The most wide range caused.
Each embodiment is described by the way of progressive in specification, the highlights of each of the examples are with other realities
Apply the difference of example, just to refer each other for identical similar portion between each embodiment.For system disclosed in embodiment
Speech, since it is corresponded to the methods disclosed in the examples, so description is fairly simple, related part is referring to method part illustration
.It should be pointed out that for those skilled in the art, under the premise of the application principle is not departed from, also
Can to the application, some improvement and modification can also be carried out, these improvement and modification also fall into the application scope of the claims
It is interior.
It should also be noted that, in the present specification, relational terms such as first and second and the like be used merely to by
One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation
Between there are any actual relationship or orders.Moreover, term " comprising ", "comprising" or its any other variant meaning
Covering non-exclusive inclusion, so that process, method, article or equipment including a series of elements not only include that
A little elements, but also including other elements that are not explicitly listed or further include for this process, method, article or
The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged
Except also there are other identical elements in the process, method, article or apparatus that includes the element.
Claims (10)
1. a kind of serial communication baud rate adaptation method, which is characterized in that including:
S101:Judge the communication module of the serial ports whether in adaptive state;If so, into S102;If it is not, then enter
S103;
S102:The baud rate of the communication module is calculated by preset byte;
S103:Judge whether the communication module is communicated with the baud rate correct;If so, into S104;If it is not, then enter
S102;
S104:Current HRC values inside the serial ports are measured by the preset byte;
S105:Judge whether the difference of current HRC values and the HRC values of last moment is less than preset value;If so, by current HRC
It is worth the HRC values as last moment.
2. serial communication baud rate adaptation method according to claim 1, which is characterized in that judge the communication of the serial ports
Whether module includes in adaptive state:
Judge whether the serial ports carries out reset operation, judge the communication module with current baud rate communication whether mistake;
If being, the communication module of the serial ports is in adaptive state.
3. serial communication baud rate adaptation method according to claim 1, which is characterized in that the S102 includes:
The first acquisition points between two failing edges of communication waveforms of the communication module are calculated by the 0x7D bytes.
4. serial communication baud rate adaptation method according to claim 3, which is characterized in that before the S105, also wrap
It includes:
The HRC values of last moment are judged whether, if so, the step of performing the S105.
5. serial communication baud rate adaptation method according to claim 4, which is characterized in that the S104 includes:
The second acquisition points of the communication waveforms 8bit failing edges of the communication waveforms are calculated by 0x7D bytes.
6. serial communication baud rate adaptation method according to claim 5, which is characterized in that if there are the last moments
HRC values, then the S105 include:
Judge whether the second acquisition points at current time and the difference of the second acquisition points of last moment are less than current time
Second acquisition points 5%;If so, using the second acquisition points at current time as the second collection point of last moment
Number.
7. serial communication baud rate adaptation method according to claim 6, which is characterized in that if there is no last moments
HRC values, then after being counted by the second acquisition of the communication waveforms 8bit failing edges of the 0x7D bytes calculating communication waveforms, also
Including:
Calculate the proportionate relationship of the first acquisition points and the described second acquisition points;
Judge whether the proportionate relationship is 4:1;
If so, it counts the described second acquisition points as the second acquisition of last moment.
8. a kind of serial communication baud rate self-adapting system, which is characterized in that including:
First judgment module, for judging the communication module of the serial ports whether in adaptive state;It is calculated if so, starting
The workflow of module;If it is not, then start the workflow of the second judgment module;
The computing module, for passing through the baud rate that preset byte calculates the communication module;
Second judgment module, for judging whether the communication module is correct with baud rate communication;If so, start
The workflow of measurement module;If it is not, then start the workflow of computing module;
The measurement module, for measuring the current HRC values inside the serial ports by the preset byte;
Module is adjusted, for judging whether the difference of the HRC values of current HRC values and last moment is less than preset value;It if so, will
Current HRC value of the HRC values as last moment.
9. a kind of serial communication baud rate self-adapting equipment, which is characterized in that including:
Memory, for storing computer program;
Processor realizes the serial communication baud rate as described in any one of claim 1 to 7 during for performing the computer program
The step of adaptive approach.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium
Program realizes that serial communication baud rate is certainly as described in any one of claim 1 to 7 when the computer program is executed by processor
Adaptive method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711463331.9A CN108170630B (en) | 2017-12-28 | 2017-12-28 | Serial port communication baud rate self-adaption method, system and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711463331.9A CN108170630B (en) | 2017-12-28 | 2017-12-28 | Serial port communication baud rate self-adaption method, system and equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108170630A true CN108170630A (en) | 2018-06-15 |
CN108170630B CN108170630B (en) | 2021-02-02 |
Family
ID=62519579
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711463331.9A Active CN108170630B (en) | 2017-12-28 | 2017-12-28 | Serial port communication baud rate self-adaption method, system and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108170630B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111258514A (en) * | 2020-01-20 | 2020-06-09 | 东莞炜煌打印机有限公司 | Baud rate self-adaption method and device and printer |
CN111314018A (en) * | 2019-11-01 | 2020-06-19 | 珠海格力电器股份有限公司 | Baud rate self-adaptive adjustment processing system and method and information data processing terminal |
CN112511334A (en) * | 2020-10-13 | 2021-03-16 | 博流智能科技(南京)有限公司 | Method and system for improving communication rate |
CN115061969A (en) * | 2022-08-15 | 2022-09-16 | 追觅创新科技(苏州)有限公司 | Cleaning equipment and baud rate self-adaptive adjusting method and system thereof |
CN115776365A (en) * | 2021-09-07 | 2023-03-10 | 合肥移瑞通信技术有限公司 | Method and system for correcting serial port baud rate, communication module and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130259095A1 (en) * | 2010-11-12 | 2013-10-03 | Lei Chen | Modbus repeater with self-adaptive baud rate and self-adaptive baud rate sytem and method |
CN103412615A (en) * | 2013-08-22 | 2013-11-27 | 中国航天科工集团第三研究院第八三五七研究所 | Glitch-free self-adaptive clock switching method for UART (Universal Asynchronous Receiver Transmitter) interface chip |
CN103684678A (en) * | 2012-11-01 | 2014-03-26 | 国网电力科学研究院 | Baud rate adaptive method for UART, device and UART |
US8817933B2 (en) * | 2013-01-09 | 2014-08-26 | Rockwell Automation Technologies, Inc. | Method and apparatus for clock data recovery from Manchester coded serial data stream |
CN104199799A (en) * | 2014-08-29 | 2014-12-10 | 天津市亚安科技股份有限公司 | Baud rate self-adaptation method and device based on CPLD |
CN105959093A (en) * | 2016-04-25 | 2016-09-21 | 成都大学 | Serial communication baud rate real-time self-adaption method |
-
2017
- 2017-12-28 CN CN201711463331.9A patent/CN108170630B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130259095A1 (en) * | 2010-11-12 | 2013-10-03 | Lei Chen | Modbus repeater with self-adaptive baud rate and self-adaptive baud rate sytem and method |
CN103684678A (en) * | 2012-11-01 | 2014-03-26 | 国网电力科学研究院 | Baud rate adaptive method for UART, device and UART |
US8817933B2 (en) * | 2013-01-09 | 2014-08-26 | Rockwell Automation Technologies, Inc. | Method and apparatus for clock data recovery from Manchester coded serial data stream |
CN103412615A (en) * | 2013-08-22 | 2013-11-27 | 中国航天科工集团第三研究院第八三五七研究所 | Glitch-free self-adaptive clock switching method for UART (Universal Asynchronous Receiver Transmitter) interface chip |
CN104199799A (en) * | 2014-08-29 | 2014-12-10 | 天津市亚安科技股份有限公司 | Baud rate self-adaptation method and device based on CPLD |
CN105959093A (en) * | 2016-04-25 | 2016-09-21 | 成都大学 | Serial communication baud rate real-time self-adaption method |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111314018A (en) * | 2019-11-01 | 2020-06-19 | 珠海格力电器股份有限公司 | Baud rate self-adaptive adjustment processing system and method and information data processing terminal |
CN111258514A (en) * | 2020-01-20 | 2020-06-09 | 东莞炜煌打印机有限公司 | Baud rate self-adaption method and device and printer |
CN112511334A (en) * | 2020-10-13 | 2021-03-16 | 博流智能科技(南京)有限公司 | Method and system for improving communication rate |
CN112511334B (en) * | 2020-10-13 | 2024-05-07 | 博流智能科技(南京)有限公司 | Method and system for improving communication rate |
CN115776365A (en) * | 2021-09-07 | 2023-03-10 | 合肥移瑞通信技术有限公司 | Method and system for correcting serial port baud rate, communication module and storage medium |
CN115061969A (en) * | 2022-08-15 | 2022-09-16 | 追觅创新科技(苏州)有限公司 | Cleaning equipment and baud rate self-adaptive adjusting method and system thereof |
Also Published As
Publication number | Publication date |
---|---|
CN108170630B (en) | 2021-02-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108170630A (en) | A kind of serial communication baud rate adaptation method, system and equipment | |
CN107147553B (en) | Method, device and equipment for adjusting Baud rate and frame format of slave station | |
CN109687867B (en) | Clock calibration method and calibration circuit for crystal-oscillator-free USB (universal serial bus) equipment | |
CN107181300B (en) | Charge protector, the method and apparatus for calibrating charging equipment | |
CN102830748B (en) | The calibration steps of the clock skew inside of chip and system | |
EP3368994B1 (en) | Electrical fast transient tolerant input/output (i/o) communication system | |
CN103760759B (en) | Automatic forward/reverse direction IRIG-B code decoding method | |
CN104518839B (en) | frequency deviation detection method and device | |
CN109075742A (en) | Baud rate calibrates circuit and serial port chip | |
CN102035472A (en) | Programmable digital frequency multiplier | |
CN112069098B (en) | Baud rate identification method and device | |
CN205725685U (en) | Periodic pulse signal based on programmable logic chip detects protection module automatically | |
CN107565960B (en) | Performance index of phase locked loop | |
CN103487778A (en) | Analog quantity correcting method and single-CPU (Central Processing Unit) low-pressure protector based on analog quantity correcting method | |
CN111007709B (en) | Method, device and system for detecting daily timing error of electric energy meter | |
CN107678421A (en) | A kind of pulse matching system and method in train control system | |
CN205901711U (en) | Accurate digital frequency divider based on GPS pulse signal second | |
CN102404062A (en) | System and method for detecting spread spectrum clock signal | |
CN116559528A (en) | Chip frequency measuring method, circuit, device, storage medium and computer equipment | |
CN1333529C (en) | Clock signal detection method and apparatus in electronic devices | |
CN114024795B (en) | Baud rate self-adaption method, device, computer equipment and storage medium | |
CN110750399A (en) | Serial port error rate testing method and device, computer equipment and readable storage medium | |
CN109450607A (en) | A kind of calibration of baud rate and device of UART Universal Asynchronous Receiver Transmitter | |
CN109256998A (en) | Control the method and system and servo motor of current of electric sampling with high precision | |
CN105162543A (en) | Device and method used for SDH (Synchronous Digital Hierarchy) clock jitter test |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |