CN106569032B - A kind of detection method of signal frequency and duty ratio based on embedded microcontroller - Google Patents

A kind of detection method of signal frequency and duty ratio based on embedded microcontroller Download PDF

Info

Publication number
CN106569032B
CN106569032B CN201610905453.8A CN201610905453A CN106569032B CN 106569032 B CN106569032 B CN 106569032B CN 201610905453 A CN201610905453 A CN 201610905453A CN 106569032 B CN106569032 B CN 106569032B
Authority
CN
China
Prior art keywords
pulse signal
measured pulse
timer
frequency
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610905453.8A
Other languages
Chinese (zh)
Other versions
CN106569032A (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.)
Changsha Kaiyuan Instruments Co Ltd
Original Assignee
Changsha Kaiyuan Instruments Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changsha Kaiyuan Instruments Co Ltd filed Critical Changsha Kaiyuan Instruments Co Ltd
Priority to CN201610905453.8A priority Critical patent/CN106569032B/en
Publication of CN106569032A publication Critical patent/CN106569032A/en
Application granted granted Critical
Publication of CN106569032B publication Critical patent/CN106569032B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R23/00Arrangements for measuring frequencies; Arrangements for analysing frequency spectra
    • G01R23/02Arrangements for measuring frequency, e.g. pulse repetition rate; Arrangements for measuring period of current or voltage
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01RMEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
    • G01R29/00Arrangements for measuring or indicating electric quantities not covered by groups G01R19/00 - G01R27/00
    • G01R29/02Measuring characteristics of individual pulses, e.g. deviation from pulse flatness, rise time or duration

Abstract

The detection method of signal frequency and duty ratio provided by the invention based on embedded microcontroller, the measurement period of signal is determined according to the demand of embedded system, it is enabled that enabled and Interruption is interrupted using the capture of the timer of central processing unit simultaneously, capture the characteristic value when adjacent rising edges arrival of measured pulse signal and characteristic value when failing edge reaches in the same period, the characteristic value of adjacent rising edges is compared operation, obtain the frequency values of measured pulse signal, characteristic value when failing edge is reached with rising edge is compared, to which the duty ratio of measured pulse signal be calculated, simultaneously, the characteristic value captured also only carries out a frequency measuring process to judge and control within a frequency measurement period.The frequency range of the very big measured pulse signal for extending embedded microcontroller of the present patent application, simplify the measurement method of the frequency of the measured pulse signal changed in wider frequency range, reduce the CPU usage of system, additionally it is possible to while measuring the duty ratio of measured pulse signal.

Description

A kind of detection method of signal frequency and duty ratio based on embedded microcontroller
Technical field
The present invention relates to the frequency detecting technologies of micro- electric impulse signal, more particularly, to based on embedded microcontroller Signal frequency detection method.
Background technique
In automation, intelligent today deeply developed, many signals are related to the measurement of digital waveform, including frequency with account for Empty ratio.It the use of the frequency and duty ratio of embedded microcontroller measurement square wave is a kind of most popular mode.Due to signal Frequency from high to low, range is extremely wide, currently, general mode be high-frequency signal measured using the mode of counting, and Low frequency signal is measured using the mode of timing, presets measurement method according to the actual situation.
It when measuring low frequency signal, is counted using rising signals of the timer clock to signal, calculates one week of waveform The quantity of timer count signal in phase, it is known that the frequency of timer can calculate the cycle T of signal, to obtain frequency Rate value.
When low frequency signal uses chronometry measurement frequency, the general mode for using Interruption, if thering is high-frequency signal to connect at this time Enter, interruption occupies a large amount of central processing unit runing time, and system may can not be jumped out in the interruption of long period, be given The stability of system brings more risk.
When measuring high-frequency signal, then several waveforms of continuous counter by the way of counting calculate several waves The time that shape is spent in total, then the period of a complete waveform is calculated, to obtain frequency.But counting procedure generally compares Complexity, and the quantity counted is difficult to determine.Because the range of high-frequency signal is wider, the highest threshold values and minimum valve of actual measurement Time of measuring between value is widely different.For example, it is assumed that signal is 1KHz~8KHz, counting is assumed to be 100, then measures 8KHz The response time needed when signal is 1.25ms, and the response time that 1KHz signal needs is 10ms.Therefore, in the process of development The quantity for needing micro-judgment to count.
And high-frequency signal is measured using the mode of counting method, if high frequency shelves have low frequency signal to access such as 20Hz, need 5S could count full 100 pulses, and the time of response is very long.
Different measurement methods is selected according to the different frequency range of signal, such mode is easy to use, and it is reliable convenient, but In the case where unknown object frequency range, there is certain limitation.Under normal conditions, the threshold values of preset high frequency and low frequency must It must be overlapped, when measured signal is near threshold signal, be easy to produce the mistake of counting method and chronometry switching, and bad boundary Determine critical frequency.The misconnection or when having more than the signal of measurement range in port, central processing unit may lose response or Person's collapse, influences the stability of system.In addition, both methods is unable to measuring signal duty ratio.
Summary of the invention
The present invention provide it is a kind of overcome the above problem or at least be partially solved the above problem based on embedded micro-control The signal frequency detection method of device processed.
According to an aspect of the present invention, a kind of letter based on embedded microcontroller adapting to wider frequency range is provided The detection method of number frequency, receives and processes measured pulse signal by central processing unit, and according to the need of embedded system The measurement period for seeking determining signal, within a frequency measurement period, specific measuring process is as follows:
S1, the Interruption that central processing element timer is arranged are enabled and capture is interrupted and enabled;
S2, when a complete waveform of measured pulse signal first rising edge arrive when, timer capture interruption make Can, external interrupt is triggered, central processing unit obtains and records the First Eigenvalue of measured pulse signal;
S3, when a complete waveform of measured pulse signal second rising edge arrive when, timer capture interruption make Can, trigger external interrupt, the Second Eigenvalue of the system timer record measured pulse signal of central processing unit;
An impulsive measurement process is completed in S4, confirmation;
Close capture and interrupt enabled, the Second Eigenvalue is compared operation with the First Eigenvalue, be calculated by Survey the frequency values of pulse signal.
Within a frequency measurement period, by directly measuring the period of a complete waveform, and controls and only carry out one Frequency measuring process while extension frequency measurement range, simplifies the pulse signal that occurrence frequency changes in wider range Frequency measurement mode.
According to another aspect of the present invention, the application proposes a kind of while detecting the signal based on embedded microcontroller The detection method of frequency and duty ratio receives and processes measured pulse signal by central processing unit, and according to embedded system The demand of system determines the measurement period of signal, and within a frequency measurement period, specific measuring process is as follows:
SS1, the Interruption that central processing element timer is arranged are enabled and capture is interrupted and enabled;
SS2, when a complete waveform of measured pulse signal first rising edge arrive when, timer capture interruption make Can, external interrupt is triggered, the third feature value of measured pulse signal is obtained by central processing unit and recorded;
SS3, when a complete waveform of measured pulse signal first failing edge arrive when, timer capture interruption make Can, external interrupt is triggered, by the fourth feature value of the system timer record measured pulse signal of central processing unit;
SS4, when a complete waveform of measured pulse signal second rising edge arrive when, timer capture interruption make Can, external interrupt is triggered, by the fifth feature value of the system timer record measured pulse signal of central processing unit;
An impulsive measurement process is completed in SS5, confirmation;
Close capture and interrupt enabled, the fourth feature value is compared operation with third feature value, be calculated by Survey the dutyfactor value of pulse signal;
The fifth feature value is compared operation with third feature value, the frequency of measured pulse signal is calculated Value.
Within a frequency measurement period, by directly measuring the period of a complete waveform, and controls and only carry out one Frequency measuring process while extension frequency measurement range, can also measure the duty ratio of measured pulse signal simultaneously.
Detection method provided by the present application based on embedded microcontroller signal frequency and duty ratio, its advantages are such as Under:
(1) by predeterminated frequency measurement period, and using the timestamp of system beat timing, directly measurement measured pulse letter The period of a number complete waveform and the frequency that signal is calculated, greatly expand the frequency range of measuring signal, also, institute It is simple to be related to control program;
(2) it when measuring high-frequency signal, avoids using complicated counting method control program, and adjustment is high repeatedly by rule of thumb The trouble of frequency signal-count value;
(3) low frequency signal and high-frequency signal are measured, using identical measurement method, without in different measurement methods or difference It is switched between port;
(4) it avoids low-speed port misconnection high-speed port from leading to the risk of system in case of system halt, it is low to also avoid high-speed port misconnection Response speed becomes extremely long problem when fast port;
(5) by predeterminated frequency measurement period, the measurement process of a secondary frequencies is only carried out within a frequency measurement period;
(6) by recording or being arranged rising edge or failing edge arrival state when, judges measured pulse signal one completely The completion status or the completion status in a frequency measurement period of wave period measurement;
It (7), can be with the duty ratio of measuring signal while measuring signal frequency.
Detailed description of the invention
Fig. 1 is according to the structural schematic diagram in the embodiment of the present invention;
Fig. 2 is according to the structural schematic diagram in the embodiment of the present invention.
Specific embodiment
With reference to the accompanying drawings and examples, specific embodiments of the present invention will be described in further detail.Implement below Example is not intended to limit the scope of the invention for illustrating the present invention.
Shown in Figure 1, a kind of signal frequency detection method based on embedded microcontroller is connect by central processing unit Measured pulse signal, and the default measurement period that signal is determined according to the demand of embedded system are received and handle, in a frequency In measurement period, specific measurement process the following steps are included:
S1, the Interruption that central processing element timer is arranged are enabled and capture is interrupted and enabled;
S2, when a complete waveform of measured pulse signal first rising edge arrive when, timer capture interruption make Can, external interrupt is triggered, central processing unit obtains and records the First Eigenvalue of measured pulse signal;
S3, when a complete waveform of measured pulse signal second rising edge arrive when, timer capture interruption make Can, trigger external interrupt, the Second Eigenvalue of the system timer record measured pulse signal of central processing unit;
An impulsive measurement process is completed in S4, confirmation;
Close capture and interrupt enabled, the Second Eigenvalue is compared operation with the First Eigenvalue, be calculated by Survey the frequency values of pulse signal.
When starting to measure the frequency of measured pulse signal, the capture that central processing unit is arranged, which is interrupted, to be enabled, And after the frequency measurement for completing a complete waveform, close capture interrupt it is enabled, make within a frequency measurement period only into One frequency measuring process of row.It effectively avoids when carrying out frequency measurement using timing or counting mode, due to high frequency and low The phenomenon that variation of frequency signal is converted and leads to system in case of system halt or response time overlength.Both reach measurement measured pulse signal frequency Purpose, meanwhile, and significantly reduce the computational burden of central processing unit, improve the operation effect of central processing unit Rate.
In addition, in measurement frequency being realized by the direct measurement to a complete waveform of measured pulse signal , therefore, in measurement process, when the frequency of measured pulse signal is widely varied, does not need to convert accordingly and survey Amount method, to greatly expand the frequency range of measured pulse signal.Pulse to frequency range in 1Hz~1MHz is believed Number, without changing any measurement method, can directly measure.
" the First Eigenvalue " in above-mentioned steps S2 is the upper of timer value 1, the timestamp 1 of system beat timing and waveform The raising of indices knows 1.
" Second Eigenvalue " in above-mentioned steps S3 is the timestamp 2 of timer value 2 and system beat timing.
When the rising edge of measured pulse signal reaches, timer capture interrupts enabled, triggering external interrupt, at this point, together When recording timer value, system beat timing timestamp and rise mark, and capture in matched comparand register.
Capture and record to three kinds of characteristic values, can more accurately determine that measured pulse signal rising edge reaches when It carves, meanwhile, it is also convenient for the judgement of the completion status and the completion status in a frequency measurement period to an impulsive measurement.
To the specific steps of the confirmation of a frequency measurement period completion status in above-mentioned steps S4 are as follows:
S41, when a complete waveform of measured pulse signal first rising edge arrive when, be recorded as rise mark 1;
S42, when a complete waveform of measured pulse signal second rising edge arrive when, central processing unit judgement Rise and identify whether to be 1, if 1, determine that an impulsive measurement process has been completed, and the rising being arranged at this time is identified as 2, into Row comparison operation;
S43, when the value of timer rises to the system beat period, the Interruption of timer is enabled, triggers system It interrupts, the value of timer is cleared, and judges the rising mark of central processing unit record, if 1, enters step S42;If 2, determine that an impulsive measurement process is over, mark will be risen and be set as 0, wait and enter next frequency measurement period, after Continuous step S1.
By judging the state for rising mark, a completed wave of measured pulse signal both can have accurately been captured Shape can be used for the completion status for determining an impulsive measurement process, make one accurately to measure the frequency of the pulse signal A frequency measuring process is only carried out in a frequency measurement period.
Meanwhile when the value of timer rises to the system beat period, the value of timer will be cleared, and can be removed in time The record of redundant data saves the memory space of central processing unit.
The comparison calculation of frequency values in above-mentioned steps are as follows:
Calculate the difference a of timer value 2 and timer value 1;
The difference b of the timestamp 1 of the timestamp 2 and system beat timing of computing system beat timing;
According to difference a and difference b's and, period of you can get it measured pulse signal, and then measured pulse is calculated The frequency values of signal.
In another embodiment, shown in Figure 2, a kind of signal frequency based on embedded microcontroller is provided and is accounted for The detection method of empty ratio receives and processes measured pulse signal by central processing unit, and according to the demand of embedded system The measurement period for determining signal, within a frequency measurement period, specific measuring process is as follows:
SS1, the Interruption that central processing element timer is arranged are enabled and capture is interrupted and enabled;
SS2, when a complete waveform of measured pulse signal first rising edge arrive when, timer capture interruption make Can, external interrupt is triggered, the third feature value of measured pulse signal is obtained by central processing unit and recorded;
SS3, when a complete waveform of measured pulse signal first failing edge arrive when, timer capture interruption make Can, external interrupt is triggered, by the fourth feature value of the system timer record measured pulse signal of central processing unit;
SS4, when a complete waveform of measured pulse signal second rising edge arrive when, timer capture interruption make Can, external interrupt is triggered, by the fifth feature value of the system timer record measured pulse signal of central processing unit;
An impulsive measurement process is completed in SS5, confirmation;
Close capture and interrupt enabled, the fifth feature value is compared operation with third feature value, be calculated by Survey the frequency values of pulse signal;
The fourth feature value is compared operation with third feature value, the duty ratio of measured pulse signal is calculated Value.
By to rising edge and failing edge arrival at the time of and state capture, measured pulse signal can be obtained simultaneously Pulse width and period.
When starting to measure the frequency of measured pulse signal, the capture that central processing unit is arranged, which is interrupted, to be enabled, And after the frequency measurement for completing a complete waveform, close capture interrupt it is enabled, make within a frequency measurement period only into One frequency measuring process of row.It effectively avoids when carrying out frequency measurement using timing or counting mode, due to high frequency and low The phenomenon that variation of frequency signal is converted and leads to system in case of system halt or response time overlength.Both reach measurement measured pulse signal frequency Purpose, meanwhile, and significantly reduce the computational burden of central processing unit, improve the operation effect of central processing unit Rate.
In addition, in measurement frequency being realized by the direct measurement to a complete waveform of measured pulse signal , therefore, in measurement process, when the frequency of measured pulse signal is widely varied, does not need to convert accordingly and survey Amount method, to greatly expand the frequency range of measured pulse signal.It is in the timer running frequency of embeded processor In the case where 100MHz, to frequency range 1Hz~1MHz pulse signal, without changing any measurement method Directly measure.The precision of frequency measurement is within 2% in the case where the most limit.If the timer of embeded processor is transported Line frequency faster, can measure broader range.
" third feature value " in above-mentioned steps SS2 is timer value 3, the timestamp 3 of system beat timing and waveform Rise mark 1.
" fourth feature value " in above-mentioned steps SS3 is timer value 4, the timestamp 4 of system beat timing and waveform Decline mark 1.
" fifth feature value " in above-mentioned steps SS4 is the timestamp 5 of timer value 5 and system beat timing.
When the rising edge of measured pulse signal or failing edge reach, timer capture interrupts enabled, triggering external interrupt, At this point, simultaneously recording timer value, system beat timing timestamp and rise or fall mark, can more accurately determine At the time of measured pulse signal rising edge or failing edge reach, meanwhile, it is also convenient for the completion status and frequency to an impulsive measurement The judgement of the completion status of rate measurement period.
To the specific steps of the confirmation of a frequency measurement period completion status in above-mentioned steps SS5 are as follows:
SS51, when a complete waveform of measured pulse signal first rising edge arrive when, be recorded as rise mark 1;
SS52, when a complete waveform of measured pulse signal first failing edge arrive when, be recorded as decline mark 1;
SS53, when a complete waveform of measured pulse signal second rising edge arrive when, central processing unit is sentenced It is disconnected to rise mark or decline identifies whether to be 1, if 1, determine that an impulsive measurement process has been completed, and at this time upper is set It rises and is identified as 2, be compared operation;
SS54, when the value of timer rises to the system beat period, it is into system break, the value of timer is clear Zero, and judge the rising mark of central processing unit record, if 1, enter step SS53;If 2, an impulsive measurement is determined Process is over, and will be risen mark and is set as 0, waits the measurement period for entering next frequency and duty ratio, return step SS1。
By judging the state for rising or falling mark, the pulse of measured pulse signal both can be accurately captured Width and a complete waveform can be used for determining an impulsive measurement accurately to measure the frequency of the pulse signal at this time The completion status of process.
Meanwhile when the value of timer rises to the system beat period, the value of timer will be cleared, and can be removed in time The record of redundant data saves the memory space of central processing unit.
The comparison operation mode of frequency values in above-mentioned steps are as follows:
Calculate the difference c of timer value 5 and timer value 3;
The difference d of the timestamp 3 of the timestamp 5 and system beat timing of computing system beat timing;
According to difference c and difference d's and, the period A of you can get it measured pulse signal, and then measured pulse is calculated The frequency values B of signal.
The comparison operation mode of dutyfactor value in above-mentioned steps are as follows:
Calculate the difference e of timer value 4 and timer value 3;
The difference f of the timestamp 3 of the timestamp 4 and system beat timing of computing system beat timing;
By the sum of difference e and difference f, the pulse width C of measured pulse signal is obtained;
By pulse width C and period A, the dutyfactor value of measured pulse signal is calculated.
The detection method of signal frequency provided by the present application based on embedded microcontroller, according to the need of embedded system The measurement period of determining signal is sought, while the capture of application timer is interrupted enabled and Interruption and enabled, and measured pulse is captured The characteristic value when adjacent rising edges of signal reach, and the characteristic value of adjacent rising edges is compared operation, obtain tested arteries and veins Rush the frequency values of signal.
Also, the characteristic value that application captures, the completion status and the completion shape in frequency measurement period of determination frequency measurement State, so that control within a frequency measurement period, as soon as completing a frequency measuring process, no longer carries out frequency measurement, until Into next frequency measurement period.
The detection method of signal frequency and duty ratio provided by the present application based on embedded microcontroller, according to embedded The demand of system determines the measurement period of signal, while the capture of application timer is interrupted enabled and Interruption and enabled, and captures The characteristic value when adjacent rising edges of measured pulse signal reach and the characteristic value in the same period when failing edge arrival, and The characteristic value of adjacent rising edges is compared operation, the frequency values of measured pulse signal is obtained, failing edge and rising edge is arrived Up to when characteristic value be compared, so that the duty ratio of measured pulse signal be calculated.
Also, the characteristic value that application captures, the completion status and the completion shape in frequency measurement period of determination frequency measurement State, so that control within a frequency measurement period, as soon as completing a frequency measuring process, no longer carries out frequency measurement, until Into next frequency measurement period.
Finally, the present processes are only preferable embodiment, it is not intended to limit the scope of the present invention.It is all Within the spirit and principles in the present invention, any modification, equivalent replacement, improvement and so on should be included in protection of the invention Within the scope of.

Claims (5)

1. a kind of signal frequency detection method based on embedded microcontroller, which is characterized in that received by central processing unit And measured pulse signal is handled, and the measurement period of signal is determined according to the demand of embedded system, a frequency measurement week In phase, specific measuring process is as follows:
S1, the Interruption that central processing element timer is arranged are enabled and capture is interrupted and enabled;
S2, when first rising edge of a complete waveform of measured pulse signal arrives, timer capture interrupts enabled, touching External interrupt is sent out, central processing unit obtains and records the First Eigenvalue of measured pulse signal;
S3, when second rising edge of a complete waveform of measured pulse signal arrives, timer capture interrupts enabled, touching Send out external interrupt, the Second Eigenvalue of the system timer record measured pulse signal of central processing unit;
An impulsive measurement process is completed in S4, confirmation;
Close capture and interrupt enabled, the Second Eigenvalue is compared operation with the First Eigenvalue, calculate timer value 2 and The difference a of timer value 1, the difference b of the timestamp 1 of the timestamp 2 and system beat timing of computing system beat timing, according to Difference a and difference b's and, obtain the period of measured pulse signal, the frequency values of measured pulse signal be calculated;
Wherein, the First Eigenvalue is the rising mark 1 of timer value 1, the timestamp 1 of system beat timing and waveform;Institute State the timestamp 2 that Second Eigenvalue is timer value 2 and system beat timing.
2. a kind of signal frequency detection method based on embedded microcontroller as claimed in claim 1, it is characterised in that: step S4 In " confirmation " specific steps are as follows:
S41, when a complete waveform of measured pulse signal first rising edge arrive when, be recorded as rise mark 1;
S42, when a complete waveform of measured pulse signal second rising edge arrive when, central processing unit judgement rise Identify whether to be 1, if 1, determine that an impulsive measurement process has been completed, and the rising being arranged at this time is identified as 2, is compared Compared with operation;
S43, when the value of timer rises to the system beat period, into system break, the value of timer is reset, and sentences The rising mark of disconnected central processing unit record,
If 1, S42 is entered step;
If 2, determine that an impulsive measurement process is over, mark will be risen and be set as 0, wait and enter next frequency measurement Period, return step S1.
3. a kind of detection method of signal frequency and duty ratio based on embedded microcontroller is received simultaneously by central processing unit Measured pulse signal is handled, and determines the measurement period of signal according to the demand of embedded system, a frequency measurement period Interior, specific measuring process is as follows:
SS1, the Interruption that central processing element timer is arranged are enabled and capture is interrupted and enabled;
SS2, when first rising edge of a complete waveform of measured pulse signal arrives, timer capture interrupt it is enabled, External interrupt is triggered, the third feature value of measured pulse signal is obtained by central processing unit and recorded;
SS3, when first failing edge of a complete waveform of measured pulse signal arrives, timer capture interrupt it is enabled, External interrupt is triggered, by the fourth feature value of the system timer record measured pulse signal of central processing unit;
SS4, when second rising edge of a complete waveform of measured pulse signal arrives, timer capture interrupt it is enabled, External interrupt is triggered, by the fifth feature value of the system timer record measured pulse signal of central processing unit;
An impulsive measurement process is completed in SS5, confirmation;
Close capture and interrupt enabled, the fifth feature value is compared operation with third feature value, calculate timer value 5 and The difference c of timer value 3, the difference d of the timestamp 3 of the timestamp 5 and system beat timing of computing system beat timing, according to Difference c and difference d's and, obtain the period of measured pulse signal, the frequency values of measured pulse signal be calculated;
The fourth feature value is compared operation with third feature value, calculates the difference e of timer value 4 and timer value 3, The difference f of the timestamp 3 of the timestamp 4 and system beat timing of computing system beat timing is obtained by the sum of difference e and difference f It is calculated to the pulse width of measured pulse signal according to the period of the pulse width of measured pulse signal and measured pulse signal Obtain the dutyfactor value of measured pulse signal;
Wherein, the third feature value is timer value 3, the timestamp 3 of system beat timing and rising mark 1;Described 4th Characteristic value is timer value 4, the timestamp 4 of system beat timing and decline mark 1;The fifth feature value is timer value 5 With the timestamp 5 of system beat timing.
4. a kind of detection method of signal frequency and duty ratio based on embedded microcontroller as claimed in claim 3, feature Be, in step SS5 " confirmation " specific step is as follows:
SS51, when a complete waveform of measured pulse signal first rising edge arrive when, be recorded as rise mark 1;
SS52, when a complete waveform of measured pulse signal first failing edge arrive when, be recorded as decline mark 1;
SS53, when a complete waveform of measured pulse signal second rising edge arrive when, central processing unit judgement on The raising of indices is known or decline identifies whether to be 1, if 1, determines that an impulsive measurement process has been completed, and the upper raising of indices at this time is arranged Knowing is 2, is compared operation;
SS54, when the value of timer rises to the system beat period, into system break, the value of timer is reset, and Judge the rising mark of central processing unit record,
If 1, SS53 is entered step;
If 2, determine that an impulsive measurement process is over, mark will be risen and be set as 0, waited and entered next frequency and account for Sky is than measurement period, return step SS1.
5. a kind of detection method of signal frequency and duty ratio based on embedded microcontroller as claimed in claim 3, feature Be: the timer is the locking phase loop voltag or other systems timer of central processing unit.
CN201610905453.8A 2016-10-17 2016-10-17 A kind of detection method of signal frequency and duty ratio based on embedded microcontroller Active CN106569032B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610905453.8A CN106569032B (en) 2016-10-17 2016-10-17 A kind of detection method of signal frequency and duty ratio based on embedded microcontroller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610905453.8A CN106569032B (en) 2016-10-17 2016-10-17 A kind of detection method of signal frequency and duty ratio based on embedded microcontroller

Publications (2)

Publication Number Publication Date
CN106569032A CN106569032A (en) 2017-04-19
CN106569032B true CN106569032B (en) 2019-05-31

Family

ID=58533071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610905453.8A Active CN106569032B (en) 2016-10-17 2016-10-17 A kind of detection method of signal frequency and duty ratio based on embedded microcontroller

Country Status (1)

Country Link
CN (1) CN106569032B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108761201B (en) * 2018-04-04 2020-05-22 何晓龙 Bit stream frequency measurement device and method
CN109361500A (en) * 2018-10-25 2019-02-19 南通先进通信技术研究院有限公司 A method of the plesiochronous external pulse of self-correcting based on chip
CN111948579A (en) * 2019-04-29 2020-11-17 深圳市优必选科技有限公司 Detection method and detection system for terminal connecting wire
DE112021004338T5 (en) * 2020-08-18 2023-05-25 Microchip Technology Incorporated FREQUENCY SWITCHED DEMODULATION FOR WIRELESS POWER TRANSMISSION AND RELATED SYSTEMS, METHODS AND DEVICES
CN114113802B (en) 2020-08-31 2023-01-24 长鑫存储技术(上海)有限公司 Test circuit, test device and test method thereof
CN112242828A (en) * 2020-09-11 2021-01-19 深圳市杉川机器人有限公司 Method, device and equipment for capturing pulse width modulation signal
CN113300902B (en) * 2021-03-29 2022-05-20 明峰医疗系统股份有限公司 Multichannel pulse width measurement and data transmission processing method
CN113823245B (en) * 2021-09-08 2022-09-30 富奥汽车零部件股份有限公司 Display screen brightness control method, control device and readable storage medium
CN113630108B (en) * 2021-09-18 2023-02-07 温州大学 Triangular wave signal parameter measurement circuit
CN117111537B (en) * 2023-10-23 2024-01-26 北京科泰克科技有限责任公司 Control system and method for hydrogen system based on hydrogen controller

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101206235A (en) * 2006-12-22 2008-06-25 上海贝岭股份有限公司 Method for measuring frequency of single-chip
CN102841247A (en) * 2012-08-30 2012-12-26 惠州三华工业有限公司 Detection method for grid frequency
CN102901870A (en) * 2012-08-30 2013-01-30 河南科技大学 Frequency testing system based on singlechip and testing method using same
CN202886465U (en) * 2012-08-30 2013-04-17 河南科技大学 Frequency test system based on single-chip microcomputer
CN104316775A (en) * 2014-10-29 2015-01-28 上海大学 Pulse signal cycle and duty ratio continuous measurement method
CN104635046A (en) * 2015-02-15 2015-05-20 金陵科技学院 Modulation domain frequency counter and continuous frequency measurement method thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05312975A (en) * 1992-05-07 1993-11-26 Matsushita Electric Ind Co Ltd Frequency discriminator

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101206235A (en) * 2006-12-22 2008-06-25 上海贝岭股份有限公司 Method for measuring frequency of single-chip
CN102841247A (en) * 2012-08-30 2012-12-26 惠州三华工业有限公司 Detection method for grid frequency
CN102901870A (en) * 2012-08-30 2013-01-30 河南科技大学 Frequency testing system based on singlechip and testing method using same
CN202886465U (en) * 2012-08-30 2013-04-17 河南科技大学 Frequency test system based on single-chip microcomputer
CN104316775A (en) * 2014-10-29 2015-01-28 上海大学 Pulse signal cycle and duty ratio continuous measurement method
CN104635046A (en) * 2015-02-15 2015-05-20 金陵科技学院 Modulation domain frequency counter and continuous frequency measurement method thereof

Also Published As

Publication number Publication date
CN106569032A (en) 2017-04-19

Similar Documents

Publication Publication Date Title
CN106569032B (en) A kind of detection method of signal frequency and duty ratio based on embedded microcontroller
CN105302383A (en) Anti-interference method and device for capacitive touch sensor
CN106597096A (en) Clock frequency monitoring method
CN108226560A (en) A kind of method and device for obtaining motor slow-speed of revolution angular speed
CN110069170A (en) Touch screen report point rate processing method, device, electronic equipment and readable storage medium storing program for executing
CN102315983A (en) Circuit and method for automatically detecting Baud rate of multiple paths of serial communication interfaces
EP2810177B1 (en) Input capture peripheral with gating logic
US20140153623A1 (en) Device for auto baud rate detection
CN106707034A (en) Pulse signal detection method based on Windows system function and multi-thread technology
CN117388673A (en) ATE equipment and chip testing method thereof, electronic equipment and storage medium
JP2001318807A (en) Method and device for controlling task switching
CN108809299A (en) signal frequency measuring system
CN102457268A (en) Implementation method for 32-bit capture register
CN109766014A (en) A kind of single-chip microcontroller key range is by the method for hitting operation
US5357490A (en) Measuring timer system
CN2713741Y (en) Clock detecting circuit
JP5077815B2 (en) Pulse input device
CN107479995A (en) A kind of mobile electronic device, detection process method and detection process circuit
CN104459314A (en) High-precision frequency measurement method in RFID system
CN109634168A (en) A kind of processing method of sensor pulse signal
CN109341446A (en) A kind of command recognition unit and method and time-delay mechanism and method for electric detonator
JPH0135281B2 (en)
CN103817404A (en) Manual electric arc welder three-phase electricity phase loss detection method and device
CN109814725A (en) A kind of gesture interaction method and system
CN109855746A (en) Temperature value transmitting device and its method

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
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20190530

Address after: 410100 Xingsha Industrial Base (Changlong Street), Changsha Economic and Technological Development Zone, Changsha City, Hunan Province, No. 1259, Liangtang East Road

Patentee after: Kaiyuan Instrument Co., Ltd., Changsha

Address before: 410100 No. 172 Kaiyuan Road, Changsha economic and Technological Development Zone, Hunan

Patentee before: Changsha Kaiyuan Instruments Co., Ltd.