CN102315983B - Circuit and method for automatically detecting Baud rate of multiple paths of serial communication interfaces - Google Patents
Circuit and method for automatically detecting Baud rate of multiple paths of serial communication interfaces Download PDFInfo
- Publication number
- CN102315983B CN102315983B CN201010614318.0A CN201010614318A CN102315983B CN 102315983 B CN102315983 B CN 102315983B CN 201010614318 A CN201010614318 A CN 201010614318A CN 102315983 B CN102315983 B CN 102315983B
- Authority
- CN
- China
- Prior art keywords
- baud rate
- baud
- speed counter
- serial communication
- circuit
- 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
Links
Images
Abstract
The invention relates to the field of industrial control in the field of communication, in particular to a method for automatically detecting a Baud rate of multiple paths of serial communication interfaces and a circuit for realizing the method. In the invention, automatic detection of the Baud rate of the multiple paths of serial communication interfaces is realized by depending on automatic Baud rate detection capacity and mechanism for realizing software flow control by using an LPC23xx chip. The communication Baud rate is set by an automatic Baud rate functional part of the LPC23xx chip through measuring time consumed by a bit of receiving a data stream. The circuit is suitable for occasions for carrying out serial communication at a standard Baud rate or non-standard Baud rate.
Description
Technical field
The present invention relates to the industrial control field in communication field, adopt circuit and the implementation method of multi-path serial communication auto-baud.
Background technology
In industrial control system and in some other equipment; often can use the serial communication interfaces such as RS-232/RS-485 as control desk or monitor-interface; in use, do not know sometimes communication apparatus work baud rate and the running parameter of system cannot be correctly set.Whenever running into this situation, conventional method is look for specification to check or look for designer to inquire or attempt one by one conventional baud rate, and this method has been brought a lot of inconvenience to the use of communication apparatus.
And existing serial communication interface baud rate auto detection device, device circuit complexity also only can only have a serial communication interface mostly, and this situation will be difficult to adapt to day by day complicated industrial control field.
Summary of the invention
The object of this invention is to provide a kind of Multi-path serial communication interface baud rate automatic-detection circuit and detection method thereof, requirement circuit is simple, serial communication auto-baud is mainly to rely on the soft of LPC23xx logical device that realization is set, and can detect a plurality of serial communication interfaces.The work baud rate that unknown communication apparatus can fast and easy be detected, facilitates the use of communication apparatus.
To achieve these goals, the invention provides a kind of multi-path serial communication interface baud rate testing circuit.This circuit is comprised of programmable LPC23XX logical device, 2 tunnel RS-232 interface circuit and 2 road RS-485 interface circuits, it is characterized in that, 2 road serial ports port respectively with 2 tunnel RS-232 interface circuit of LPC23XX logical device are connected, other 2 road serial ports port respectively with 2 road RS-485 interface circuits are connected, and the transmitting-receiving control end of 2 road RS-485 chips is controlled by the output pin of LPC23XX logical device; Described LPC23XX logical device, by above-mentioned RS232 or RS485 chip and external equipment communication, according to the information of receiving, relies on soft setting of LPC23xx logical device to realize the communication baud rate that automatically detects interface.Auto-baud control register, speed counter, shift register, divisor latch and the pre-frequency division of decimal Baud rate generator in described LPC23XX logical device, have been configured.Described auto-baud control register forms by starting baud rate detected register, detecting pattern mask register, the overtime register that restarts.In described LPC23XX logical device, each component function effect of configuration is as follows:
Start baud rate detected register, for starting auto-baud-detect;
Detecting pattern mask register, for selecting baud rate detection mode.
Speed counter, for the speed of count detection baud rate.
Shift register, storage shifted data, produces high bit rate.
The overtime register that restarts, while overflowing for speed counter, restarts auto-baud and measures.
Divisor latch, for the measured value of speed counter is set, realizes circuit communication baud rate consistent with tested baud rate.
Fractional frequency division register, measures for affecting baud rate, is forbidding when auto-baud is measured.
Multi-path serial communication interface baud rate automatic-detection circuit of the present invention, for the terminal of serial communication.And when communication starts, circuit starts measurement baud rate automatically, and baud rate and end are set.The method that Multi-path serial communication interface baud rate automatic-detection circuit of the present invention carries out automatically detecting to multi-path serial communication interface baud rate comprises the steps:
1) initial baud rate register set, speed counter resets, reset shift register to switch baud rate be flank speed.
2) shift register is accepted start bit, and speed counter starts to calculate;
3) shift register is accepted character lowest order, and speed counter stops calculating;
4), according to speed counter numerical value, divisor latch is set;
5) initial baud rate register zero clearing, baud rate will automatically switch into normal mode;
6) if speed counter overflows midway, restart auto-baud, speed measurement will start to calculate from next bit.
In said method, baud rate detects logic step and comprises:
1) speed counter resets, reset shift register, and baud rate is moved with flank speed.
2) judgement receives start bit trailing edge, if start speed counter counting.
3) judgement receives the trailing edge of zero-bit, if stop rate calculator counting.
4) pack speed counter count value into divisor latch.
5) if speed counter overflows midway, restart auto-baud, speed measurement also starts to calculate from the trailing edge of next bit.
The present invention has increased communication auto-baud-detect circuit on original serial communication basis, by realizing automatic communication baud rate with coordinating of 2 tunnel RS-232 interface circuit and 2 road RS-485 interface circuits, configure, realized while docking with the communication apparatus of unknown baud rate, the communication baud rate of source device can be detected easily and fast, and self communication baud rate is arranged, realize proper communication.Its multichannel baud rate auto detection arranges function, can realize carrying out baud rate with a plurality of random communication equipment and mating, and conveniently realizes data communication, to work on the spot, has brought very large convenience.
Accompanying drawing explanation
Fig. 1 is Multi-path serial communication interface baud rate automatic-detection circuit of the present invention.
Fig. 2 is Multi-path serial communication interface baud rate automatic-detection circuit oscillogram of the present invention.
Fig. 3 is Multi-path serial communication interface baud rate automatic-detection circuit logic working flow chart of the present invention.
Embodiment
Be illustrated in figure 1 a kind of instantiation of Multi-path serial communication interface baud rate automatic-detection circuit of the present invention, as known in the figure, this circuit comprises a PLC23XX logical device, 2 tunnel RS-232 interface circuit and 2 road RS-485 interface circuits, disposes and start baud rate detected register 2, detecting pattern mask register 3, the overtime pre-frequency division 7 of register 5, speed counter 4, shift register 1, divisor latch 6 and decimal Baud rate generator that restarts in described PLC23XX logical device.
Start baud rate detected register 2, for starting auto-baud-detect, if auto-baud completes, this automatic clear.
Detecting pattern mask register 3, for selecting baud rate detection mode.The moving baud rate of this serial communication oneself has two kinds of auto-baud measurement patterns, and user can select by detecting pattern mask register 3.In pattern 0, baud rate is measured (described in Fig. 2) at two continuous trailing edges (trailing edge of start bit and the trailing edge of lowest order) of Rx.In pattern 1, baud rate is at the trailing edge of Rx pin with immediately following (length of start bit) measurement between rising edge thereafter.
Speed counter 4 is for the speed of count detection baud rate.When start bit trailing edge, start counting.
Shift register 1, after start bit set, starts to store shifted data, produces high bit rate.
The overtime register 5 that restarts, while overflowing for speed counter, restarts auto-baud and measures.
Divisor latch 6, for the measured value of speed counter is set, realizes circuit communication baud rate consistent with tested baud rate.
The pre-frequency division 7 of decimal Baud rate generator, affects baud rate and measures, and generally when auto-baud is measured, forbids.
The above-mentioned Multi-path serial communication interface baud rate automatic-detection circuit course of work is as follows:
1) start 2 start bit one set of baud rate detected register, speed counter just will reset, and shift register 1 resets simultaneously.Shift register 1 baud rate switches to the highest speed.
2) Rx pin trailing edge triggers the beginning of start bit.Speed counter 4 will start clock (can select by the pre-frequency division 7 of decimal Baud rate generator) to count.
3) in receiving the process of start bit, shift register 1 baud rate input produces 16 pulses, pulse frequency is identical with the serial asynchronous communication clock of (by the pre-frequency division 7 of decimal Baud rate generator), like this, has guaranteed that start bit leaves in shift register 1.
4), in receiving the process of start bit, speed counter 4 increases progressively the serial asynchronous communication input clock along with the pre-frequency division of quilt.
5), in pattern 0, speed counter 4 stops the next trailing edge at Rx pin so.
The value of speed counter 4 is loaded into divisor latch 6, and baud rate will automatically switch to normal manipulation mode.
Claims (5)
1. a Multi-path serial communication interface baud rate automatic-detection circuit, this circuit is comprised of programmable LPC23XX logical device, 2 tunnel RS-232 interface circuit and 2 road RS-485 interface circuits, it is characterized in that, 2 road serial ports port respectively with 2 tunnel RS-232 interface circuit of described LPC23XX logical device are connected, other 2 road serial ports port respectively with 2 road RS-485 interface circuits are connected, and the transmitting-receiving control end of 2 road RS-485 chips is controlled by the output pin of LPC23XX logical device; Described LPC23XX logical device, by RS-232 or RS-485 chip and external equipment communication, according to the information of receiving, relies on soft setting of LPC23XX logical device to realize the communication baud rate that automatically detects interface; In described LPC23XX logical device, dispose:
Start baud rate detected register, for starting auto-baud-detect;
Detecting pattern mask register, for selecting baud rate detection mode;
Speed counter, for the speed of count detection baud rate;
Shift register, storage shifted data, produces high bit rate;
The overtime register that restarts, while overflowing for speed counter, restarts auto-baud and measures;
Divisor latch, for the measured value of speed counter is set, realizes circuit communication baud rate consistent with tested baud rate;
Fractional frequency division register, measures for affecting baud rate, is forbidding when auto-baud is measured.
2. Multi-path serial communication interface baud rate automatic-detection circuit according to claim 1, is characterized in that, when communication starts, circuit starts measurement baud rate automatically, and baud rate and end are set.
3. Multi-path serial communication interface baud rate automatic-detection circuit according to claim 1 and 2, is characterized in that, described circuit is for the terminal of serial communication.
4. the multi-path serial communication interface baud rate auto detection method based on Multi-path serial communication interface baud rate automatic-detection circuit claimed in claim 1, is characterized in that: the method comprises the steps:
(1) start the set of baud rate detected register, speed counter resets, reset shift register to switch baud rate be flank speed;
(2) shift register receives start bit, and speed counter starts to calculate;
(3) shift register receives character lowest order, and speed counter stops calculating;
(4), according to speed counter numerical value, divisor latch is set;
(5) start the zero clearing of baud rate detected register, baud rate will automatically switch into normal mode;
(6) if speed counter overflows midway, restart auto-baud-detect, speed measurement will start to calculate from next bit.
5. multi-path serial communication interface baud rate auto detection method as claimed in claim 4, is characterized in that: baud rate auto detection step comprises:
1) speed counter resets, reset shift register, and baud rate is moved with flank speed;
2) judgement receives start bit trailing edge, if so, starts speed counter counting;
3) judgement receives the trailing edge of lowest order, if so, stops speed counter counting;
4) pack speed counter count value into divisor latch;
5) if speed counter overflows midway, restarts auto-baud-detect, speed measurement also starts to calculate from the trailing edge of next bit.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010614318.0A CN102315983B (en) | 2010-12-30 | 2010-12-30 | Circuit and method for automatically detecting Baud rate of multiple paths of serial communication interfaces |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201010614318.0A CN102315983B (en) | 2010-12-30 | 2010-12-30 | Circuit and method for automatically detecting Baud rate of multiple paths of serial communication interfaces |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102315983A CN102315983A (en) | 2012-01-11 |
CN102315983B true CN102315983B (en) | 2014-05-07 |
Family
ID=45428820
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201010614318.0A Expired - Fee Related CN102315983B (en) | 2010-12-30 | 2010-12-30 | Circuit and method for automatically detecting Baud rate of multiple paths of serial communication interfaces |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102315983B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103514127A (en) * | 2012-06-15 | 2014-01-15 | 中国航天科工集团第三研究院第八三五八研究所 | Implementation method for achieving self-adaption of baud rate |
CN103888308B (en) * | 2012-12-20 | 2018-04-20 | 南通研祥智能科技有限公司 | Serial ports test method, system and device |
CN106708769B (en) * | 2015-07-16 | 2019-08-06 | 北京谊安医疗系统股份有限公司 | A kind of adaptive serial interface circuit |
CN105553628B (en) * | 2015-12-05 | 2018-11-16 | 中国航空工业集团公司洛阳电光设备研究所 | A kind of serial communication baud rate detection method and device |
CN109283919A (en) * | 2018-11-15 | 2019-01-29 | 厦门嘉裕德汽车电子科技有限公司 | A kind of method that switch test board baud rate realizes controller test communication |
CN110266405A (en) * | 2019-05-10 | 2019-09-20 | 珠海格力电器股份有限公司 | Device talk deviation of signal detection system |
CN110287073B (en) * | 2019-06-27 | 2023-03-24 | 中国兵器工业集团第二一四研究所苏州研发中心 | Testing device and method for multiple asynchronous serial communication peripherals |
CN111224837B (en) * | 2019-11-25 | 2020-11-13 | 上海星融汽车科技有限公司 | Method and system for automatically identifying CAN communication baud rate of vehicle ECU |
CN111459727B (en) * | 2019-12-25 | 2023-07-14 | 山东有人物联网股份有限公司 | Intelligent automatic test system and method for serial port baud rate maximum error-free tolerance range |
CN112821985B (en) * | 2020-12-31 | 2021-11-30 | 珠海格力电器股份有限公司 | Control method and control device of encoder, servo motor and encoder |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1035898A (en) * | 1989-01-26 | 1989-09-27 | 复旦大学 | A kind of method and device of realizing that the serial port baud rate detects and is provided with automatically |
CN1838650A (en) * | 2006-04-19 | 2006-09-27 | 武汉虹信通信技术有限责任公司 | Apparatus and method for realizing real-time detection practical communication baud rate |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB0414793D0 (en) * | 2004-07-01 | 2004-08-04 | Ttp Communications Ltd | Determining characteristics of communications signals |
-
2010
- 2010-12-30 CN CN201010614318.0A patent/CN102315983B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1035898A (en) * | 1989-01-26 | 1989-09-27 | 复旦大学 | A kind of method and device of realizing that the serial port baud rate detects and is provided with automatically |
CN1838650A (en) * | 2006-04-19 | 2006-09-27 | 武汉虹信通信技术有限责任公司 | Apparatus and method for realizing real-time detection practical communication baud rate |
Also Published As
Publication number | Publication date |
---|---|
CN102315983A (en) | 2012-01-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102315983B (en) | Circuit and method for automatically detecting Baud rate of multiple paths of serial communication interfaces | |
CN105379120B (en) | It is detected using Δ/Σ conversion capacitive proximity | |
CN102467477B (en) | Baud rate self-adapting Modbus relay and Baud rate self-adapting system and method | |
CN103837741B (en) | Equally accurate frequency testing system based on FPGA and method for designing thereof | |
CN105245203B (en) | High-precision low-speed clock duty ratio detecting system and method | |
CN103487649B (en) | Method and device capable of measuring both frequency of continuous waves and frequency of pulse modulation carrier waves | |
CN105116318B (en) | A kind of method that burr detection is realized in logic analyser | |
CN109217951A (en) | A kind of transmission delay test method and device based on FPGA | |
CN107782964A (en) | Alternative output pulse signal frequency and measuring system, the measuring method counted | |
CN203250170U (en) | Inverter operation panel of knob encoder | |
CN202794346U (en) | Pulse width detection circuit | |
CN106603099A (en) | Single-bit receiver signal detection method based on probability calculations | |
CN203929885U (en) | Based on FPGA etc. precision frequency testing system | |
CN102457268B (en) | Implementation method for 32-bit capture register | |
CN202004778U (en) | Multi-path serial communication interface baud rate automatic-detection circuit | |
CN105553628A (en) | Method and device for detecting serial communication baud rate | |
CN104483544A (en) | High-accuracy frequency/cycle measuring method of single-channel counter | |
CN1333529C (en) | Clock signal detection method and apparatus in electronic devices | |
CN204595157U (en) | A kind of multifunctional integrated circuit tester | |
CN103869155B (en) | Method and device for electric generator frequency measurement based on PLC high-speed input | |
CN104215307B (en) | Double sprocket pulse interpolation counters and its implementation for flow standard device | |
CN202661573U (en) | Capacitance and inductance measurement circuit | |
CN205280898U (en) | Improved generation logic chip detector | |
CN104467753B (en) | Jump edge detection method and device with glitches capable of being removed | |
CN106953630A (en) | For mercury ion Microwave Frequency target high-speed pulse signal-count devices and methods therefor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C56 | Change in the name or address of the patentee | ||
CP01 | Change in the name or title of a patent holder |
Address after: Hangzhou City, Zhejiang province 310003 city on the River Road No. 222, room 701 international sea level Patentee after: Hangzhou hash Environment Technology Co., Ltd. Address before: Hangzhou City, Zhejiang province 310003 city on the River Road No. 222, room 701 international sea level Patentee before: Hangzhou Dingli Environmental Technology Co., Ltd. |
|
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20140507 Termination date: 20181230 |