JP2002196024A - Period measuring circuit - Google Patents

Period measuring circuit

Info

Publication number
JP2002196024A
JP2002196024A JP2000394918A JP2000394918A JP2002196024A JP 2002196024 A JP2002196024 A JP 2002196024A JP 2000394918 A JP2000394918 A JP 2000394918A JP 2000394918 A JP2000394918 A JP 2000394918A JP 2002196024 A JP2002196024 A JP 2002196024A
Authority
JP
Japan
Prior art keywords
cycle
period
input signal
timer
frequency
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.)
Pending
Application number
JP2000394918A
Other languages
Japanese (ja)
Inventor
Takashi Kurosaki
剛史 黒崎
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2000394918A priority Critical patent/JP2002196024A/en
Publication of JP2002196024A publication Critical patent/JP2002196024A/en
Pending legal-status Critical Current

Links

Landscapes

  • Measuring Frequencies, Analyzing Spectra (AREA)

Abstract

PROBLEM TO BE SOLVED: To perform a period measurement with favorable accuracy even when an oscillation frequency of a clock device generating a reference frequency shifts from a center value. SOLUTION: A signal converting circuit 6 converts an input signal of a measurement object into a pulse signal with a pulse width corresponding to a period of the input signal, a first timer 50a counts the pulse width using a timer period generated on the basis of the reference frequency generated by the clock device 7, and a microcomputer 50 calculates the period of the input signal using the count value. A reference signal converting circuit 11 converts a commercial power source frequency into a pulse signal with a pulse width corresponding to period of a commercial power source 1, a second timer 50b counts the pulse width using the timer cycle, and the microcomputer 50 determines whether the commercial power source frequency is 50 Hz or 60 Hz from the count value and corrects the calculated period of the input signal on the basis of the determined frequency. By this, more accurate period can be measured.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、入力された信号の
周期を計測する周期計測回路に関し、特にタイマを用い
た周期計測回路に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a period measuring circuit for measuring the period of an input signal, and more particularly to a period measuring circuit using a timer.

【0002】[0002]

【従来の技術】図4は従来の周期計測回路の構成を示す
ブロック図、図5は図4の周期計測回路の動作を示すフ
ロ−チャ−ト、図6は図4の各部の信号を示すタイムチ
ャ−トである。
2. Description of the Related Art FIG. 4 is a block diagram showing the configuration of a conventional cycle measuring circuit, FIG. 5 is a flowchart showing the operation of the cycle measuring circuit of FIG. 4, and FIG. 6 shows signals of various parts in FIG. It is a time chart.

【0003】図4において、1は商用電源、2はマイク
ロコンピュ−タ等の動作用電源を生成させる電源回路、
3、4は電源回路2により作られる電源で、3は例え
ば、+5V の正電源、4はGND である。5は入力信号の
周期を後述のクロック装置7が生成する基準周波数に基
いてカウントするタイマ5aを内蔵し、周期を演算する
マイクロコンピュ−タ(以降マイコンと略す)、6は入
力信号をタイマ5aでカウントできる信号レベルに変換
する信号変換回路、7はマイコン5が動作する際の基準
周波数を生成するクロック装置であり、セラミック発振
子等の発振素子8、コンデンサ9及び帰還抵抗10によ
り構成され、マイコン5に接続されている。
In FIG. 4, 1 is a commercial power supply, 2 is a power supply circuit for generating an operating power supply for a microcomputer or the like,
Reference numerals 3 and 4 denote power supplies generated by the power supply circuit 2, 3 denotes a positive power supply of, for example, + 5V, and 4 denotes a GND. Reference numeral 5 denotes a built-in timer 5a for counting the period of the input signal based on a reference frequency generated by a clock device 7 described later, and a microcomputer for calculating the period (hereinafter abbreviated as "microcomputer"). A signal conversion circuit 7 converts the signal level into a signal level that can be counted by the microcomputer 5. A clock device 7 generates a reference frequency when the microcomputer 5 operates. The clock device 7 includes an oscillation element 8 such as a ceramic oscillator, a capacitor 9, and a feedback resistor 10. It is connected to the microcomputer 5.

【0004】次に、以上のように形成された周期計測回
路の動作について、図4から図6を用いて説明する。 (1)周期計測の対象となる入力信号(図6−イ)が信
号変換回路9に入力タイマ5aで周期が計測できる信号
の例えば0−5Vのパルス信号(図6−ロ)に変換され
る。 (2)変換されたパルス信号はタイマ5aへ入力され
る。
Next, the operation of the cycle measuring circuit formed as described above will be described with reference to FIGS. (1) The input signal (FIG. 6-A) to be subjected to the cycle measurement is converted into a signal whose period can be measured by the input timer 5a to the signal conversion circuit 9 into, for example, a 0-5V pulse signal (FIG. 6-B). . (2) The converted pulse signal is input to the timer 5a.

【0005】(3)タイマ5aのタイマ周期にはクロッ
ク装置7から入力された基準周波数(図6−ハ)を分周
した周期(図6−ニ)が用いられ、タイマ5aはこのタ
イマ周期により、パルス信号の立上がりエッジから立上
がりエッジ迄をウントする。なお、立下がりエッジから
立下りエッジ、もしくは立上がりエッジから立下がりエ
ッジをカウントするようにしても良い。
(3) The timer period of the timer 5a is a period (FIG. 6-D) obtained by dividing the reference frequency (FIG. 6-C) inputted from the clock device 7, and the timer 5a is determined by the timer period. , From the rising edge of the pulse signal to the rising edge. The falling edge may be counted from the falling edge, or the falling edge may be counted from the rising edge.

【0006】(4)定期もしくは不定期的に、マイコン
5はタイマ5aのタイマ周期を用いて入力信号計測(ス
テップ101)し、周期計測を完了すると、タイマ5a
がカウントできるカウント数の上限値をオバ−フロ−し
たかどうかのチェックを行う(ステップ102)。 (5)タイマ5aがオ−バ−フロ−となっていることが
確認された場合は、周期計測を中止し、オ−バ−フロ−
に対して予め定められている他のル−チンへ移行する
(ステップ103)。なお、ここで、ステップ103の
移行先のル−チンが実行する内容は周期計測回路が利用
される装置に応じてそれぞれ異なるものであり、周期計
測回路自体の動作については関係がないため説明を省略
する。
(4) The microcomputer 5 periodically or irregularly measures the input signal using the timer cycle of the timer 5a (step 101).
It is checked whether the upper limit of the count number that can be counted has overflowed (step 102). (5) If it is confirmed that the timer 5a is in the overflow state, the cycle measurement is stopped and the overflow is stopped.
Is shifted to another routine determined in advance (step 103). Here, the contents executed by the routine to which the routine is transferred in step 103 are different depending on the device in which the period measurement circuit is used, and the operation of the period measurement circuit itself is not relevant. Omitted.

【0007】(6)ステップ102にてタイマ5aがオ
−バ−フロ−ではないことが確認された場合には、タイ
マ5aのカウント数を読み出す。(ステップ104) (7)読み出したタイマ5aのカウント数とタイマ周波
数により入力信号の周期を次式(1)により演算する
(ステップ105)。
(6) If it is confirmed in step 102 that the timer 5a is not overflow, the count of the timer 5a is read. (Step 104) (7) The cycle of the input signal is calculated by the following equation (1) based on the read count number of the timer 5a and the timer frequency (Step 105).

【0008】T=m/f ―――――――(1) T:周期計測値(秒) m:タイマ5aによるパルス幅カウント数(回) f:タイマ周波数(Hz)=1/タイマ周期(予め、マ
イコン5のソフトウエアで定義している値で、例えば、
発振回路の基準周波数10(MHz)を8分周したタイ
マを用いた場合、1.25(MHz)と定義してい
る。)
T = m / f (1) T: cycle measurement value (second) m: pulse width count number by timer 5a (times) f: timer frequency (Hz) = 1 / timer cycle (A value defined in advance by the software of the microcomputer 5, for example,
When a timer obtained by dividing the reference frequency of 10 (MHz) of the oscillation circuit by 8 is used, it is defined as 1.25 (MHz). )

【0009】[0009]

【発明が解決しようとする課題】従来の周期計測回路は
以上のように構成されており、クロック装置7で生成し
た基準周波数が、使用する発振素子8の部品のバラツ
キ、マイコン5に内蔵される回路と発振振子8とのマッ
チング、発振素子8の周囲温度による変化、及び発振素
子8の経年変化等の原因により規定値からずれると、そ
の基準周波数を分周するタイマ5aのタイマ周波数は予
めマイコン5のソフトウエアで定義している値からずれ
るため、タイマ5aを用いて計測したカウント数は予め
マイコン5のソフトウエアで定義している周期で計測し
た場合のカウント数と異なる。この結果、予めマイコン
5で定義している周波数と規定値からずれた周波数を分
周したタイマ5aでカウントしたカウント数により求め
た計測値は、発振素子7の基準周波数がその規定値から
ずれた割合だけ正規の周期からずれるという問題があっ
た。
The conventional cycle measuring circuit is constructed as described above. The reference frequency generated by the clock device 7 is incorporated in the microcomputer 5 due to the variation in the components of the oscillation element 8 used. If the value deviates from the specified value due to the matching between the circuit and the oscillation pendulum 8, the change due to the ambient temperature of the oscillation element 8, and the aging of the oscillation element 8, the timer frequency of the timer 5a for dividing the reference frequency is set in advance by the microcomputer. 5 is different from the value defined by the software of the microcomputer 5, the count number measured by using the timer 5a is different from the count number measured by the cycle of the software of the microcomputer 5 in advance. As a result, the measured value obtained from the count number counted by the timer 5a, which is obtained by dividing the frequency deviated from the frequency defined by the microcomputer 5 from the prescribed value, by the timer 5a, shows that the reference frequency of the oscillation element 7 deviates from the prescribed value. There has been a problem that the period is deviated from the regular period by the ratio.

【0010】例えば、発振素子の基準周波数が中心値1
0(MHz)で、タイマ5aの周波数(f)が発振素子
7の基準周波数10(MHz)の8分周である1.25
(MHz)、入力信号が50(Hz)の場合、タイマ5
aによるカウント数は1.25(MHz)/50(MH
z)=25000となる。
For example, when the reference frequency of the oscillation element has a center value of 1
0 (MHz), the frequency (f) of the timer 5a is 1.25 which is a frequency division of the reference frequency 10 (MHz) of the oscillation element 7 by 8
(MHz), when the input signal is 50 (Hz), the timer 5
The count number by a is 1.25 (MHz) / 50 (MH)
z) = 25000.

【0011】ところが、発振素子7にある種のセラミッ
ク発振子を用いた場合には、例えば使用する発振素子の
部品のバラツキが±0.5%、マイコンに内蔵される発
振用のN AND回路と発振子のマッチング特性が±0.4
%、発振素子の周囲温度変化が±0.4%、発振素子の
経年変化が±0.3%であるとすると、合計±1.6%
ずれることになる。
However, when a certain type of ceramic resonator is used for the oscillation element 7, for example, the variation of the components of the oscillation element used is ± 0.5%, and the oscillation NAND circuit built in the microcomputer is used. Oscillator matching characteristics ± 0.4
%, The change in ambient temperature of the oscillation element is ± 0.4%, and the change over time of the oscillation element is ± 0.3%, and the total is ± 1.6%.
Will shift.

【0012】この発振子を使用して入力信号50(MH
z)の周期計測を行った場合、タイマ5aの周波数は1
0(MHz)×1.016/8=1.27(MHz)と
なるため、タイマ5aによるカウント数(回)は1.2
7(MHz)/50(Hz)=25400(回)とな
り、周期計測値(T)は、 T=m/f=25400(回)/1.25(Hz)=
0.020302(秒)=49.21(Hz) となり、入力信号が50(Hz)であるのに対して、
1.6(%)の誤差を生じることになる。
Using this oscillator, an input signal 50 (MH)
When the cycle measurement of z) is performed, the frequency of the timer 5a is 1
Since 0 (MHz) × 1.016 / 8 = 1.27 (MHz), the number of counts (times) by the timer 5a is 1.2
7 (MHz) / 50 (Hz) = 25400 (times), and the cycle measurement value (T) is: T = m / f = 25400 (times) /1.25 (Hz) =
0.020302 (seconds) = 49.21 (Hz), and while the input signal is 50 (Hz),
This results in an error of 1.6 (%).

【0013】本発明は上記のような問題点を解決するた
めになされたもので、商用電源の周波数が比較的安定し
ていることに着目し、商用電源を補正の基準にすること
により、発振素子の基準周波数がその中心値からずれた
場合においても、精度よく周期を計測することができる
周期計測回路を得ることを目的としている。
SUMMARY OF THE INVENTION The present invention has been made to solve the above-described problems, and focuses on the fact that the frequency of a commercial power supply is relatively stable. It is an object of the present invention to provide a cycle measuring circuit that can accurately measure a cycle even when a reference frequency of an element deviates from its center value.

【0014】[0014]

【課題を解決するための手段】この発明の請求項1に係
わる周期計測回路は、入力信号の周期を計測する周期計
測回路において、クロック装置が発生する基準周波数に
基づいて入力信号の周期を計測する手段と、入力した商
用電源の周波数に基づいて前記入力信号の周期を補正す
る手段を備えたものである。
According to a first aspect of the present invention, there is provided a period measuring circuit for measuring a period of an input signal based on a reference frequency generated by a clock device. And a means for correcting the cycle of the input signal based on the frequency of the input commercial power supply.

【0015】また、この発明の請求項2に係わる周期計
測回路は、入力信号の周期を計測する周期計測回路にお
いて、クロック装置が発生する基準周波数に基づいて入
力信号の周期を計測する手段と、予め定めた商用電源の
周波数に基づいて前記入力信号の周期を補正する手段を
備えたものである。
The period measuring circuit according to a second aspect of the present invention is a period measuring circuit for measuring a period of an input signal, wherein the period measuring circuit measures a period of the input signal based on a reference frequency generated by a clock device. Means for correcting the cycle of the input signal based on a predetermined frequency of the commercial power supply.

【0016】また、この発明の請求項3に係わる周期計
測回路は、入力信号の周期を計測する周期計測回路にお
いて、基準周波数を生成するクロック装置と、前記入力
信号の周期に応じたパルス幅の第1パルス信号に変換す
る第1の信号変換回路と、前記第1パルス信号のパルス
幅の期間を前記基準周波数に基づいてカウントする第1
のタイマと、前記カウント値に基づいて前記入力信号の
周期を演算する演算手段と、商用電源の周期に応じたパ
ルス幅の第2パルス信号に変換する第2の信号変換回路
と、前記第2パルス信号のパルス幅の期間を前記基準周
波数に基づいてカウントする第2のタイマと、前記第2
のタイマのカウント値に基づいて前記商用電源の周波数
を決定し、決定した周波数に基づいて前記演算した入力
信号の周期を補正する周期補正手段とを備えたものであ
る。
According to a third aspect of the present invention, there is provided a cycle measuring circuit for measuring a cycle of an input signal, comprising: a clock device for generating a reference frequency; and a clock having a pulse width corresponding to the cycle of the input signal. A first signal conversion circuit for converting the first pulse signal into a first pulse signal; and a first signal conversion circuit for counting a period of a pulse width of the first pulse signal based on the reference frequency.
A timer for calculating the period of the input signal based on the count value; a second signal conversion circuit for converting a second pulse signal having a pulse width corresponding to a period of the commercial power supply; A second timer for counting a period of a pulse width of the pulse signal based on the reference frequency;
And a period correcting means for determining the frequency of the commercial power supply based on the count value of the timer, and correcting the calculated period of the input signal based on the determined frequency.

【0017】また、この発明の請求項4に係わる周期計
測回路は、入力信号の周期を計測する周期計測回路にお
いて、基準周波数を生成するクロック装置と、前記入力
信号の周期に応じたパルス幅の第1パルス信号に変換す
る第1の信号変換回路と、前記第1パルス信号のパルス
幅の期間を前記基準周波数に基づいてカウントする第1
のタイマと、前記カウント値に基づいて前記入力信号の
周期を演算する演算手段と、予め定めた商用電源の周波
数に基づいて前記演算した入力信号の周期を補正する周
期補正手段とを備えたものである。
According to a fourth aspect of the present invention, there is provided a cycle measuring circuit for measuring a cycle of an input signal, comprising: a clock device for generating a reference frequency; and a clock having a pulse width corresponding to the cycle of the input signal. A first signal conversion circuit for converting the first pulse signal into a first pulse signal; and a first signal conversion circuit for counting a period of a pulse width of the first pulse signal based on the reference frequency.
And a calculating means for calculating the cycle of the input signal based on the count value, and a cycle correcting means for correcting the cycle of the calculated input signal based on a predetermined frequency of the commercial power supply. It is.

【0018】また、この発明の請求項1に係わる周期計
測回路は、請求項1または請求項2の周期計測回路にお
いて、計測する入力信号が商用電源の場合、基準周波数
に基づいて計測した入力信号の周期と、商用電源の周期
( 周波数の逆数) とが所定の範囲内であると、前記基準
周波数に基づいて計測した入力信号の周期を採用するも
のである。
According to a first aspect of the present invention, there is provided a cycle measuring circuit according to the first or second aspect, wherein the input signal measured based on a reference frequency when the input signal to be measured is a commercial power supply. Cycle and commercial power cycle
When (reciprocal of frequency) is within a predetermined range, the cycle of the input signal measured based on the reference frequency is adopted.

【0019】[0019]

【発明の実施の形態】実施の形態1.図1は本発明の実
施の形態1における周期計測回路の回路構成を示すブロ
ック図、図2は図1の周期計測の動作を示すフロ−チャ
−ト、図3は図1の各部の信号を示すタイムチャ−トで
ある。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Embodiment 1 FIG. 1 is a block diagram showing a circuit configuration of a cycle measuring circuit according to the first embodiment of the present invention, FIG. 2 is a flowchart showing an operation of the cycle measuring circuit shown in FIG. 1, and FIG. It is a time chart shown.

【0020】図1において、1は商用電源、2はマイク
ロコンピュ−タ等の動作用電源を生成させる電源回路、
3、4は電源回路2により作られる電源で、3は例え
ば、+5V の正電源、4はGND である。50は入力信号
の周期を後述のクロック装置6が生成する基準周波数に
基いてカウントする第1のタイマ50aを内蔵し、周期
を演算するマイクロコンピュ−タ(以降マイコンと略
す)、6は入力信号をタイマ50aでカウントできる信
号レベルに変換する信号変換回路である。
In FIG. 1, 1 is a commercial power supply, 2 is a power supply circuit for generating a power supply for operation of a microcomputer or the like,
Reference numerals 3 and 4 denote power supplies generated by the power supply circuit 2. Reference numeral 3 denotes a positive power supply of, for example, + 5V, and reference numeral 4 denotes GND. Reference numeral 50 denotes a built-in first timer 50a for counting the period of an input signal based on a reference frequency generated by a clock device 6 described later, and a microcomputer for calculating the period (hereinafter abbreviated as a microcomputer). Is a signal conversion circuit that converts the signal level into a signal level that can be counted by the timer 50a.

【0021】7はマイコン50aが動作する際の基準周
波数を生成するクロック装置であり、セラミック発振子
等の発振素子8、コンデンサ9及び帰還抵抗10により
構成され、マイコン50に接続されている。11は商用
電源の電圧をマイコン50に内蔵した第2のタイマ50
b で周期計測できる信号レベル例えば0−5V のパルス
信号に変換する基準信号変換回路、51は任意の時間に
補正を実行させるためにマイコン50に接続された補正
スイッチである。
Reference numeral 7 denotes a clock device for generating a reference frequency when the microcomputer 50a operates. The clock device 7 includes an oscillation element 8, such as a ceramic oscillator, a capacitor 9, and a feedback resistor 10, and is connected to the microcomputer 50. Reference numeral 11 denotes a second timer 50 in which the voltage of the commercial power supply is built in the microcomputer 50.
Reference signal conversion circuit 51 converts the signal level into a pulse signal of, for example, 0-5 V, which can be measured at the period b. Reference numeral 51 denotes a correction switch connected to microcomputer 50 to execute correction at an arbitrary time.

【0022】次に図1から図3を用いて、動作について
説明する。 (1)定期もしくは不定期的に、商用電源1の電圧(図
3−イ)を基準信号変換回路11により変換したパルス
信号(図3−ロ)の立上がりエッジから立上がりエッジ
迄の区間を第2のタイマ50bを用いてカウントする。
(ステップ200)。なお、立下がりエッジから立下が
りエッジ、もしくは立上がりエッジから立下がりエッジ
をカウントするようにしても良い。
Next, the operation will be described with reference to FIGS. (1) A period from the rising edge to the rising edge of the pulse signal (FIG. 3-B) obtained by converting the voltage of the commercial power supply 1 (FIG. 3-A) by the reference signal conversion circuit 11 regularly or irregularly is defined as a second section. Is counted using the timer 50b.
(Step 200). The falling edge may be counted from the falling edge, or the falling edge may be counted from the rising edge.

【0023】(2)カウントの結果、第2のタイマ50
bがオ−バ−フロ−となっているか否かを判定(ステッ
プ201)し、第2のタイマ50bがオ−バ−フロ−と
なっている場合は、周期計測を中止し、タイマオ−バ−
フロ−に対して予め定められている他のル−チンへ移行
する(ステップ201)。なお、ステップ103の移行
先のル−チンが実行する内容は周期計測回路が利用され
る装置に応じてそれぞれ異なるものであり、周期計測回
路自体の動作については関係のないため説明を省略す
る。
(2) As a result of counting, the second timer 50
It is determined whether or not b has overflown (step 201). If the second timer 50b has overflown, the period measurement is stopped and the timer overflows. −
The flow shifts to another routine predetermined for the flow (step 201). Note that the contents executed by the routine at the transition destination in step 103 are different depending on the device in which the cycle measuring circuit is used, and the operation of the cycle measuring circuit itself is irrelevant, so that the description is omitted.

【0024】(3)カウントの結果、第2のタイマ50
bがオ−バ−フロ−になってない場合は、マイコン50
は第2のタイマ50bのカウント数を読出しマイコン5
に内蔵する図示しないRAM(ランダム・アクセス・メ
モリ)に格納する。(ステップ202) (4)RAMから読出した第2のタイマ50bのカウン
ト数により商用電源の周波数が50(Hz)であるか、
60(Hz)であるかを判定する(ステップ203)。
なお、閾値は例えば50.5(Hz)とし、閾値以上の
値の場合60(Hz)、閾値以下の値の場合50(H
z)と判定する。
(3) As a result of counting, the second timer 50
If b does not overflow, the microcomputer 50
Reads the count number of the second timer 50b and reads
Is stored in a RAM (random access memory) (not shown) built in the CPU. (Step 202) (4) Whether the frequency of the commercial power supply is 50 (Hz) based on the count number of the second timer 50b read from the RAM,
It is determined whether the frequency is 60 (Hz) (step 203).
The threshold value is, for example, 50.5 (Hz). When the value is equal to or greater than the threshold value, 60 (Hz), and when the value is equal to or less than the threshold value, 50 (H).
z) is determined.

【0025】例えば、基準周波数(図3−ハ)が10
(MHz)でその基準周期を8分周したタイマ周波数.
f(1.25MHz)を用いて商用電源の周期を計測し
た結果、第2のタイマ50bのカウント数(m1)が2
4800(回)の場合の基準信号周期計測値(T1)
は、式(2)で算出する。 T1=m1/f ―――――――――――(2) =24800(回)/1.25(MHz)=0.019
84(秒) となり、0.01984(秒)は50.40Hzに相当
し、 50.40(Hz)<50.5(Hz) となるので、この場合の商用電源は50(Hz)と判断
する。
For example, if the reference frequency (FIG. 3-C) is 10
Timer frequency obtained by dividing the reference cycle by 8 in (MHz).
As a result of measuring the cycle of the commercial power using f (1.25 MHz), the count number (m1) of the second timer 50b is 2
Reference signal cycle measurement value (T1) for 4800 (times)
Is calculated by equation (2). T1 = m1 / f ---------------- (2) = 24800 (times) /1.25 (MHz) = 0.019
84 (sec), and 0.01984 (sec) is equivalent to 50.40 Hz, and 50.40 (Hz) <50.5 (Hz). Therefore, the commercial power supply in this case is determined to be 50 (Hz). .

【0026】(5)上記の判断に基いた周波数を用い
て、第1のタイマ50aのタイマ周期を補正する(ステ
ップ204)。なお、補正タイマ周期(1/タイマ周波
数)は以下により導出される。 f1=(m1×n1)/C ―――――――――(3) f2=f1/n2 ―――――――――(4) f1:補正基準周波数 f2:補正タイマ周波数 m1:第2のタイマ50bによるカウント数 n1:第2のタイマ50bの分周数 C :商用電源周期 n2:第1のタイマ50aの分周数
(5) The timer cycle of the first timer 50a is corrected using the frequency based on the above judgment (step 204). Note that the correction timer cycle (1 / timer frequency) is derived as follows. f1 = (m1 × n1) / C ――――――――― (3) f2 = f1 / n2 ――――――――― (4) f1: Correction reference frequency f2: Correction timer frequency m1: Count number by the second timer 50b n1: frequency division number of the second timer 50b C: commercial power supply cycle n2: frequency division number of the first timer 50a

【0027】例えば、(4)により求めた商用電源の周
波数が50(Hz)、その商用電源周期を第2のタイマ
50bによりカウントしたカウント数(m1)が248
00、第2のタイマ50bの分周数(n1)が8の場合
の補正基準周波数(f1)は、 f1=(8×24800)/1/50=9.92(MH
z) 9.92(MHz)は1.008×10-6(秒)に相当
する。
For example, the frequency of the commercial power supply obtained in (4) is 50 (Hz), and the count number (m1) obtained by counting the cycle of the commercial power supply by the second timer 50b is 248.
00, the correction reference frequency (f1) when the frequency division number (n1) of the second timer 50b is 8 is: f1 = (8 × 24800) /1/50=9.92 (MH
z) 9.92 (MHz) corresponds to 1.008 × 10 −6 (second).

【0028】また、第1のタイマ50aの補正タイマ周
波数(f2)は、第1のタイマ50aの分周数(n2)
を8とすると、f 2=f1/n2=9.92/8=1.
24(MHz)となる。
The correction timer frequency (f2) of the first timer 50a is calculated by dividing the frequency (n2) of the first timer 50a.
Is set to 8, f2 = f1 / n2 = 9.92 / 8 = 1.
24 (MHz).

【0029】(6)定期もしくは不定期的に、マイコン
50は第1のタイマ50aのタイマ周期(図6−ニ)を
用いて、周期計測を実施する(ステップ101)。 (7)周期計測を完了すると、第1のタイマ50aがカ
ウントできるカウント数の上限値をオバ−フロ−したか
どうかのチェックを行う(ステップ102)。 (8)第1のタイマ50aがオ−バ−フロ−となってい
ることが確認された場合は、周期計測を中止し、オ−バ
−フロ−に対して予め定められている他のル−チンへ移
行する(ステップ103)。なお、ここで、ステップ1
03の移行先のル−チンが実行する内容は周期計測回路
が利用される装置に応じてそれぞれ異なるものであり、
周期計測回路自体の動作については関係がないため説明
を省略する。
(6) Periodically or irregularly, the microcomputer 50 performs a period measurement using the timer period of the first timer 50a (FIG. 6-D) (step 101). (7) When the cycle measurement is completed, it is checked whether or not the upper limit of the count number that can be counted by the first timer 50a has overflowed (step 102). (8) When it is confirmed that the first timer 50a is in the overflow state, the cycle measurement is stopped, and another predetermined timer for the overflow is determined. -Transfer to the chin (step 103). Here, step 1
The contents executed by the routine of the migration destination of 03 differ depending on the device in which the cycle measurement circuit is used,
Since the operation of the cycle measuring circuit itself has no relation, the description is omitted.

【0030】(9)ステップ102にて第1のタイマ5
0aがオ−バ−フロ−ではないことが確認された場合に
は、第1のタイマ50aのカウント数を読み出す。(ス
テップ104) (10)読み出したタイマn50aのカウント数と上記
にて導出した補正タイマ周波数(f2)により入力信号
の周期(T)を式(5)で演算する(ステップ10
5)。 T=m/f2 ―――――――――(5) T:周期計測値(秒) m:第1のタイマ50aによるカウント数(回) f 2:補正タイマ周波数(上記の例では、1.24MH
z)
(9) First timer 5 in step 102
When it is confirmed that 0a is not an overflow, the count number of the first timer 50a is read. (Step 104) (10) The period (T) of the input signal is calculated by the equation (5) using the read count number of the timer n50a and the correction timer frequency (f2) derived above (Step 10).
5). T = m / f2 ――――――――― (5) T: cycle measurement value (second) m: count number by the first timer 50a (times) f 2: correction timer frequency (in the above example, 1.24MH
z)

【0031】以上のように、例えば、発振素子8にセラ
ミック発振子を用いた場合には、使用する発振素子の部
品のバラツキ(±0.5%)、マイコンに内蔵される発
振用のNAND回路と発振子のマッチング特性(±0.
4%)、発振素子の周囲温度変化(±0.4%)、発振
素子の経年変化(±0.3%)などの最大±1.6%の
誤差により周期計測値はその誤差に相当する誤差を生じ
ることになるが、本発明によれば、商用電源の周波数精
度である±0.2H z(50H z時±0.4%、60H
z時±0.33%)の誤差内で周期計測を行なうため約
1.2%精度を向上することができる。
As described above, for example, when a ceramic resonator is used for the oscillation element 8, the variation of the components of the oscillation element to be used (± 0.5%) and the oscillation NAND circuit built in the microcomputer And oscillator matching characteristics (± 0.
4%), an ambient temperature change of the oscillation element (± 0.4%), an aging change of the oscillation element (± 0.3%), etc., the maximum of ± 1.6% of the error corresponds to the cycle measurement value. However, according to the present invention, the frequency accuracy of the commercial power supply is ± 0.2 Hz (± 0.4% at 50 Hz, 60 Hz).
Since the period measurement is performed within the error of ± 0.33% at z, the accuracy can be improved by about 1.2%.

【0032】なお、上記の実施の形態は第1のタイマ5
0aのタイマ周期の補正をマイコン50にあらかじめ設
定したソフトウエアに従って、定期的もしくは不定期に
実施する場合について述べたが、任意の時間に外部スイ
ッチ51を投入して補正させるようにしても良い。
In the above embodiment, the first timer 5
The description has been given of the case where the correction of the timer cycle of 0a is performed periodically or irregularly according to the software preset in the microcomputer 50. However, the correction may be performed by turning on the external switch 51 at an arbitrary time.

【0033】また、上記の実施の形態は商用電源の周波
数が50Hzまたは60Hzのどちらにでも適用可能な
周期計測回路において、周波数を判定して第1のタイマ
50aのタイマ周期を補正する場合について説明した
が、予め定めた周波数の商用電源に適用することも可能
であり、この場合は商用電源の周波数を判定するステッ
プ203が不要で、予め定められた周波数で第1のタイ
マ50aのタイマ周期を補正するようにすれば良い。
In the above embodiment, a description is given of a case where the frequency is determined and the timer cycle of the first timer 50a is corrected in a cycle measuring circuit applicable to a commercial power supply of either 50 Hz or 60 Hz. However, the present invention can also be applied to a commercial power supply having a predetermined frequency. In this case, the step 203 of determining the frequency of the commercial power supply is unnecessary, and the timer cycle of the first timer 50a is set to a predetermined frequency. What is necessary is just to correct it.

【0034】実施の形態2.実施の形態1では商用電源
の周波数で入力信号の周期を補正したが、この実施の形
態2は、計測対象の入力信号が商用電源の周期である場
合、計測した入力信号の周期と商用電源の周期(周波数
の逆数)とがあまり差がないとき、または両者の比が非
常に小さい場合は、商用電源での周波数による補正をせ
ず、補正前の入力信号の周期を採用するものである。
Embodiment 2 In the first embodiment, the cycle of the input signal is corrected with the frequency of the commercial power supply. However, in the second embodiment, when the input signal to be measured is the cycle of the commercial power supply, the cycle of the measured input signal and the frequency of the commercial power supply are corrected. When the period (the reciprocal of the frequency) is not so different, or when the ratio between the two is very small, the correction by the frequency with the commercial power supply is not performed, and the period of the input signal before the correction is adopted.

【0035】実施の形態1に示した下記の式より f1=(m1×n1)/C ―――――(3) f2=f1/n2 ――――――(4) T=m/f2 ――――――(5) f2=(m1×n1)/C /n2=(m1×n1)/n
2・C T=m/[(m1×n1)/n2・C] =m・n2・C/(m1×n1) ――――(6) となる。
From the following equation shown in the first embodiment, f1 = (m1 × n1) / C (3) f2 = f1 / n2 (4) T = m / f2 ------ (5) f2 = (m1 × n1) / C / n2 = (m1 × n1) / n
2 · CT = m / [(m1 × n1) / n2 · C] = m · n2 · C / (m1 × n1) (6)

【0036】第1と第2のタイマの分周数は同一(実施
の形態1では8)にしているので、n2=n1 とな
り、式(6)は T=m・C/m1 ――――(7) となり、補正した周期は第1と第2のタイマのカウント
数の比になる。従って、m1=24800 m=24801 であったとすると、補正せずに前述の式(1)であるT
=m/fの値をそのまま採用する。
Since the frequency division numbers of the first and second timers are the same (8 in the first embodiment), n2 = n1, and the equation (6) becomes T = m.C / m1. (7) and the corrected cycle is the ratio of the count numbers of the first and second timers. Therefore, if m1 = 24800 and m = 24801, T1 in the above equation (1) is not corrected.
= M / f is adopted as it is.

【0037】このように、m−m1が所定の範囲以内
(例えば、±10カウント以内)であった場合、また
は、両者の比が所定範囲以内(例えば、±0.1%以
内)であった場合は、補正計算をせず、そのまま採用し
て周期を算出する。このようにすると演算速度が速く、
CPUの負担も少なくなる。なお、m=m1となった場
合も補正計算をしないが、実施の形態1でもこの場合は
補正計算をしないようにしてもよい。
As described above, when m-m1 is within a predetermined range (for example, within ± 10 counts), or the ratio of both is within a predetermined range (for example, within ± 0.1%). In this case, the correction calculation is not performed, and the cycle is calculated by adopting the correction as it is. In this way, the calculation speed is high,
The burden on the CPU is also reduced. Note that the correction calculation is not performed when m = m1, but the correction calculation may not be performed in this case also in the first embodiment.

【0038】[0038]

【発明の効果】以上のように本発明によれば、発振周波
数精度の良くない発振子を用いて周期計測を実施した場
合など、基準周波数に誤差が生じるような場合において
も、商用電源の周波数に基づいて補正することにより、
精度の良い周期計測回路を提供することができる。
As described above, according to the present invention, even when an error occurs in the reference frequency, for example, when a period measurement is performed using an oscillator having poor oscillation frequency accuracy, the frequency of the commercial power By correcting based on
An accurate period measurement circuit can be provided.

【図面の簡単な説明】[Brief description of the drawings]

【図1】 本発明の実施の形態1における周期計測回路
の構成を示すブロック図である。
FIG. 1 is a block diagram illustrating a configuration of a period measurement circuit according to Embodiment 1 of the present invention.

【図2】 図1の周期計測の動作を示すフロ−チャ−ト
である。
FIG. 2 is a flowchart showing an operation of period measurement of FIG. 1;

【図3】 図1の各部の信号を示すタイムチャ−トであ
る。
FIG. 3 is a time chart showing signals of respective parts in FIG. 1;

【図4】 従来の周期計測回路のブロック図である。FIG. 4 is a block diagram of a conventional cycle measuring circuit.

【図5】 図4の周期計測の動作を示すフロ−チャ−ト
である。
FIG. 5 is a flowchart showing an operation of period measurement of FIG. 4;

【図6】 図5の各部の信号を示すタイムチャ−トであ
る。
FIG. 6 is a time chart showing signals of respective parts in FIG. 5;

【符号の説明】[Explanation of symbols]

1 商用電源、2 電源回路、6 信号変換回路、7
クロック装置、8 発振素子、11 基準信号変換回
路、50 マイクロコンピュ−タ、50a 第1のタイ
マ、50b 第2のタイマ、51 補正スイッチ。
1 commercial power supply, 2 power supply circuit, 6 signal conversion circuit, 7
Clock device, 8 oscillation element, 11 reference signal conversion circuit, 50 microcomputer, 50a first timer, 50b second timer, 51 correction switch.

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 入力信号の周期を計測する周期計測回路
において、クロック装置が発生する基準周波数に基づい
て入力信号の周期を計測する手段と、入力した商用電源
の周波数に基づいて前記入力信号の周期を補正する手段
を備えたことを特徴とする周期計測回路。
1. A cycle measuring circuit for measuring a cycle of an input signal, comprising: means for measuring a cycle of the input signal based on a reference frequency generated by a clock device; A cycle measuring circuit comprising means for correcting a cycle.
【請求項2】 入力信号の周期を計測する周期計測回路
において、クロック装置が発生する基準周波数に基づい
て入力信号の周期を計測する手段と、予め定めた商用電
源の周波数に基づいて前記入力信号の周期を補正する手
段を備えたことを特徴とする周期計測回路。
2. A cycle measuring circuit for measuring a cycle of an input signal, comprising: means for measuring a cycle of the input signal based on a reference frequency generated by a clock device; A period measuring circuit comprising means for correcting the period of the period.
【請求項3】 入力信号の周期を計測する周期計測回路
において、基準周波数を生成するクロック装置と、前記
入力信号の周期に応じたパルス幅の第1パルス信号に変
換する第1の信号変換回路と、前記第1パルス信号のパ
ルス幅の期間を前記基準周波数に基づいてカウントする
第1のタイマと、前記カウント値に基づいて前記入力信
号の周期を演算する演算手段と、商用電源の周期に応じ
たパルス幅の第2パルス信号に変換する第2の信号変換
回路と、前記第2パルス信号のパルス幅の期間を前記基
準周波数に基づいてカウントする第2のタイマと、前記
第2のタイマのカウント値に基づいて前記商用電源の周
波数を決定し、決定した周波数に基づいて前記演算した
入力信号の周期を補正する周期補正手段とを備えたこと
を特徴とする周期計測回路。
3. A cycle measuring circuit for measuring a cycle of an input signal, a clock device for generating a reference frequency, and a first signal conversion circuit for converting the input signal into a first pulse signal having a pulse width corresponding to the cycle of the input signal. A first timer that counts a period of the pulse width of the first pulse signal based on the reference frequency; a calculating unit that calculates a cycle of the input signal based on the count value; A second signal conversion circuit for converting a pulse width of the second pulse signal into a second pulse signal, a second timer for counting a period of the pulse width of the second pulse signal based on the reference frequency, and the second timer A period correction means for determining the frequency of the commercial power supply based on the count value of the above, and correcting the period of the calculated input signal based on the determined frequency. Measuring circuit.
【請求項4】 入力信号の周期を計測する周期計測回路
において、基準周波数を生成するクロック装置と、前記
入力信号の周期に応じたパルス幅の第1パルス信号に変
換する第1の信号変換回路と、前記第1パルス信号のパ
ルス幅の期間を前記基準周波数に基づいてカウントする
第1のタイマと、前記カウント値に基づいて前記入力信
号の周期を演算する演算手段と、予め定めた商用電源の
周波数に基づいて前記演算した入力信号の周期を補正す
る周期補正手段とを備えたことを特徴とする周期計測回
路。
4. A cycle measuring circuit for measuring a cycle of an input signal, a clock device for generating a reference frequency, and a first signal conversion circuit for converting the input signal into a first pulse signal having a pulse width corresponding to the cycle of the input signal. A first timer for counting a period of a pulse width of the first pulse signal based on the reference frequency; a calculating means for calculating a cycle of the input signal based on the count value; A period correction unit for correcting the period of the input signal calculated based on the frequency of the period.
【請求項5】 請求項1または請求項2の周期計測回路
において、計測する入力信号が商用電源の場合、基準周
波数に基づいて計測した入力信号の周期と、商用電源の
周期( 周波数の逆数) とが所定の範囲内であると、前記
基準周波数に基づいて計測した入力信号の周期を採用す
ることを特徴とする周期計測回路。
5. The cycle measuring circuit according to claim 1, wherein, when the input signal to be measured is a commercial power supply, a cycle of the input signal measured based on a reference frequency and a cycle of the commercial power supply (reciprocal of frequency). A period of the input signal measured based on the reference frequency, when the period is within a predetermined range.
JP2000394918A 2000-12-26 2000-12-26 Period measuring circuit Pending JP2002196024A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000394918A JP2002196024A (en) 2000-12-26 2000-12-26 Period measuring circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000394918A JP2002196024A (en) 2000-12-26 2000-12-26 Period measuring circuit

Publications (1)

Publication Number Publication Date
JP2002196024A true JP2002196024A (en) 2002-07-10

Family

ID=18860469

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000394918A Pending JP2002196024A (en) 2000-12-26 2000-12-26 Period measuring circuit

Country Status (1)

Country Link
JP (1) JP2002196024A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1501195A1 (en) * 2003-07-25 2005-01-26 Siemens Building Technologies AG Circuit arrangement to generate a clock signal for a sigma-delta analog-to-digital converter
CN114157133A (en) * 2021-11-15 2022-03-08 海信(广东)空调有限公司 Power factor self-adaptive control method and device, storage medium and air conditioner

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0552791U (en) * 1991-12-16 1993-07-13 日本ビクター株式会社 Clock counter

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0552791U (en) * 1991-12-16 1993-07-13 日本ビクター株式会社 Clock counter

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1501195A1 (en) * 2003-07-25 2005-01-26 Siemens Building Technologies AG Circuit arrangement to generate a clock signal for a sigma-delta analog-to-digital converter
CN114157133A (en) * 2021-11-15 2022-03-08 海信(广东)空调有限公司 Power factor self-adaptive control method and device, storage medium and air conditioner

Similar Documents

Publication Publication Date Title
US7545228B1 (en) Dynamic temperature compensation for a digitally controlled oscillator using dual MEMS resonators
EP1262755B1 (en) Temperature sensing circuit and calibration method
JPS6310370B2 (en)
GB2104690A (en) Electronic timepiece having a quartz crystal oscillator circuit
US20180076816A1 (en) Temperature measurement circuit, integrated circuit, and temperature measurement method
EP0822479A2 (en) Clock system
JPH0856153A (en) Oscillation circuit having frequency correction function
JPH11154826A (en) Method and circuit for generating frequency
JP2002196024A (en) Period measuring circuit
JP2018164188A (en) Temperature compensator, temperature compensation type oscillator, and temperature compensation method
JPS6260656B2 (en)
JP4036114B2 (en) Clock generation circuit
JP2003232876A (en) Time correction device
JPH11298317A (en) Counting device, capacitance type sensor and frequency difference measurement device
JPS59225323A (en) Electronic thermometer
JPH1155035A (en) Method and device for correcting temperature of oscillation circuit
JPH0352590B2 (en)
JPH0245837Y2 (en)
JPH1125831A (en) Timer with temperature-compasating function and temperature regulator
JP2001217708A (en) Frequency oscillator
JP3216303B2 (en) Sphygmomanometer pressure measuring device
JP2007304007A (en) Error correction method for timepiece
JPH02294113A (en) Pulse generating circuit
JP3825565B2 (en) Integration type A / D conversion calibration method and integration type A / D converter
JPH1151782A (en) Semiconductor device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070613

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100401

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100601

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20101019