CN1276397C - Frequency dynamic correcting method and apparatus - Google Patents

Frequency dynamic correcting method and apparatus Download PDF

Info

Publication number
CN1276397C
CN1276397C CN 03123836 CN03123836A CN1276397C CN 1276397 C CN1276397 C CN 1276397C CN 03123836 CN03123836 CN 03123836 CN 03123836 A CN03123836 A CN 03123836A CN 1276397 C CN1276397 C CN 1276397C
Authority
CN
China
Prior art keywords
frequency
break period
system frequency
interruption times
error
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN 03123836
Other languages
Chinese (zh)
Other versions
CN1549223A (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.)
Holtek Semiconductor Inc
Original Assignee
Holtek Semiconductor Inc
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 Holtek Semiconductor Inc filed Critical Holtek Semiconductor Inc
Priority to CN 03123836 priority Critical patent/CN1276397C/en
Publication of CN1549223A publication Critical patent/CN1549223A/en
Application granted granted Critical
Publication of CN1276397C publication Critical patent/CN1276397C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

The present invention relates to a frequency dynamic correction method and a device for correcting an output frequency of a frequency generator. The device comprises a microcontroller and a resistor-capacitor oscillation source, wherein a counter is arranged in the microcontroller electrically connected with the frequency generator; the resistor-capacitor oscillation source is formed by connecting a resistor and a capacitor in series and electrically connected with the microcontroller; the microcontroller uses a reference frequency as reference; according to a system frequency generated by the resistor-capacitor oscillation source, interruption time generated by the counter corresponding to the system frequency is corrected, and thereby, the output frequency is adjusted.

Description

Method and device that frequency dynamic is proofreaied and correct
(1) technical field
The present invention is meant method and the device that a kind of frequency dynamic is proofreaied and correct, and refers to a kind of method and device with software mode dynamic calibration output frequency especially.
(2) background technology
Some the traditional household electric appliances or the telepilot of commercial plant produce accurate carrier frequency if desired, generally must adopt the quartz oscillation element.When if this device needs function such as time showing or timing again, can need one real-time (real time) special-purpose 32.768KHz quartz (controlled) oscillator in addition.Like this, because the quartz (controlled) oscillator cost is higher, can increase the manufacturing cost of product integral body.If but use the cheaper RC oscillator of price (RC Oscillator) in order to reduce cost, and then again can be very big because of the error of resistance and electric capacity, can cause the skew of oscillation frequency; And the variation that is easy to be subjected to external environment conditions such as temperature again owing to RC oscillator itself causes the drift of oscillation frequency.So application scenario in the accurate frequency output of needs, the product fabricator just need use expensive quartz (controlled) oscillator or adopt in addition and come emending frequency as phase-lock loop complex circuit design such as (Phase Lock Loop), thereby expends the manufacturing and the design cost of many integrated circuit.
(3) summary of the invention
Fundamental purpose of the present invention is to utilize a microcontroller that has clock pulse (a real time clock), the system frequency that the mode correction one RC oscillation source frequency of proofreading and correct with software is sent, and adjust the output frequency that a frequency generator produces by this.
According to conception of the present invention, the method that a kind of frequency dynamic is proofreaied and correct is proposed, comprise the following step: one first system frequency (a) is provided, a corresponding carrier frequency, and, produce one first prevalue via one first computing; (b) mutually should first prevalue, obtain one first count value with respect to a specific bit number; (c) with this first system frequency this first count value is carried out a frequency elimination, can get for one first break period; (d) at this first break period, mutually should reference frequency, and, produce one first interruption times via one second computing; (e) when this first system frequency becomes one second system frequency because of frequency drift, reach (d) with this second system frequency repeating step (c), can get one second break period and one second interruption times in regular turn; (f) this second interruption times and this first interruption times are done one relatively, and get an interruption times margin of error; (g) at the interruption times margin of error of the comparative result gained of this second interruption times and this first interruption times, revise this first prevalue, and one second prevalue; (h) at this second prevalue repeating step (b), can get one second count value; And (i) this second count value is carried out a frequency elimination with this second system frequency, and can get for one the 3rd break period, the 3rd break period of this moment covers this second break period, to proofread and correct output frequency.
According to above-mentioned conception, wherein this specific bit number is meant the bit number of a counter.
According to above-mentioned conception, wherein this specific bit number is 8 bits.
According to above-mentioned conception, wherein this first and second system frequency is produced by a resistance capacitance oscillation source.
According to above-mentioned conception, wherein this carrier frequency be 37.92KHz and 56.9KHz the two one of.
According to above-mentioned conception, wherein this reference frequency is produced by a quartz (controlled) oscillator.
According to above-mentioned conception, wherein this first computing is after with this carrier frequency this first system frequency being carried out a frequency elimination, with respect to this specific bit number, to produce this first prevalue.
According to above-mentioned conception, wherein this second computing is with this reference frequency mutually should certain bits unit several benchmark break periods that had, and is divided by with this first break period, produces this of interruption times first time.
According to above-mentioned conception, wherein step (e) can get an error interrupt number of times with the second system frequency repeating step (c) and (d) of this first system frequency after because of frequency drift; And step (f) is divided by the difference and the error count factor between this error interrupt number of times and this first interruption times, can get an interruption times margin of error.
According to above-mentioned conception, wherein step (g) is complied with this interruption times margin of error correction first prevalue, and gets one second prevalue.
According to another conception of the present invention, the device that a kind of frequency dynamic is proofreaied and correct is proposed, in order to proofread and correct an output frequency of a frequency generator, it comprises: a microcontroller, inside have a counter, and this microcontroller is electrically connected with this frequency generator; And a resistance capacitance oscillation source, form by a resistance and a capacitances in series, and this resistance capacitance oscillation source is to be electrically connected with this microcontroller; Wherein, this microcontroller is to be reference with a reference frequency, according to the system frequency that this resistance capacitance oscillation source is produced, revises this counter to break period that should system frequency produced, and uses and adjust this output frequency.
According to above-mentioned conception, wherein this frequency generator is according to operating this break period.
According to above-mentioned conception, wherein this counter is one 8 bit counters.
According to above-mentioned conception, wherein this reference frequency is sent by a quartz (controlled) oscillator.
According to above-mentioned conception, wherein this quartz (controlled) oscillator is to be electrically connected with this microcontroller.
(4) description of drawings
The present invention is in conjunction with the drawings to the detailed description of preferred embodiment, more to understand purpose of the present invention, characteristics and advantage in depth.
Fig. 1 is the running element synoptic diagram of a preferred embodiment of the present invention; And
Fig. 2 is the computing method synoptic diagram of a preferred embodiment of the present invention.
(5) embodiment
The infrared remote controller that generally has time showing, so because will show that it is the quartz (controlled) oscillator of 32.768KHz that there is a frequency time, the reference frequency when the very accurate event of this oscillation frequency can be used as other frequency corrections.
And sending out of infrared remote controller established carrier frequency and is generally 37.92KHz or 56.9KHz, this sentences 37.92KHz is that example explains, be applied to have in the counter of one or eight bits, by the break period of this counter of control, to adjust the output frequency that a RC oscillation source produces.
Please refer to Fig. 1, it is the running element synoptic diagram of the inventive method.The reference frequency that microcontroller among the figure (MCU) 1 can a quartz (controlled) oscillator 2 be produced is as standard, the system frequency that will be produced by resistance capacitance (RC) oscillation source 5 that resistance 3 and an electric capacity 4 are constituted calculates corresponding break period by this microcontroller (MCU) 1 counter that is had 6, uses in the mode of software control break period and proofreaies and correct a frequency and produce the output frequency that device 7 is produced.
With a RC oscillation source reference frequency (Reference Frequency) be set at 4550KHz as first system frequency of calculating (because of 4550KHz almost can be simultaneously as generally the carrier frequency 37.92KHz of infrared remote controller and the frequency multiplication of 56.9KHz, so can reduce the error that is produced because of calculating) be example, (with centre frequency 7000KHZ was example when the variation that produces oscillation frequency because of the variation of environmental baselines such as procedure for producing or temperature when this RC oscillation source produced one second system frequency 7000KHZ, estimate error up ± 30% of RC vibration, then the mobility scale of frequency of utilization is 4900KHz to 9100KHz, for present embodiment is used upward acceptable nargin), the reference frequency 32.768KHz that then utilizes a clock pulse (RTC) to be produced is a standard, the break period that mutually should counter produces by the first system frequency 4550KHz, make comparisons with the break period that the second system frequency 7000KHZ mutually should counter produces, the break period that mutually should counter produces by this comparative result correction second system frequency 7000KHZ, remain at the break period that makes this counter produce and be similar near the break period that the first system frequency 4550KHz mutually should counter produces, can reach the output frequency of revising this RC oscillation source in a dynamic way by this, make it produce the purpose of the carrier frequency of a 37.92khz.Below be detailed account form (please refer to Fig. 2):
1. at first, with this reference frequency 32.768khz mutually should counter bit several 8 calculate under system's clock pulse the interruption count cycle (Parameter of RTC Interrupt Interval) (Prii): Prii32768=1/ (32.768KHz/256)=1/128Hz=7.8125mS
2. in addition, with this carrier frequency 37.92KHz this first system frequency 4550KHz is carried out a frequency elimination after, several 8 with respect to the bit of this counter, produce one first prevalue 196 (Parameter of Timer Preload Number) (Ptpn)
Ptpn4550k=256-4550k/(37.92k×2)=196
3. mutually should first prevalue 196, several 8 with respect to the bit of this counter, can get one first count value 60
(Parameter?of?Timer?Net?Number)(Ptnn):
Ptnn4550k=256-Ptpn4550k=60
4. can draw the first break period 13.1868uS (Parameter of Timer Interrupt Interval) of this first system frequency 4550KHz during this rolling counters forward (Ptii) by this first count value 60:
Ptii4550k=(1/4550k)×Ptnn4550k=13.1868uS
5. the interruption count cycle 7.8125mS under this first break period 13.1868uS and the system's clock pulse is divided by, can first interruption times 592 of this first system frequency 4550KHz during this rolling counters forward
(Parameter?of?Timer?Counting?Number)(Ptcn):
Ptcn4550k=Prii32768/Ptii4550k=592
6. more respectively at this first system frequency 4550KHz every increase and decrease 1 of count value (Ptnn) during this rolling counters forward, error interrupt number of times corresponding (Parameter of Minimum DeviationCounts) with it (Pmdc):
Pmdc4550k=Prii32768/[Ptii4550k×(Ptnn4550k+1)/Ptnn4550k]=582
Or
Pmdc4550k=Prii32768/[Ptii4550k×(Ptnn4550k-1)/Ptnn4550k]=602
7. make comparisons with this first interruption times Ptcn4550k by this error interrupt number of times (Pmdc), can draw an error count factor 10 (Parameter of Minimum Deviation Divider) (Pmdd):
Pmdd4550k=Ptcn4550k-Pmdc4550k=592-582=10or
Pmdd4550k=Pmdc4550k-Ptcn4550k=602-592=10
8. implement a round-off error method at this error count factor (Pmdd):
Pmdd4550k/2=5
Counting maximum error (Maximum Deviation) as can be known is:
MD=±Pmdd4550k/Pmdc4550k×100%=±1.7%
Hence one can see that, if with system frequency 32.768khz is standard, be used as one first system frequency and count action with 4550KHz by one 8 bit counters, produce the carrier frequency of a 37.92kHz, its error only is ± 1.7%, if with general infrared remote controller margin for error on the market is 15% to make comparisons, can say very accurate.
9. produce the variation of oscillation frequency because of the variation of environmental baselines such as procedure for producing or temperature when this RC oscillation source, and when producing one second system frequency 7000KHZ, still utilize the above-mentioned the 4th and the 5th method, calculate one second 8.5714uS break period (Parameter of Timer InterruptInterval) (Ptii respectively, before rectifying) and one second interruption times 911 (Parameter ofTimer Counting Number) (Ptcn, before rectifying)
Ptii7000k=(1/7000k)×Ptnn4550k=8.5714uS
Ptcn7000k=Prii32768/Ptii7000k=911
10. this second interruption times 911 and this first interruption times 592 are done one relatively, and remove this error count factor 10:
(911-592)/10=32
As can be known if insert this rolling counters forward with first prevalue (Ptpn) 196 of the first system frequency 4550KHz, when this RC oscillation source produced one second system frequency 7000KHZ because of frequency drift, the prevalue (Ptpn) of this counter when counting can produce an increment 32
11. therefore desire the update the system frequency, first prevalue 196 in the counter must be reduced 32, form one second prevalue 164 (Parameter of Timer Preload Number) (Ptpn):
Ptpn7000K=256-[Ptnn4550k+(Ptcn7000k-Ptcn4550k)/Pmdd4550k]=Ptpn4550k-(911-592)/10]=164
12. mutually should second prevalue 164, several 8 with respect to the bit of this counter, can get one second count value 92 (Parameter of Timer Net Number) (Ptnn):
Ptnn7000k=256-Ptpn7000k=92
13. can draw this second system frequency 7000KHz (Ptii) at the 3rd 13.1429uS break period (Parameter of Timer InterruptInterval) (after rectified) of this counter after revising count value by this second count value 92:
Ptii7000k=(1/7000k)×Ptnn7000k=13.1429uS
Output frequency Fout=1/ (Ptii7000k * 2)=38.043kHz
14. with this second system frequency 7000KHz this counter after revising count value the 3rd break period 13.1429uS with this first system frequency 4550KHz this counter before revising count value first break period 13.1868uS do a comparison:
Round-off error (Rectifying Deviation): RD7000k=(13.1868uS-13.1429uS)/13.1868uS * 100%=+0.333%
Learning that error only is+0.333%, is very accurate therefore.
15. in addition, if fabrication errors frequency with the electric capacity among the IC, estimate error up ± 30% of RC vibration, therefore be example with the second system frequency 7000KHZ, the mobility scale of frequency of utilization is that 4900KHz is between the 9100KHz, if the revised break period (Ptii) so that above-mentioned modification method calculates 4900KHz and 9100KHz difference correspondence, can get:
Ptii4900k=13.2653uS
Ptii9100k=13.0769uS
16. with the mobility scale extreme value 4900KHz of this second system frequency 7000KHz and 9100KHz the break period of this counter after revising count value and this first system frequency 4550KHz this counter before the correction count value first break period 13.1868uS make an Error Calculation respectively:
(1)-30% frequency correction error calculating (fSYS=4900kHz, fCARRIER=37.92KHz)
Error after the calculating is:
RD4900k=(13.1868uS-13.2653uS)/13.1868uS×100%=+0.595%
(2)+30% frequency correction error calculating (fSYS=9100kHz, fCARRIER=37.92KHz)
Error after the calculating is:
RD9100k=(13.1868uS-13.0769uS)/13.1868uS×100%=-0.833%
Know that by the checking computations of above (1) (2) error all within the acceptable range.
This method is that utilizing this system frequency to count the count value of gained can be different with parameter preset when utilizing system frequency because of RC error and temperature variation generation skew.According to this different variable quantity, revise the count value of frequency under this system frequency of institute's desire output.Can utilize this counting mode to make microcontroller produce pulse wave output like this in a fixed frequency.
This operation can be proofreaied and correct once earlier when the user operates at every turn, so can realize the function of dynamic calibration, no matter how external environment changes, all can obtain well output frequency accurately.Therefore the present invention has the value of industry development in fact.

Claims (14)

1. the method that frequency dynamic is proofreaied and correct is characterized in that, comprises the following step:
(a) provide one first system frequency, a corresponding carrier frequency, and,, produce one first prevalue via one first computing with respect to a specific bit number;
(b) mutually should first prevalue, obtain one first count value with respect to this specific bit number;
(c) with this first system frequency this first count value is carried out a frequency elimination, can get for one first break period;
(d) at this first break period, a corresponding reference frequency, and, produce one first interruption times via one second computing;
(e) when this first system frequency becomes one second system frequency because of frequency drift, reach (d) with this second system frequency repeating step (c), can get one second break period and one second interruption times in regular turn;
(f) this second interruption times and this first interruption times are done one relatively, and get an interruption times margin of error;
(g) at the interruption times margin of error of the comparative result gained of this second interruption times and this first interruption times, revise this first prevalue, and one second prevalue;
(h) at this second prevalue repeating step (b), can get one second count value; And
(i) with this second system frequency this second count value is carried out a frequency elimination, can get for one the 3rd break period, the 3rd break period of this moment covers this second break period, to proofread and correct output frequency.
2. the method for claim 1 is characterized in that, this specific bit number is meant the bit number of a counter.
3. the method for claim 1 is characterized in that, this specific bit number is 8 bits.
4. the method for claim 1 is characterized in that, this first and second system frequency is produced by a resistance capacitance oscillation source.
5. the method for claim 1 is characterized in that, this carrier frequency is 30KHz~75KHz.
6. the method for claim 1 is characterized in that, this reference frequency is produced by a quartz (controlled) oscillator.
7. the method for claim 1 is characterized in that, this first computing is after with this carrier frequency this first system frequency being carried out a frequency elimination, with respect to this specific bit number, to produce this first prevalue.
8. the method for claim 1 is characterized in that, this second computing is with this reference frequency mutually should certain bits unit several benchmark break periods that had, and is divided by with this first break period, produces this first interruption times.
9. the method for claim 1 is characterized in that:
The second system frequency repeating step (c) after step (e) is drifted about with this first system frequency reaches (d), can get an error interrupt number of times; And
Step (f) is divided by the difference and the counting error factor between this error interrupt number of times and this first interruption times, and gets an interruption times margin of error.
10. the device that frequency dynamic is proofreaied and correct in order to proofread and correct an output frequency of a frequency generator, is characterized in that, comprising:
One microcontroller, inside have a counter, and this microcontroller is electrically connected with this frequency generator; And
One resistance capacitance oscillation source is formed by a resistance and a capacitances in series, and this resistance capacitance oscillation source is to be electrically connected with this microcontroller;
Wherein this microcontroller is to be reference with a reference frequency, according to the system frequency that this resistance capacitance oscillation source is produced, revises this counter to break period that should system frequency produced, and uses and proofread and correct this output frequency.
11. device as claimed in claim 10 is characterized in that, this frequency generator is according to operating this break period.
12. device as claimed in claim 10 is characterized in that, this counter is one 8 bit counters.
13. device as claimed in claim 10 is characterized in that, this reference frequency is produced by a quartz (controlled) oscillator.
14. device as claimed in claim 13 is characterized in that, this quartz (controlled) oscillator is to be electrically connected with this microcontroller.
CN 03123836 2003-05-14 2003-05-14 Frequency dynamic correcting method and apparatus Expired - Fee Related CN1276397C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 03123836 CN1276397C (en) 2003-05-14 2003-05-14 Frequency dynamic correcting method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 03123836 CN1276397C (en) 2003-05-14 2003-05-14 Frequency dynamic correcting method and apparatus

Publications (2)

Publication Number Publication Date
CN1549223A CN1549223A (en) 2004-11-24
CN1276397C true CN1276397C (en) 2006-09-20

Family

ID=34321479

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 03123836 Expired - Fee Related CN1276397C (en) 2003-05-14 2003-05-14 Frequency dynamic correcting method and apparatus

Country Status (1)

Country Link
CN (1) CN1276397C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102232849A (en) * 2010-04-30 2011-11-09 西门子(深圳)磁共振有限公司 Dynamic frequency drift calibrating method

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107231149A (en) * 2017-06-08 2017-10-03 深圳驰芯微电子有限公司 Chip
TWI723693B (en) * 2019-12-20 2021-04-01 新唐科技股份有限公司 Detection circuit and detection method for fail signal

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102232849A (en) * 2010-04-30 2011-11-09 西门子(深圳)磁共振有限公司 Dynamic frequency drift calibrating method
CN102232849B (en) * 2010-04-30 2014-09-03 西门子(深圳)磁共振有限公司 Dynamic frequency drift calibrating method

Also Published As

Publication number Publication date
CN1549223A (en) 2004-11-24

Similar Documents

Publication Publication Date Title
CN1976227A (en) Pulse width modulating device
CN1126318C (en) Clock delay circuitry, and oscillation circuitry and phase synchronization circuitry using clock delay circuitry
CN1216470C (en) Device and method for generating clock with optional frequency usable clock
CN1126254C (en) Clock generator and clock generating method capable of varying clock frequency without increasing nuber of delay elements
CN101039145A (en) Method and apparatus for realizing clock
CN1168212C (en) Frequency measurement circuit
CN1256023A (en) Frequency synthetic circuit regulated by digit
CN1276397C (en) Frequency dynamic correcting method and apparatus
CN1722029A (en) A fractional divider system and method
CN1574642A (en) Spread spectrum clock generating apparatus
CN1218490C (en) Clock signal generator
CN1091977C (en) Clock synchronization method for non-integral number frequency multiplication system
CN1835389A (en) Method able to eliminate frequency error of digital controlled oscillator and phase accumulator
CN1711685A (en) A sawtooth wave generating apparatus, a method of generating sawtooth wave, a constant current circuit, and a method of adjusting amount of current from the same
CN1858999A (en) Pseudo-random sequence generating device
CN1271791C (en) Turbo decoder and its implementing method
CN1309838A (en) De-interleave circuit
CN1300940C (en) High accuracy RC oscillator with optional frequency
CN1123965C (en) Production method of phase-based pulse width modulated sinusoidal voltage waveform data
CN1144116C (en) Device for generating clock signal
CN1439197A (en) Decoder and decoding method
CN113806276A (en) Clock generation method and device, chip and electronic equipment
CN1421751A (en) Low-power consumption precise timer and its precision correcting equipment, system and method
CN1275386C (en) Automatic correcting device and method for pulse working period
CN105811971A (en) Counter-based variable frequency clock source and FPGA device

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

Granted publication date: 20060920