JP2006030136A - Real-time clock circuit, semiconductor integrated circuit, and watt-hour meter device - Google Patents

Real-time clock circuit, semiconductor integrated circuit, and watt-hour meter device Download PDF

Info

Publication number
JP2006030136A
JP2006030136A JP2004213283A JP2004213283A JP2006030136A JP 2006030136 A JP2006030136 A JP 2006030136A JP 2004213283 A JP2004213283 A JP 2004213283A JP 2004213283 A JP2004213283 A JP 2004213283A JP 2006030136 A JP2006030136 A JP 2006030136A
Authority
JP
Japan
Prior art keywords
clock signal
circuit
data
counter
bus
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
JP2004213283A
Other languages
Japanese (ja)
Inventor
Shigeru Ito
茂 伊藤
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.)
Toshiba Corp
Kioxia Systems Co Ltd
Original Assignee
Toshiba Corp
Toshiba Memory Systems 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 Toshiba Corp, Toshiba Memory Systems Co Ltd filed Critical Toshiba Corp
Priority to JP2004213283A priority Critical patent/JP2006030136A/en
Publication of JP2006030136A publication Critical patent/JP2006030136A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Electric Clocks (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To generate a clock signal for highly-accurate time clocking by correcting an oscillation error generated from an individual error or the like of a vibrator used for a real-time clock circuit. <P>SOLUTION: This clock circuit is equipped with a frequency divider 12 for generating a window pulse Pw1 from a reference clock signal CLKref, oscillation circuits 19, 25 for generating clock signals CLK1, CLK2, first and second selection circuits 26, 29, the first AND gate circuit 13 into which a clock signal selected by the first selection circuit and the window pulse are inputted, a counter 30 for counting outputs from the second selection circuit, a resister 31, a comparator 32 for comparing count data from the counter 30 with data stored in the resister and generating a clock signal CLK3 for time clocking, the second AND gate circuit 34 into which the clock signals CLK3, CLK2 are inputted, and a counter 35 for counting outputs from the second AND gate circuit. The clock circuit is characterized by storing count data from the first counter or count data from the second counter in the resister 31. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、時刻計時に使用されるクロック信号を発生するリアルタイムクロック回路及びこれを内蔵した半導体集積回路並びに該半導体集積回路を搭載した電力量計装置に関する。   The present invention relates to a real-time clock circuit for generating a clock signal used for timekeeping, a semiconductor integrated circuit incorporating the clock signal, and a watt-hour meter device mounting the semiconductor integrated circuit.

リアルタイムクロック回路で発生されるクロック信号をカウンタ等で計数することで時刻計時が行われる。従来の簡単なリアルタイムクロック回路では、32.768KHzで発振する水晶振動子を用いた発振回路が用いられる。この発振回路で発生されるクロック信号は分周器で16分周され、これが1秒のパルス信号として用いられる。さらに、この1秒のパルス信号が、分用カウンタ及び時間用カウンタで順次カウントされることで時計を構成することができる。   Time counting is performed by counting a clock signal generated by the real-time clock circuit with a counter or the like. In a conventional simple real-time clock circuit, an oscillation circuit using a crystal resonator that oscillates at 32.768 KHz is used. The clock signal generated by this oscillation circuit is divided by 16 by a frequency divider, and this is used as a 1-second pulse signal. Further, the 1-second pulse signal is sequentially counted by the minute counter and the time counter, whereby a timepiece can be configured.

しかし、水晶振動子はもともと個体誤差(ばらつき)を持っている。また、発振回路で使用される負荷容量コンデンサの誤差、さらには使用環境温度などによっても発振周波数は少なからず変動する。このように、幾つもの要因が絡み合っているために、水晶振動子を用いた発振回路では、予め発振誤差を予測することは非常に困難である。例えば、32.768KHzの水晶振動子を用いて1秒をカウントする際に、1クロック分の誤差が生じたとすると、その水晶振動子の特性は(1/32768)=30.5ppmの誤差を持つ。この誤差は1日当りでは約2.63秒((1/32768)×60×60×24)の誤差となり、1カ月(31日)当りでは約81.53秒の誤差となる。このようなばらつき誤差は、製品にリアルタイムクロック回路を組み込んだ後でも時刻の再調整が頻繁にできるシステムならば問題となることは少ない。しかし、時刻調整がなかなか行えない場合には、時間が経過する程、時計の誤差が拡大する。   However, crystal resonators originally have individual errors (variations). In addition, the oscillation frequency fluctuates not a little depending on the error of the load capacitor used in the oscillation circuit, and also on the usage environment temperature. Thus, since several factors are intertwined, it is very difficult to predict an oscillation error in advance in an oscillation circuit using a crystal resonator. For example, if an error of one clock occurs when counting one second using a 32.768 kHz crystal unit, the characteristic of the crystal unit has an error of (1/32768) = 30.5 ppm. This error is approximately 2.63 seconds ((1/32768) × 60 × 60 × 24) per day, and approximately 81.53 seconds per month (31 days). Such a variation error is less likely to be a problem in a system in which the time can be readjusted even after a real-time clock circuit is incorporated into the product. However, if the time cannot be adjusted easily, the time error increases as time elapses.

リアルタイムクロック回路を組み込んだ製品の一例として電力量計装置がある。この電力量計装置では、使用電力量に基づいて電力料金が自動的に計算される。深夜電力料金は昼間の電力料金よりも安価に設定される場合があり、そのような場合には時間帯に応じて単位電力量当りの価格を変更して電力料金を計算する必要がある。その際、時間帯を判断するためには、時刻を正確に計時する必要がある。しかし、時刻調整が行えない場合には、時間が経過する程、時計の誤差が拡大し、電力料金が正確に計算できなくなる。   One example of a product incorporating a real-time clock circuit is a watt-hour meter device. In this watt-hour meter device, a power charge is automatically calculated based on the amount of power used. In some cases, the midnight power charge is set at a lower price than the daytime power charge. In such a case, it is necessary to change the price per unit power amount according to the time zone and calculate the power charge. At that time, in order to determine the time zone, it is necessary to measure the time accurately. However, if the time cannot be adjusted, the time error increases as time elapses, making it impossible to calculate the power rate accurately.

なお、特許文献1には、外部から基準クロックを電子機器に入力し、この基準クロックを使って計時した所定の測定時間の間、水晶振動子の発振クロックをカウントし、基準クロックを使って計時した測定時間の間、誤差補正機能付きリアルタイムクロック回路のクロック出力をカウントし、測定結果のカウント値と既知の調整目標カウント値との差分をとることで補正値を算出し、算出した補正値を誤差補正機能付きリアルタイムクロック回路に設定するようにしたリアルタイムクロックの時刻補正方法及び装置が記載されている。
特開2003−270369号公報
In Patent Document 1, a reference clock is input from the outside to an electronic device, and the oscillation clock of the crystal unit is counted for a predetermined measurement time measured using the reference clock, and the time is measured using the reference clock. During the measurement time, the clock output of the real-time clock circuit with error correction function is counted, the correction value is calculated by taking the difference between the count value of the measurement result and the known adjustment target count value, and the calculated correction value is A time correction method and apparatus for a real time clock set in a real time clock circuit with an error correction function is described.
JP 2003-270369 A

本発明は上記のような事情を考慮してなされたものであり、その目的は、発振回路で発生されるクロック信号にばらつきが生じても、正確な計時を行うためのクロック信号を生成できるリアルタイムクロック回路を提供することにある。   The present invention has been made in consideration of the above-described circumstances, and an object of the present invention is to provide a real-time signal that can generate a clock signal for accurate time measurement even if the clock signal generated in the oscillation circuit varies. It is to provide a clock circuit.

また、本発明の目的は、発振回路で発生されるクロック信号にばらつきが生じても、正確な計時を行うためのクロック信号を生成できるリアルタイムクロック回路を内蔵した半導体集積回路を提供することにある。   Another object of the present invention is to provide a semiconductor integrated circuit having a built-in real-time clock circuit that can generate a clock signal for performing accurate timing even if the clock signal generated by the oscillation circuit varies. .

さらに、本発明の目的は、クロック信号を計数して時刻の計時を行うリアルタイムクロック回路を内蔵し、時間帯に応じて異なる複数の課金情報の中から計時時刻の時間帯に応じた課金情報を選択し、この課金情報と使用電力量とに応じて使用電力料金を算出する半導体集積回路を搭載した電力量計装置において、発振回路で発生されるクロック信号にばらつきが生じても正確な計時を行うためのクロック信号を生成でき、もって時間帯に応じた電力料金を正確に算出できる電力量計装置を提供することにある。   Furthermore, an object of the present invention is to incorporate a real-time clock circuit that counts clock signals and counts the time, and from among a plurality of charging information that varies depending on the time zone, charging information corresponding to the time zone of the timing time is provided. In the watt-hour meter device equipped with the semiconductor integrated circuit that selects and calculates the power usage fee according to the billing information and the power usage amount, even if the clock signal generated in the oscillation circuit varies, it is possible to accurately measure the time. It is an object of the present invention to provide a watt-hour meter device that can generate a clock signal to be performed and can accurately calculate a power charge according to a time zone.

本発明のリアルタイムクロック回路は、基準クロック信号を分周してウインドウパルスを生成する分周器と、第1の周期を有する第1のクロック信号を発生する第1の発振回路と、前記第1の周期よりも長い第2の周期を有する第2のクロック信号を発生する第2の発振回路と、前記第1及び第2のクロック信号のいずれか一方のクロック信号を選択して出力する第1の選択回路と、前記第1の選択回路で選択されたクロック信号と前記ウインドウパルスとの論理積をとる第1の論理積回路と、前記第1の選択回路で選択されたクロック信号及び前記第1の論理積回路の出力のいずれか一方を選択して出力する第2の選択回路と、前記第2の選択回路の出力をカウントする第1のカウンタと、所定のデータが格納されるレジスタと、前記第1のカウンタのカウントデータを前記レジスタに格納されたデータと比較して時刻計時用のクロック信号を生成する比較器と、前記時刻計時用のクロック信号及び前記第2のクロック信号との論理積をとる第2の論理積回路と、前記第2の論理積回路の出力をカウントする第2のカウンタとを具備し、前記レジスタには、前記第1のカウンタのカウントデータもしくはこのカウントデータを一定数で除算したデータ、または前記第2のカウンタのカウントデータもしくはこのカウントデータを一定数で除算したデータが格納されることを特徴とする。   The real-time clock circuit according to the present invention includes a frequency divider that divides a reference clock signal to generate a window pulse, a first oscillation circuit that generates a first clock signal having a first period, and the first A second oscillation circuit that generates a second clock signal having a second period longer than the first period, and a first clock signal that selects and outputs one of the first and second clock signals. Selection circuit, a first AND circuit that takes a logical product of the clock signal selected by the first selection circuit and the window pulse, the clock signal selected by the first selection circuit, and the first A second selection circuit that selects and outputs one of the outputs of the AND circuit, a first counter that counts the output of the second selection circuit, and a register that stores predetermined data The first A comparator that generates a clock signal for timekeeping by comparing the count data of the counter with the data stored in the register, and a logical product of the clock signal for timekeeping and the second clock signal. 2 and a second counter that counts the output of the second AND circuit, and the register divides the count data of the first counter or the count data by a fixed number. Or the count data of the second counter or the data obtained by dividing the count data by a fixed number is stored.

本発明のリアルタイムクロック回路は、基準クロック信号を分周してウインドウパルスを生成し、このウインドウパルスの生成期間に、発振回路で発生されるクロック信号をカウントし、そのカウント数に応じたデータをレジスタに格納し、前記クロック信号を再度、カウントし、比較器によりこのカウントデータを前記レジスタに格納されているデータと比較して時刻計時用のクロック信号を生成することを特徴とする。   The real-time clock circuit of the present invention generates a window pulse by dividing the reference clock signal, counts the clock signal generated by the oscillation circuit during the generation period of the window pulse, and outputs data corresponding to the count number. The clock signal is stored in a register, the clock signal is counted again, and the count data is compared with the data stored in the register by a comparator to generate a clock signal for time measurement.

本発明のリアルタイムクロック回路は、基準クロック信号を分周してウインドウパルスを生成し、このウインドウパルスの生成期間に、第1の発振回路で発生される第1の周期を有する第1のクロック信号をカウントしてそのカウント数に応じたデータをレジスタに格納し、前記第1のクロック信号を再度、カウントし、比較器によりこのカウントデータを前記レジスタに格納されているデータと比較して第1の時刻計時用のクロック信号を生成し、前記第1の時刻計時用のクロック信号をウインドウパルスとして用いて、このウインドウパルスの生成期間に、第2の発振回路で発生される前記第1の周期よりも長い第2の周期を有する第2のクロック信号をカウントしてそのカウント数に応じたデータを前記レジスタに再度、格納し、前記第2のクロック信号を再度、カウントし、前記比較器によりこのカウントデータを前記レジスタに格納されているデータと比較して第2の時刻計時用のクロック信号を生成することを特徴とする。   The real-time clock circuit of the present invention divides the reference clock signal to generate a window pulse, and a first clock signal having a first period generated by the first oscillation circuit during the generation period of the window pulse. And the data corresponding to the counted number is stored in the register, the first clock signal is counted again, and the comparator compares this count data with the data stored in the register to obtain the first Of the first clock generated by the second oscillation circuit during the generation period of the window pulse using the first clock signal for the clock as a window pulse. A second clock signal having a longer second period is counted, and data corresponding to the counted number is stored again in the register, and The second clock signal again, counted, by the comparator and generates a clock signal of the second time timekeeping compared with the data stored the count data in the register.

本発明の半導体集積回路は、外部端子から入力される基準クロック信号を分周してウインドウパルスを生成する分周器と、制御用データを生成する中央演算処理装置と、前記中央演算処理装置に接続され、前記中央演算処理装置で生成された制御データを伝達するバスと、外部端子を介して水晶振動子が接続され、第1の周期を有する第1のクロック信号を発生する第1の発振回路と、外部端子を介して水晶振動子が接続され、前記第1の周期よりも長い第2の周期を有する第2のクロック信号を発生する第2の発振回路と、前記バスに接続され、前記バス上の制御用データに応じて、第1及び第2のクロック信号のいずれか一方のクロック信号を選択して出力する第1の選択回路と、前記第1の選択回路で選択されたクロック信号と前記ウインドウパルスとの論理積をとる第1の論理積回路と、前記バスに接続され、前記バス上の制御用データに応じて、前記第1の選択回路で選択されたクロック信号及び前記第1の論理積回路の出力のいずれか一方を選択して出力する第2の選択回路と、前記バスに接続され、前記第2の選択回路の出力をカウントする第1のカウンタと、前記バスに接続され、前記バス上のデータが格納されるレジスタと、前記第1のカウンタのカウントデータを前記レジスタに格納されたデータと比較して時刻計時用のクロック信号を生成する比較器と、前記比較器で生成されたクロック信号及び前記第2のクロック信号との論理積をとる第2の論理積回路と、前記バスに接続され、前記第2の論理積回路の出力をカウントする第2のカウンタとを具備したリアルタイムクロック回路を内蔵し、前記レジスタには、前記第1のカウンタのカウントデータもしくはこのカウントデータが前記中央演算処理装置によって一定数で除算された後のデータ、または前記第2のカウンタのカウントデータもしくはこのカウントデータが前記中央演算処理装置によって一定数で除算されたデータが格納されることを特徴とする。   A semiconductor integrated circuit according to the present invention includes a frequency divider that divides a reference clock signal input from an external terminal to generate a window pulse, a central processing unit that generates control data, and the central processing unit A first oscillator for generating a first clock signal having a first period, connected to a bus for transmitting control data generated by the central processing unit, and a crystal resonator via an external terminal A crystal oscillator connected via an external terminal, a second oscillation circuit for generating a second clock signal having a second period longer than the first period, and the bus, A first selection circuit that selects and outputs one of the first and second clock signals according to the control data on the bus, and a clock selected by the first selection circuit Signal and the above A first logical product circuit that performs a logical product with a window pulse, and a clock signal connected to the bus and selected by the first selection circuit according to control data on the bus, and the first logical circuit A second selection circuit that selects and outputs one of the outputs of the product circuit; a first counter that is connected to the bus and counts an output of the second selection circuit; and is connected to the bus; A register for storing data on the bus, a comparator for comparing the count data of the first counter with the data stored in the register and generating a clock signal for time measurement, and generated by the comparator A second logical product circuit that performs a logical product of the clock signal and the second clock signal, and a second counter that is connected to the bus and counts the output of the second logical product circuit. did It has an internal time clock circuit, and the register has the count data of the first counter or the data after the count data is divided by a fixed number by the central processing unit, or the count of the second counter Data or data obtained by dividing the count data by a predetermined number by the central processing unit is stored.

本発明の電力量計装置は、商用交流電源に接続され、使用電力量に応じた周波数を有するパルス信号を生成する電力量測定部と、前記パルス信号をカウントして使用電力量を算出すると共に、時刻計時用のクロック信号を生成し、このクロック信号を計数して時刻の計時を行うリアルタイムクロック回路を内蔵し、時間帯に応じて異なる複数の課金情報の中から計時時刻の時間帯に応じた課金情報を選択し、この課金情報と前記算出された使用電力量とに応じて使用電力料金を算出する半導体集積回路とを具備し、前記半導体集積回路は、外部端子から入力される基準クロック信号を分周してウインドウパルスを生成する分周器と、制御用データを生成する中央演算処理装置と、前記中央演算処理装置に接続され、前記中央演算処理装置で生成された制御データを伝達するバスと、外部端子を介して水晶振動子が接続され、第1の周期を有する第1のクロック信号を発生する第1の発振回路と、外部端子を介して水晶振動子が接続され、前記第1の周期よりも長い第2の周期を有する第2のクロック信号を発生する第2の発振回路と、前記バスに接続され、前記バス上の制御用データに応じて、第1及び第2のクロック信号のいずれか一方のクロック信号を選択して出力する第1の選択回路と、前記第1の選択回路で選択されたクロック信号と前記ウインドウパルスとの論理積をとる第1の論理積回路と、前記バスに接続され、前記バス上の制御用データに応じて、前記第1の選択回路で選択されたクロック信号及び前記第1の論理積回路の出力のいずれか一方を選択して出力する第2の選択回路と、前記バスに接続され、前記第2の選択回路の出力をカウントする第1のカウンタと、前記バスに接続され、前記バス上のデータが格納されるレジスタと、前記第1のカウンタのカウントデータを前記レジスタに格納されたデータと比較して時刻計時用のクロック信号を生成する比較器と、前記比較器で生成されたクロック信号及び前記第2のクロック信号との論理積をとる第2の論理積回路と、前記バスに接続され、前記第2の論理積回路の出力をカウントする第2のカウンタとを有し、前記レジスタには、前記第1のカウンタのカウントデータもしくはこのカウントデータが前記中央演算処理装置によって一定数で除算された後のデータ、または前記第2のカウンタのカウントデータもしくはこのカウントデータが前記中央演算処理装置によって一定数で除算されたデータが格納されることを特徴とする。   The watt-hour meter device of the present invention is connected to a commercial AC power source, generates a pulse signal having a frequency corresponding to the amount of power used, and calculates the amount of power used by counting the pulse signal. Built-in real-time clock circuit that generates a clock signal for timekeeping and counts the clock signal to count the time, and responds to the time zone of the time from among multiple billing information that varies depending on the time zone And a semiconductor integrated circuit that calculates a usage power charge according to the charging information and the calculated power consumption. The semiconductor integrated circuit includes a reference clock input from an external terminal. A frequency divider that divides a signal to generate a window pulse, a central processing unit that generates control data, and a central processing unit that is connected to the central processing unit and is generated by the central processing unit A crystal oscillator is connected to the bus for transmitting the control data, a crystal oscillator via an external terminal, and generates a first clock signal having a first period, and the crystal oscillation via the external terminal A second oscillation circuit for generating a second clock signal having a second period longer than the first period, and a child connected to the bus, in accordance with control data on the bus A first selection circuit that selects and outputs one of the first and second clock signals, and a logical product of the clock signal selected by the first selection circuit and the window pulse. A first logical product circuit that is connected to the bus and selected by the first selection circuit in accordance with control data on the bus and an output of the first logical product circuit Select one of them and output Two selection circuits, a first counter connected to the bus and counting the output of the second selection circuit, a register connected to the bus and storing data on the bus, and the first A logical product of a comparator that compares the count data of the counter with the data stored in the register to generate a clock signal for timekeeping, and the clock signal generated by the comparator and the second clock signal And a second counter that is connected to the bus and counts the output of the second AND circuit, and the register includes count data of the first counter. Alternatively, the data after the count data is divided by a fixed number by the central processing unit, or the count data of the second counter or the count data is the intermediate data Data divided by a fixed number by the central processing unit is stored.

本発明のリアルタイムクロック回路によれば、発振回路で発生されるクロック信号にばらつきが生じても、正確な計時を行うためのクロック信号を生成することができる。   According to the real-time clock circuit of the present invention, it is possible to generate a clock signal for performing accurate timing even if the clock signal generated in the oscillation circuit varies.

また、本発明のリアルタイムクロック回路を内蔵した半導体集積回路では、発振回路で発生されるクロック信号にばらつきが生じても、正確な計時を行うためのクロック信号を生成することができる。   In the semiconductor integrated circuit incorporating the real-time clock circuit of the present invention, a clock signal for accurate time measurement can be generated even if the clock signal generated by the oscillation circuit varies.

さらに、本発明の電力量計装置では、発振回路で発生されるクロック信号にばらつきが生じても正確な計時を行うためのクロック信号を生成でき、もって時間帯に応じて電力料金を正確に算出することができる。   Furthermore, in the watt-hour meter device of the present invention, it is possible to generate a clock signal for accurate time measurement even if the clock signal generated in the oscillation circuit varies, and thus accurately calculate the power rate according to the time zone. can do.

以下、図面を参照して本発明を実施の形態により説明する。図1は本発明に係る半導体集積回路からリアルタイムクロック回路に関連した回路部分のみを抽出して示す回路図である。外部端子11には、予め校正された数Hzから数十Hzの基準クロック信号CLKrefが半導体集積回路の外部から供給される。外部端子11には分周器12が接続されている。分周器12は、基準クロック信号CLKrefを分周し、所定期間のウインドウパルスPw1を生成する。このウインドウパルスPw1は第1のANDゲート回路(第1の論理積回路)13の一方の入力端子に供給される。   The present invention will be described below with reference to the drawings. FIG. 1 is a circuit diagram showing only a circuit portion related to a real-time clock circuit extracted from a semiconductor integrated circuit according to the present invention. The external terminal 11 is supplied with a reference clock signal CLKref calibrated in advance from several Hz to several tens Hz from the outside of the semiconductor integrated circuit. A frequency divider 12 is connected to the external terminal 11. The frequency divider 12 divides the reference clock signal CLKref to generate a window pulse Pw1 for a predetermined period. This window pulse Pw1 is supplied to one input terminal of the first AND gate circuit (first AND circuit) 13.

一対の外部端子14a、14b間には、発振用の水晶振動子15が接続される。また、この一対の各外部端子14a、14bと接地電位ノードとの間には、負荷容量コンデンサ16がそれぞれ接続されている。半導体集積回路の内部では、上記一対の外部端子14a、14b間に、発振用の反転回路17と帰還用の抵抗素子18とが並列に接続されている。そして、これら水晶振動子15、負荷容量コンデンサ16、反転回路17及び抵抗素子18により第1の発振回路19が構成される。この第1の発振回路19は、発振周波数が例えば数MHzとなるように水晶振動子15の固有振動数が選択される。   An oscillation crystal resonator 15 is connected between the pair of external terminals 14a and 14b. A load capacitor 16 is connected between the pair of external terminals 14a and 14b and the ground potential node. Inside the semiconductor integrated circuit, an oscillation inverting circuit 17 and a feedback resistance element 18 are connected in parallel between the pair of external terminals 14a and 14b. The crystal oscillator 15, the load capacitor 16, the inverting circuit 17, and the resistance element 18 constitute a first oscillation circuit 19. In the first oscillation circuit 19, the natural frequency of the crystal unit 15 is selected so that the oscillation frequency becomes several MHz, for example.

さらに、一対の外部端子20a、20b間には、発振用の水晶振動子21が接続される。また、この一対の各外部端子20a、20bと接地電位ノードとの間には、負荷容量コンデンサ22がそれぞれ接続されている。半導体集積回路の内部では、上記一対の外部端子20a、20b間に、発振用の反転回路23と帰還用の抵抗素子24とが並列に接続されている。そして、これら水晶振動子21、負荷容量コンデンサ22、反転回路23及び抵抗素子24により第2の発振回路25が構成される。この第2の発振回路25は、発振周波数が例えば数KHzとなるように水晶振動子21の固有振動数が選択される。   Further, an oscillation crystal resonator 21 is connected between the pair of external terminals 20a and 20b. A load capacitor 22 is connected between the pair of external terminals 20a and 20b and the ground potential node. Inside the semiconductor integrated circuit, an oscillation inverting circuit 23 and a feedback resistance element 24 are connected in parallel between the pair of external terminals 20a and 20b. The crystal oscillator 21, the load capacitor 22, the inverting circuit 23, and the resistance element 24 constitute a second oscillation circuit 25. In the second oscillation circuit 25, the natural frequency of the crystal unit 21 is selected so that the oscillation frequency is, for example, several KHz.

第1及び第2の発振回路19、25内に設けられた発振用の反転回路17、23はそれぞれ制御信号に応じて動作が制御され、これらの制御信号により第1及び第2の発振回路19、25の発振動作の可否が選択される。発振動作時に、第1の発振回路19は第1の周期を持つ第1のクロック信号CLK1を発生し、第2の発振回路25は第1の周期よりも長い第2の周期を持つ第2のクロック信号CLK2を発生する。つまり、第2のクロック信号CLK2は第1のクロック信号CLK1よりも低い周波数を持ち、第1の発振回路19は高速で発振し、第2の発振回路25は低速で発振する。   The operations of the inverting circuits 17 and 23 for oscillation provided in the first and second oscillation circuits 19 and 25 are controlled according to control signals, respectively, and the first and second oscillation circuits 19 are controlled by these control signals. , 25 is selected to enable or disable the oscillation operation. During the oscillation operation, the first oscillation circuit 19 generates a first clock signal CLK1 having a first period, and the second oscillation circuit 25 has a second period having a second period longer than the first period. Generate clock signal CLK2. That is, the second clock signal CLK2 has a frequency lower than that of the first clock signal CLK1, the first oscillation circuit 19 oscillates at high speed, and the second oscillation circuit 25 oscillates at low speed.

第1及び第2の発振回路19、25で発生される第1のクロック信号CLK1及び第2のクロック信号CLK2は共に第1の選択回路26に供給される。第1の選択回路26は、CPU27に接続されたバス28上を伝達される制御データに応じて、第1のクロック信号CLK1及び第2のクロック信号CLK2のいずれか一方のクロック信号を選択して出力する。第1の選択回路26で選択されたクロック信号は、第1のANDゲート回路13の他方の入力端子に供給される。   Both the first clock signal CLK 1 and the second clock signal CLK 2 generated by the first and second oscillation circuits 19 and 25 are supplied to the first selection circuit 26. The first selection circuit 26 selects one of the first clock signal CLK1 and the second clock signal CLK2 in accordance with the control data transmitted on the bus 28 connected to the CPU 27. Output. The clock signal selected by the first selection circuit 26 is supplied to the other input terminal of the first AND gate circuit 13.

また、第1の選択回路26で選択されたクロック信号及び第1のANDゲート回路13の出力は共に第2の選択回路29に供給される。第2の選択回路29は、上記バス28上を伝達される制御データに応じて、第1の選択回路26で選択されたクロック信号及び第1のANDゲート回路13の出力のいずれか一方を選択して出力する。第2の選択回路29で選択された信号は、第1のカウンタ(カウンタ1)30に供給される。第1のカウンタ30は、第2の選択回路29から選択出力される信号をカウントする。第1のカウンタ30のカウントデータはバス28を介してCPU27に送られる。CPU27は、第1のカウンタ30のカウントデータをそのまま、もしくはこのカウントデータを一定数で除算したデータを不揮発性記憶装置、例えばE2PROM等に記憶させると共に、そのデータをバス28を介してレジスタ31に送り、格納させる。 The clock signal selected by the first selection circuit 26 and the output of the first AND gate circuit 13 are both supplied to the second selection circuit 29. The second selection circuit 29 selects either the clock signal selected by the first selection circuit 26 or the output of the first AND gate circuit 13 in accordance with the control data transmitted on the bus 28. And output. The signal selected by the second selection circuit 29 is supplied to the first counter (counter 1) 30. The first counter 30 counts the signals selected and output from the second selection circuit 29. The count data of the first counter 30 is sent to the CPU 27 via the bus 28. The CPU 27 stores the count data of the first counter 30 as it is or the data obtained by dividing the count data by a fixed number in a non-volatile storage device such as an E 2 PROM, and the data is stored in the register via the bus 28. 31 to be stored.

第1のカウンタ30のカウントデータ及びレジスタ31に格納されたデータは比較器32で比較され、時刻計時用のクロック信号CLK3が生成される。比較器32で生成された時刻計時用のクロック信号CLK3は、図示しない計時用の分周器に送られて時刻計時が行われると共に、さらに分周器33によって分周された後、第2のANDゲート回路(第2の論理積回路)34の一方の入力端子に供給される。この第2のANDゲート回路34の他方の入力端子には、第2の発振回路25で発生される第2のクロック信号CLK2が供給される。第2のANDゲート回路34の出力は第2のカウンタ(カウンタ2)35に供給される。第2のカウンタ35は第2のANDゲート回路34の出力をカウントする。第2のカウンタ34のカウントデータは、バス28を介してCPU27に送られる。CPU27は、第2のカウンタ34のカウントデータをそのまま、もしくはこのカウントデータを一定数で除算したデータを不揮発性記憶装置、例えば先のE2PROM等に記憶させると共に、そのデータをバス28を介してレジスタ31に送り、格納させる。 The count data of the first counter 30 and the data stored in the register 31 are compared by a comparator 32 to generate a clock signal CLK3 for timekeeping. The time clock signal CLK3 generated by the comparator 32 is sent to a clock frequency divider (not shown) for time clocking and further divided by the frequency divider 33, and then the second clock signal CLK3. This is supplied to one input terminal of an AND gate circuit (second AND circuit) 34. A second clock signal CLK2 generated by the second oscillation circuit 25 is supplied to the other input terminal of the second AND gate circuit. The output of the second AND gate circuit 34 is supplied to a second counter (counter 2) 35. The second counter 35 counts the output of the second AND gate circuit 34. The count data of the second counter 34 is sent to the CPU 27 via the bus 28. The CPU 27 stores the count data of the second counter 34 as it is or the data obtained by dividing the count data by a fixed number in a non-volatile storage device such as the E 2 PROM and the data via the bus 28. To the register 31 for storage.

なお、第1及び第2の発振回路19、25で発生される第1のクロック信号CLK1及び第2のクロック信号CLK2は、CPU27が処理動作を行う際に同期信号として使用される。高速で発振する第1の発振回路19は、CPU27が大きな処理能力を必要とする際に動作し、低速で発振する第2の発振回路25は、CPU27がそれ程大きな処理能力を必要としない場合や、半導体集積回路に供給される電源が遮断され、電池によるバックアップ動作が行われる場合等に動作するように、前記制御信号によって制御される。   Note that the first clock signal CLK1 and the second clock signal CLK2 generated by the first and second oscillation circuits 19 and 25 are used as synchronization signals when the CPU 27 performs a processing operation. The first oscillation circuit 19 that oscillates at a high speed operates when the CPU 27 requires a large processing capacity, and the second oscillation circuit 25 that oscillates at a low speed does not require a large processing capacity. The control signal is controlled so as to operate when the power supplied to the semiconductor integrated circuit is cut off and a backup operation using a battery is performed.

上記構成でなる半導体集積回路において、第1、第2の発振回路19、25で発生される第1、第2のクロック信号CLK1、CLK2は、時刻計時用のクロック信号CLK3を生成するために使用される。前述したように水晶振動子はもともと個体誤差を持っており、負荷容量コンデンサの誤差、さらには使用環境温度などによって、発振回路の発振周波数が変動する。従って、第1、第2のクロック信号CLK1、CLK2を使用して生成される時刻計時用のクロック信号CLK3にもばらつきが生じる。そこで、半導体集積回路の工場出荷時に、図1に示されるリアルタイムクロック回路内の水晶振動子の精度測定及び補正が行われる。   In the semiconductor integrated circuit having the above configuration, the first and second clock signals CLK1 and CLK2 generated by the first and second oscillation circuits 19 and 25 are used to generate a clock signal CLK3 for timekeeping. Is done. As described above, the crystal unit originally has an individual error, and the oscillation frequency of the oscillation circuit varies depending on the error of the load capacitor and the use environment temperature. Therefore, the clock signal CLK3 for timekeeping generated using the first and second clock signals CLK1 and CLK2 also varies. Therefore, when the semiconductor integrated circuit is shipped from the factory, accuracy measurement and correction of the crystal resonator in the real-time clock circuit shown in FIG. 1 are performed.

この精度測定及び補正は、以下のようにして行われる。まず、半導体集積回路が動作状態にされ、予め校正された数〜数十Hzの正確な基準クロック信号CLKrefが外部端子11から入力される。この際、第1、第2の発振回路19、25は動作させる。基準クロック信号CLKrefが入力される際、第1の選択回路26が第1の発振回路19で発生されるクロック信号CLK1を選択し、第2の選択回路29が第1のANDゲート回路13の出力を選択するように、第1、第2の選択回路26、29がCPU27の処理により切り換え制御される。このときの図1の回路の接続状態を図2に抽出して示す。外部端子11から入力される基準クロック信号CLKrefが分周器12で分周されることにより、例えば1秒の期間を有するウインドウパルスPw1が生成され、第1のANDゲート回路13の一方の入力端子に入力される。一方、第1の発振回路19で発生される第1のクロック信号CLK1が、第1の選択回路26を介して、第1のANDゲート回路13の他方の入力端子に入力される。そして、ウインドウパルスPw1が成立している期間に、第1のANDゲート回路13から第1のクロック信号CLK1が出力され、第1のカウンタ30によりカウントされる。これにより、正確な1秒の期間に発生する第1のクロック信号CLK1のクロック数が測定される。この測定が終了した後は、外部から入力される基準クロック信号CLKrefは切り離すことができ、その後はCPU27による処理が行われる。   This accuracy measurement and correction is performed as follows. First, the semiconductor integrated circuit is set in an operating state, and an accurate reference clock signal CLKref calibrated in advance of several to several tens Hz is input from the external terminal 11. At this time, the first and second oscillation circuits 19 and 25 are operated. When the reference clock signal CLKref is input, the first selection circuit 26 selects the clock signal CLK 1 generated by the first oscillation circuit 19, and the second selection circuit 29 outputs the output of the first AND gate circuit 13. The first and second selection circuits 26 and 29 are controlled to be switched by the processing of the CPU 27 so as to select. The connection state of the circuit of FIG. 1 at this time is extracted and shown in FIG. By dividing the reference clock signal CLKref input from the external terminal 11 by the frequency divider 12, for example, a window pulse Pw1 having a period of 1 second is generated, and one input terminal of the first AND gate circuit 13 is generated. Is input. On the other hand, the first clock signal CLK 1 generated by the first oscillation circuit 19 is input to the other input terminal of the first AND gate circuit 13 via the first selection circuit 26. Then, during the period when the window pulse Pw1 is established, the first clock signal CLK1 is output from the first AND gate circuit 13 and counted by the first counter 30. As a result, the number of clocks of the first clock signal CLK1 generated in an accurate 1 second period is measured. After this measurement is completed, the reference clock signal CLKref input from the outside can be disconnected, and thereafter the processing by the CPU 27 is performed.

第1のカウンタ30のカウントデータは、CPU27の転送命令等により、バス28を介してCPU27に読み込まれ、カウントデータがそのまま、もしくはこのカウントデータが一定数で除算されたデータが不揮発性記憶装置に記憶されると共に、そのデータが再びバス28を介してレジスタ31に転送され、格納される。なお、ウインドウパルスPw1の成立期間が上記のように1秒である場合には、カウンタ30のカウントデータがそのままレジスタ31に転送されて格納される。しかし、分周器12の分周数を増加させるなどして、ウインドウパルスPw1の成立期間が1秒以上に設定されている場合には、CPU27に読み出されたカウンタ30のカウントデータが、CPU27の演算命令などで、ウインドウパルスPw1の成立期間に対応した秒数である一定数で除算されて1秒の期間のデータに変換され、この変換後のデータが不揮発性記憶装置に記憶されると共にレジスタ31に格納される。   The count data of the first counter 30 is read into the CPU 27 via the bus 28 by a transfer instruction of the CPU 27, and the count data is left as it is or data obtained by dividing the count data by a certain number is stored in the nonvolatile storage device. In addition to being stored, the data is transferred again to the register 31 via the bus 28 and stored. If the window pulse Pw1 is established for 1 second as described above, the count data of the counter 30 is transferred to the register 31 and stored as it is. However, when the establishment period of the window pulse Pw1 is set to 1 second or more by increasing the frequency division number of the frequency divider 12, the count data of the counter 30 read by the CPU 27 is the CPU 27. Is divided by a fixed number that is the number of seconds corresponding to the establishment period of the window pulse Pw1 and converted into data of a period of 1 second, and the converted data is stored in the nonvolatile memory device. Stored in the register 31.

この後、第2の選択回路29が第1の選択回路26の出力を選択するように、第2の選択回路29がCPU27の処理により切り換え制御される。第1の選択回路26の選択動作は変化しない。このときの図1の回路の接続状態を図3に抽出して示す。このとき、レジスタ31には、正確な1秒の期間に発生する第1のクロック信号CLK1のクロック数に対応したデータが格納されている。そして、第1の発振回路19で発生される第1のクロック信号CLK1が第1のカウンタ30によりカウントされ、そのカウントデータが比較器32によりレジスタ31に格納されているデータと比較される。これにより、比較器32では、誤差の少ない周期が1秒のクロック信号CLK3が生成される。このクロック信号CLK3を分周することによって、精度の高い時計を実現できる。   Thereafter, the second selection circuit 29 is controlled to be switched by the processing of the CPU 27 so that the second selection circuit 29 selects the output of the first selection circuit 26. The selection operation of the first selection circuit 26 does not change. The connection state of the circuit of FIG. 1 at this time is extracted and shown in FIG. At this time, the register 31 stores data corresponding to the number of clocks of the first clock signal CLK1 generated in an accurate period of 1 second. Then, the first clock signal CLK 1 generated by the first oscillation circuit 19 is counted by the first counter 30, and the count data is compared with the data stored in the register 31 by the comparator 32. As a result, the comparator 32 generates the clock signal CLK3 having a 1-second period with less error. By dividing the clock signal CLK3, a highly accurate timepiece can be realized.

このように、外部から入力される正確な基準クロック信号CLKrefを用いて秒単位(例えば1秒)のウインドウパルスPw1を生成し、このウインドウパルスPw1が成立している期間、高い発振周波数(MHz以上)を持つ第1のクロック信号CLK1のカウント数をカウンタ30で測定すると、第1のクロック信号CLK1を用いて1秒を計時するために必要なクロック数を求めることができる。この際の測定最小単位はカウンタ30の1クロック分となるため、測定時に最大で第1のクロック信号CLK1の半クロック分の分解能誤差が発生する。また、ウインドウパルスPw1の立ち上がり及び立ち下がり時に、それぞれ1クロック分、合わせて最大2クロック分の測定誤差が生じる。ただし、これは外部から入力される正確な基準クロック信号CLKrefを分周する分周器12の分周数を増加させて、例えば16秒などのようにウインドウパルスPw1の成立期間を長くして、カウンタ30による測定時間を長くすると、全体の誤差に対して測定誤差の割合を小さくできる。   In this way, a window pulse Pw1 in units of seconds (for example, 1 second) is generated using an accurate reference clock signal CLKref input from the outside, and a high oscillation frequency (MHz or higher) during the period in which the window pulse Pw1 is established. When the count number of the first clock signal CLK1 having () is measured by the counter 30, the number of clocks necessary for counting one second can be obtained using the first clock signal CLK1. Since the minimum measurement unit at this time is one clock of the counter 30, a resolution error corresponding to a half clock of the first clock signal CLK1 occurs at the time of measurement. Further, when the window pulse Pw1 rises and falls, a measurement error corresponding to one clock and a total of two clocks occurs. However, this increases the frequency division number of the frequency divider 12 that divides the accurate reference clock signal CLKref inputted from the outside, and elongates the establishment period of the window pulse Pw1, such as 16 seconds, If the measurement time by the counter 30 is lengthened, the ratio of the measurement error to the total error can be reduced.

全体の誤差は、カウンタ30の分解能に基づく分解能誤差と、測定誤差との和で表わされ、第1のクロック信号CLK1の周波数をf1(Hz)、測定時間をt1(s)とすると、分解能誤差は(1/f1×2)、測定誤差は(2/f1×t1)となり、全体の誤差は(1/f1×2)+(2/f1×t1)(ppm)となる。仮に第1の発振回路19を1MHzで動作させたときに実際の発振周波数が1000010Hzだった場合、補正を行わないときの第1のクロック信号CLK1は10ppmの誤差を持つことになる。これに対し、カウンタ30における測定時間を16秒にすると、比較器32で生成されるクロックCLK3の誤差は0.625ppmに減少する。   The total error is expressed as the sum of the resolution error based on the resolution of the counter 30 and the measurement error. When the frequency of the first clock signal CLK1 is f1 (Hz) and the measurement time is t1 (s), the resolution is The error is (1 / f1 × 2), the measurement error is (2 / f1 × t1), and the total error is (1 / f1 × 2) + (2 / f1 × t1) (ppm). If the actual oscillation frequency is 10,00010 Hz when the first oscillation circuit 19 is operated at 1 MHz, the first clock signal CLK1 without correction has an error of 10 ppm. On the other hand, when the measurement time in the counter 30 is 16 seconds, the error of the clock CLK3 generated by the comparator 32 is reduced to 0.625 ppm.

次に、比較器32で生成されたクロックCLK3が分周器33で分周されることにより、例えば1秒の期間を有するウインドウパルスPw2が生成され、第2のANDゲート回路34の一方の入力端子に入力される。一方、第2の発振回路25で発生される第2のクロック信号CLK2が第2のANDゲート回路34の他方の入力端子に入力される。このときの図1の回路の接続状態を図4に抽出して示す。ウインドウパルスPw2が成立している期間に、第2のANDゲート回路34から第2のクロック信号CLK2が出力され、第2のカウンタ35によりカウントされる。これにより、正確な1秒の期間に発生する第2のクロック信号CLK2のクロック数が測定される。   Next, the clock CLK3 generated by the comparator 32 is divided by the frequency divider 33, thereby generating a window pulse Pw2 having a period of 1 second, for example, and one input of the second AND gate circuit 34. Input to the terminal. On the other hand, the second clock signal CLK 2 generated by the second oscillation circuit 25 is input to the other input terminal of the second AND gate circuit 34. The connection state of the circuit of FIG. 1 at this time is extracted and shown in FIG. During the period in which the window pulse Pw2 is established, the second clock signal CLK2 is output from the second AND gate circuit 34 and counted by the second counter 35. As a result, the number of clocks of the second clock signal CLK2 generated in an accurate 1 second period is measured.

第2のカウンタ35のカウントデータは、CPU27の転送命令等により、バス28を介してCPU27に読み込まれ、カウントデータがそのまま、もしくはこのカウントデータが一定数で除算されたデータが不揮発性記憶装置に記憶されると共に、そのデータが再びバス28を介してレジスタ31に転送され、格納される。なお、ウインドウパルスPw2の成立期間が上記のように1秒である場合には、カウンタ35のカウントデータがそのままレジスタ31に格納される。しかし、分周器33の分周数を増加させるなどして、ウインドウパルスPw2の成立期間が1秒以上である場合には、CPU27に読み出されたカウンタ35のカウントデータは、CPU27の演算命令などで、ウインドウパルスPw2の成立期間に対応した秒数である一定数で除算されて1秒の期間のデータに変換され、この変換後のデータがレジスタ31に格納される。   The count data of the second counter 35 is read into the CPU 27 via the bus 28 by a transfer instruction of the CPU 27, and the count data is left as it is or data obtained by dividing the count data by a certain number is stored in the nonvolatile storage device. In addition to being stored, the data is transferred again to the register 31 via the bus 28 and stored. When the window pulse Pw2 is established for 1 second as described above, the count data of the counter 35 is stored in the register 31 as it is. However, when the window pulse Pw2 is established for 1 second or more by increasing the frequency division number of the frequency divider 33, the count data of the counter 35 read to the CPU 27 is the operation instruction of the CPU 27. Thus, the data is divided by a fixed number, which is the number of seconds corresponding to the establishment period of the window pulse Pw2, and converted into data of a period of 1 second, and the converted data is stored in the register 31.

この後、第1の選択回路26が第1の発振回路25で発生されるクロック信号CLK2を選択するように、第1の選択回路26がCPU27の処理により切り換え制御される。第2の選択回路29の選択動作は変化しない。このときの図1の回路の接続状態を図5に抽出して示す。このとき、レジスタ31には、正確な1秒の期間に発生する第2のクロック信号CLK2のクロック数に応じたデータが格納されている。そして、第2の発振回路25で発生される第2のクロック信号CLK2が第1のカウンタ30によりカウントされ、そのカウントデータが比較器32によりレジスタ31に格納されているデータと比較されることにより、比較器32からは誤差の少ない周期が1秒のクロック信号CLK3が生成される。このクロック信号CLK3を分周することによって、精度の高い時計を実現できる。   Thereafter, the first selection circuit 26 is controlled to be switched by the processing of the CPU 27 so that the first selection circuit 26 selects the clock signal CLK2 generated by the first oscillation circuit 25. The selection operation of the second selection circuit 29 does not change. The connection state of the circuit of FIG. 1 at this time is extracted and shown in FIG. At this time, the register 31 stores data corresponding to the number of clocks of the second clock signal CLK2 generated in an accurate period of 1 second. Then, the second clock signal CLK2 generated by the second oscillation circuit 25 is counted by the first counter 30, and the counted data is compared with the data stored in the register 31 by the comparator 32. The comparator 32 generates a clock signal CLK3 having a 1-second period with little error. By dividing the clock signal CLK3, a highly accurate timepiece can be realized.

ところで、図1に示すようなリアルタイムクロック回路を内蔵した半導体集積回路を実際の製品に組み込んで計時動作を行わせる場合に、安定して電源電圧が供給されるときは、図3に示すように、第1の発振回路19が動作し、第1の発振回路19で発生される第1のクロック信号CLK1が第1の選択回路26及び第2の選択回路29を介して第1のカウンタ30に供給され、第1のカウンタ30で第1のクロック信号CLK1がカウントされる。そして、第1のカウンタ30のカウントデータがレジスタ31に格納されているデータと比較される。このとき、レジスタ31には、外部から入力される正確な基準クロック信号CLKrefを用いて生成される秒単位のウインドウパルスPw1が成立している期間に、第1のクロック信号CLK1がカウンタ30でカウントされた後のデータが格納されている。なお、この期間、第2の発振回路25の動作は、制御信号より停止されている。   By the way, when a semiconductor integrated circuit having a built-in real-time clock circuit as shown in FIG. 1 is incorporated in an actual product to perform a timing operation, when a power supply voltage is stably supplied, as shown in FIG. The first oscillation circuit 19 operates, and the first clock signal CLK1 generated by the first oscillation circuit 19 is sent to the first counter 30 via the first selection circuit 26 and the second selection circuit 29. Then, the first counter 30 counts the first clock signal CLK1. Then, the count data of the first counter 30 is compared with the data stored in the register 31. At this time, in the register 31, the first clock signal CLK1 is counted by the counter 30 during the period in which the window pulse Pw1 in seconds generated using the accurate reference clock signal CLKref input from the outside is established. The data after being stored is stored. During this period, the operation of the second oscillation circuit 25 is stopped by the control signal.

従って、安定して電源電圧が供給されるときは、高速で発振する第1の発振回路19で発生される第1のクロック信号CLK1を用いて、誤差の少ない周期が1秒のクロック信号CLK3が生成される。   Therefore, when the power supply voltage is stably supplied, the first clock signal CLK1 generated by the first oscillation circuit 19 that oscillates at high speed is used to generate the clock signal CLK3 having a 1-second error-free period. Generated.

一方、半導体集積回路に供給されている電源電圧が遮断し、電池によるバックアップ動作が行われる場合は、図5に示すように、第2の発振回路25が動作し、第2の発振回路25で発生される第2のクロック信号CLK2が第1の選択回路26及び第2の選択回路29を介して第1のカウンタ30に供給され、第1のカウンタ30で第2のクロック信号CLK2がカウントされる。そして、第1のカウンタ30のカウントデータがレジスタ31に格納されているデータと比較される。このとき、レジスタ31には、図4に示すように、クロック信号CLK3を用いて生成される秒単位のウインドウパルスPw2が成立している期間に、第2のクロック信号CLK2が第2のカウンタ35でカウントされた後のデータが格納されている。なお、この期間、第1の発振回路19の動作は、制御信号より停止されている。   On the other hand, when the power supply voltage supplied to the semiconductor integrated circuit is cut off and a backup operation by a battery is performed, the second oscillation circuit 25 operates as shown in FIG. The generated second clock signal CLK2 is supplied to the first counter 30 via the first selection circuit 26 and the second selection circuit 29, and the second clock signal CLK2 is counted by the first counter 30. The Then, the count data of the first counter 30 is compared with the data stored in the register 31. At this time, as shown in FIG. 4, the register 31 receives the second clock signal CLK2 from the second counter 35 during the period in which the window pulse Pw2 in seconds generated using the clock signal CLK3 is established. Stores the data after being counted in. During this period, the operation of the first oscillation circuit 19 is stopped by the control signal.

従って、電池によるバックアップ動作が行われる場合は、低速で発振する第2の発振回路25で発生される第2のクロック信号CLK2を用いて、誤差の少ない周期が1秒のクロック信号CLK3が生成される。   Therefore, when the backup operation by the battery is performed, the second clock signal CLK2 generated by the second oscillation circuit 25 that oscillates at a low speed is used to generate the clock signal CLK3 having a cycle with a small error of 1 second. The

さらに、電源電圧が復帰した後は、図3に示すように、第1の発振回路19が動作し、第1の発振回路19で発生される第1のクロック信号CLK1が第1の選択回路26及び第2の選択回路29を介して第1のカウンタ30に供給され、カウントデータがレジスタ31に格納されているデータと比較されることで、誤差の少ない周期が1秒のクロック信号CLK3が生成される。このとき、レジスタ31には、外部から入力される正確な基準クロック信号CLKrefを用いて生成される秒単位のウインドウパルスPw1が成立している期間に、第1のクロック信号CLK1がカウンタ30でカウントされた後のデータが格納される。   Further, after the power supply voltage is restored, as shown in FIG. 3, the first oscillation circuit 19 operates, and the first clock signal CLK1 generated by the first oscillation circuit 19 is changed to the first selection circuit 26. The clock signal CLK3 is supplied to the first counter 30 via the second selection circuit 29 and the count data is compared with the data stored in the register 31 to generate a clock signal CLK3 having a one-second period with little error. Is done. At this time, in the register 31, the first clock signal CLK1 is counted by the counter 30 during the period in which the window pulse Pw1 in seconds generated using the accurate reference clock signal CLKref input from the outside is established. The data after being stored is stored.

このように、上記実施の形態の半導体集積回路によれば、工場出荷時に、外部端子11から、予め校正された正確な基準クロック信号CLKrefを入力して、リアルタイムクロック回路内の水晶振動子の精度測定及び補正を行うことにより、その後、実際の製品に組み込んだ後は内部の発振回路を動作させて誤差の少ない周期が1秒のクロック信号CLK3を生成することができる。しかも、安定して電源電圧が供給されている場合や、電源電圧が遮断して電池によるバックアップ動作が行われる場合でも、誤差の少ない周期が1秒のクロック信号CLK3を生成することができる。もちろん、電源電圧の遮断後に電源電圧が復帰した後でも、外部から基準クロック信号CLKrefを入力することなく、誤差の少ない周期が1秒のクロック信号CLK3を生成することができる。   As described above, according to the semiconductor integrated circuit of the above-described embodiment, the accurate reference clock signal CLKref calibrated in advance is input from the external terminal 11 at the time of factory shipment, and the accuracy of the crystal resonator in the real-time clock circuit is obtained. By performing measurement and correction, the clock signal CLK3 having a 1-second period with less error can be generated by operating the internal oscillation circuit after incorporation into an actual product. Moreover, even when the power supply voltage is stably supplied or when the power supply voltage is cut off and the battery backup operation is performed, the clock signal CLK3 having a 1-second cycle with less error can be generated. Of course, even after the power supply voltage is restored after the power supply voltage is cut off, the clock signal CLK3 having a one-second period with less error can be generated without inputting the reference clock signal CLKref from the outside.

図6は、本発明に係るリアルタイムクロック回路を内蔵した半導体集積回路の応用例を示すブロック図である。本応用例は、図1に示す半導体集積回路を、深夜電力料金と昼間電力料金とが異なる商用交流電源の使用電力量に基づいて電力料金を自動的に計算する電力量計装置に適用したものである。   FIG. 6 is a block diagram showing an application example of a semiconductor integrated circuit incorporating a real-time clock circuit according to the present invention. In this application example, the semiconductor integrated circuit shown in FIG. 1 is applied to a watt-hour meter device that automatically calculates a power charge based on the amount of power used by a commercial AC power supply with a different midnight power charge and daytime power charge. It is.

図6において、50は図1に示すような構成を有するリアルタイムクロック回路を内蔵した半導体集積回路である。この半導体集積回路50において、外部端子CIN1及びCOUT1は図1中の外部端子14a、14bに相当し、両外部端子CIN1及びCOUT1に先の第1の発振回路19を構成する水晶振動子15及び負荷容量コンデンサ16が接続される。同様に、外部端子CIN2及びCOUT2は図1中の外部端子20a、20bに相当し、両外部端子CIN2及びCOUT2に先の第2の発振回路25を構成する水晶振動子21及び負荷容量コンデンサ22が接続される。   In FIG. 6, reference numeral 50 denotes a semiconductor integrated circuit incorporating a real-time clock circuit having the configuration shown in FIG. In this semiconductor integrated circuit 50, the external terminals CIN1 and COUT1 correspond to the external terminals 14a and 14b in FIG. 1, and both the external terminals CIN1 and COUT1 have the crystal oscillator 15 and the load constituting the first oscillation circuit 19 described above. A capacitor 16 is connected. Similarly, the external terminals CIN2 and COUT2 correspond to the external terminals 20a and 20b in FIG. 1, and the crystal oscillator 21 and the load capacitance capacitor 22 constituting the second oscillation circuit 25 are connected to both the external terminals CIN2 and COUT2. Connected.

また、この半導体集積回路50では、図1中に示すように、第1、第2の発振回路19、25で発生される第1、第2のクロック信号CLK1、CLK2を第1のカウンタ30でカウントし、さらに比較器32においてレジスタ31に格納されているデータと比較されることで生成される1秒の周期を有するクロック信号CLK3を分周して、秒、分、時からなる時刻を計時する時刻計時機能を有する。   In the semiconductor integrated circuit 50, as shown in FIG. 1, the first counter 30 generates the first and second clock signals CLK1 and CLK2 generated by the first and second oscillation circuits 19 and 25, respectively. The clock signal CLK3 having a period of 1 second generated by counting and comparing with the data stored in the register 31 in the comparator 32 is divided to measure the time consisting of seconds, minutes, and hours. It has a timekeeping function.

図6において、60は200Vまたは100Vの商用交流電源の使用電力量を測定する電力量測定部である。この電力量測定部60は、例えばΔΣAD変換用半導体集積回路(ΔΣAD変換IC)を有し、商用交流電源の交流パルス(電圧/電流)を測定し、数Hzないし数KHzのデジタルパルス信号に変換して出力する。変換されたパルス信号の周波数は使用電力量に比例する。つまり、周波数が高い程、電力を多く使用していることになる。このパルス信号は、使用電力量表示部70に設けられた機械式の表示器71のステップモータに駆動パルスとして供給されることで、使用した累積電力量が数値表示される。使用電力量表示部70は、上記機械式の表示器71の他に例えば液晶表示器(LCD)からなるフロントパネル(Front Panel)72を有する。フロントパネル72では、半導体集積回路50から出力される種々の表示情報に基づいて表示がなされる。   In FIG. 6, reference numeral 60 denotes a power amount measuring unit that measures the amount of power used by a 200V or 100V commercial AC power supply. This electric energy measuring unit 60 has, for example, a ΔΣ AD conversion semiconductor integrated circuit (ΔΣ AD conversion IC), measures an AC pulse (voltage / current) of a commercial AC power supply, and converts it into a digital pulse signal of several Hz to several KHz. And output. The frequency of the converted pulse signal is proportional to the amount of power used. In other words, the higher the frequency, the more power is used. This pulse signal is supplied as a drive pulse to a step motor of a mechanical display 71 provided in the used electric energy display unit 70, whereby the used accumulated electric energy is displayed numerically. The power consumption display unit 70 has a front panel 72 made of, for example, a liquid crystal display (LCD) in addition to the mechanical display 71 described above. The front panel 72 performs display based on various display information output from the semiconductor integrated circuit 50.

また、電力量測定部60から出力されるデジタルパルス信号は、フォトカプラ(Photo coupler)61を介して、半導体集積回路50の電力測定入力用の外部端子(I/O)に供給される。   The digital pulse signal output from the power amount measuring unit 60 is supplied to an external terminal (I / O) for power measurement input of the semiconductor integrated circuit 50 through a photo coupler 61.

80は、商用交流電源から直流電圧を発生する電源回路(Regulator)である。この電源回路80で発生される直流電圧は、ダイオード81を介して半導体集積回路50の電源電圧供給用の外部端子(VDD)に供給されると共に、半導体集積回路50の電源電圧検出用の外部端子(I/O)に供給される。また、電源遮断時のバックアップ用の電池82が、ダイオード83を介して半導体集積回路50の電源電圧供給用の外部端子(VDD)に接続されている。   A power supply circuit (Regulator) 80 generates a DC voltage from a commercial AC power supply. The DC voltage generated by the power supply circuit 80 is supplied to the power supply voltage supply external terminal (VDD) of the semiconductor integrated circuit 50 through the diode 81 and the power supply voltage detection external terminal of the semiconductor integrated circuit 50. (I / O). Further, a backup battery 82 at the time of power-off is connected to an external terminal (VDD) for supplying power supply voltage of the semiconductor integrated circuit 50 via a diode 83.

半導体集積回路50では、電源回路80で直流電圧が発生されている時にこれが検出され、先の第1の発振回路19(図1中に図示)で発生される第1のクロック信号CLK1がカウンタ30(図1中に図示)でカウントされ、比較器32(図1中に図示)で比較されることで1秒の周期を持つパルス信号CLK3が生成され、さらにパルス信号CLK3が分周されることで時刻が計時される。   In the semiconductor integrated circuit 50, when the DC voltage is generated in the power supply circuit 80, this is detected, and the first clock signal CLK1 generated in the first oscillation circuit 19 (shown in FIG. 1) is the counter 30. A pulse signal CLK3 having a period of 1 second is generated by counting with a comparator 32 (illustrated in FIG. 1) and comparing with a comparator 32 (illustrated in FIG. 1), and further dividing the pulse signal CLK3. The time is counted at.

一方、半導体集積回路50では、電力測定入力用の外部端子(I/O)に供給されるデジタルパルス信号がカウントされることで使用電力量が測定され、この測定された使用電力量と、時間帯に応じて異なる複数の課金情報の中から計時時刻の時間帯に応じた課金情報を選択し、この課金情報と算出された使用電力量とに応じて使用電力料金が計算される。計算された電力料金は、課金情報として不揮発性記憶装置、例えばE2PROM90に格納される。なお、図1中のCPU27は、第1のカウンタ30のカウントデータ、もしくはこのカウントデータを一定数で除算したデータをこのE2PROM90に格納してもよい。 On the other hand, in the semiconductor integrated circuit 50, the power consumption is measured by counting the digital pulse signal supplied to the external terminal (I / O) for power measurement input, and the measured power consumption and time Billing information corresponding to the time zone of the clocking time is selected from a plurality of billing information that differs depending on the band, and the power consumption fee is calculated according to the billing information and the calculated power consumption. The calculated power charge is stored in a non-volatile storage device, for example, E 2 PROM 90, as billing information. The CPU 27 in FIG. 1 may store the count data of the first counter 30 or data obtained by dividing the count data by a certain number in the E 2 PROM 90.

また、半導体集積回路50には、主に赤外線LED(発光ダイオード)及び赤外線受光素子を接続するための外部端子(UART/SIO)が設けられている。そして、この外部端子に接続された赤外線LED及び赤外線受光素子を介して、検針用の外部端末との間で光による情報の授受が行われ、E2PROM90に格納されている月単位の課金情報が検針用の外部端末に供給され、単価変更及び機能変更のための情報が半導体集積回路50に供給される。単価変更及び機能変更の際に、入力情報に基づいて半導体集積回路50で表示用情報が生成され、この表示用情報がフロントパネル72に供給されることで、単価変更及び機能変更の際の情報がフロントパネル72で表示されるようにしてもよい。 The semiconductor integrated circuit 50 is provided with an external terminal (UART / SIO) mainly for connecting an infrared LED (light emitting diode) and an infrared light receiving element. Then, information is exchanged by light with the external terminal for meter reading through the infrared LED and infrared light receiving element connected to the external terminal, and the monthly billing information stored in the E 2 PROM 90 Is supplied to the external terminal for meter reading, and information for changing the unit price and changing the function is supplied to the semiconductor integrated circuit 50. When the unit price is changed and the function is changed, display information is generated by the semiconductor integrated circuit 50 based on the input information, and the display information is supplied to the front panel 72, so that the information when the unit price is changed and the function is changed. May be displayed on the front panel 72.

一方、交流電源が遮断され、電源回路80で直流電圧が発生されなくなり、半導体集積回路50でこの状態で検出されると、先の第1の発振回路19に代わって第2の発振回路25が動作状態にされ、この第2の発振回路25で発生される第2のクロック信号CLK2がカウンタ30でカウントされ、比較器32で比較されることで1秒の周期を持つパルス信号CLK3が生成され、さらにパルス信号CLK3が分周されることで時刻が計時される。すなわち、図1に示すようなリアルタイムクロック回路を内蔵した半導体集積回路50では、常に安定して現在時刻を計時することができるので、交流電源が遮断した後でも、ほぼ正確に時刻の計時が行われ、その後、交流電源が復帰しても、時間帯に応じた単位電力量当りの価格に基づいて正確に電力料金を計算することができる。   On the other hand, when the AC power supply is cut off and no DC voltage is generated in the power supply circuit 80 and is detected in this state by the semiconductor integrated circuit 50, the second oscillation circuit 25 is replaced with the first oscillation circuit 19 described above. The second clock signal CLK2 generated by the second oscillation circuit 25 is counted by the counter 30 and is compared by the comparator 32 to generate a pulse signal CLK3 having a period of 1 second. Further, the time is counted by dividing the pulse signal CLK3. That is, in the semiconductor integrated circuit 50 having a built-in real-time clock circuit as shown in FIG. 1, the current time can always be measured stably, so that the time can be measured almost accurately even after the AC power is shut off. After that, even if the AC power supply is restored, the power rate can be accurately calculated based on the price per unit power amount according to the time zone.

なお、この発明は上記実施の形態に限定されるものではなく種々の変形が可能であることはいうまでもない。例えば、図1に示す半導体集積回路では、比較器32で生成されるクロック信号CLK3を分周器33によりカウントして1秒の期間を有するウインドウパルスPw2を生成する場合を説明したが、これはクロック信号CLK3そのものが1秒の期間を有するクロック信号である場合には分周器33を省略し、クロック信号CLK3そのものをウインドウパルスPw2として第2のANDゲート回路34に供給するようにしてもよい。   Needless to say, the present invention is not limited to the above-described embodiment, and various modifications are possible. For example, in the semiconductor integrated circuit shown in FIG. 1, the case where the clock signal CLK3 generated by the comparator 32 is counted by the frequency divider 33 to generate the window pulse Pw2 having a period of 1 second has been described. When the clock signal CLK3 itself is a clock signal having a period of 1 second, the frequency divider 33 may be omitted and the clock signal CLK3 itself may be supplied to the second AND gate circuit 34 as the window pulse Pw2. .

本発明に係る半導体集積回路からリアルタイムクロック回路に関連した回路部分のみを抽出して示す回路図。FIG. 3 is a circuit diagram showing only a circuit portion related to a real-time clock circuit extracted from the semiconductor integrated circuit according to the present invention. 図1の回路を動作させたときの回路接続状態を抽出して示す回路図。The circuit diagram which extracts and shows the circuit connection state when operating the circuit of FIG. 図1の回路を動作させたときの回路接続状態を抽出して示す回路図。The circuit diagram which extracts and shows the circuit connection state when operating the circuit of FIG. 図1の回路を動作させたときの回路接続状態を抽出して示す回路図。The circuit diagram which extracts and shows the circuit connection state when operating the circuit of FIG. 図1の回路を動作させたときの回路接続状態を抽出して示す回路図。The circuit diagram which extracts and shows the circuit connection state when operating the circuit of FIG. 本発明に係るリアルタイムクロック回路を内蔵した半導体集積回路の応用例を示すブロック図。1 is a block diagram showing an application example of a semiconductor integrated circuit incorporating a real-time clock circuit according to the present invention.

符号の説明Explanation of symbols

11、14a、14b、20a、20b…外部端子、12…分周器、13…第1のANDゲート回路、15、21…水晶振動子、19…第1の発振回路、25…第2の発振回路、26…第1の選択回路、27…CPU、28…バス、29…第2の選択回路、30…第1のカウンタ、31…レジスタ、32…比較器、33…分周器、34…第2のANDゲート回路、35…第2のカウンタ、50…半導体集積回路、60…電力量測定部、61…フォトカプラ、70…使用電力量表示部、71…表示器、72…フロントパネル、80…電源回路、81…ダイオード、82…バックアップ用の電池、83…ダイオード、90…E2PROM。 DESCRIPTION OF SYMBOLS 11, 14a, 14b, 20a, 20b ... External terminal, 12 ... Frequency divider, 13 ... 1st AND gate circuit, 15, 21 ... Crystal oscillator, 19 ... 1st oscillation circuit, 25 ... 2nd oscillation Circuit, 26 ... first selection circuit, 27 ... CPU, 28 ... bus, 29 ... second selection circuit, 30 ... first counter, 31 ... register, 32 ... comparator, 33 ... frequency divider, 34 ... 2nd AND gate circuit, 35 ... second counter, 50 ... semiconductor integrated circuit, 60 ... electric energy measuring unit, 61 ... photocoupler, 70 ... used electric energy display unit, 71 ... display, 72 ... front panel, 80 ... Power supply circuit, 81 ... Diode, 82 ... Battery for backup, 83 ... Diode, 90 ... E 2 PROM.

Claims (5)

基準クロック信号を分周してウインドウパルスを生成する分周器と、
第1の周期を有する第1のクロック信号を発生する第1の発振回路と、
前記第1の周期よりも長い第2の周期を有する第2のクロック信号を発生する第2の発振回路と、
前記第1及び第2のクロック信号のいずれか一方のクロック信号を選択して出力する第1の選択回路と、
前記第1の選択回路で選択されたクロック信号と前記ウインドウパルスとの論理積をとる第1の論理積回路と、
前記第1の選択回路で選択されたクロック信号及び前記第1の論理積回路の出力のいずれか一方を選択して出力する第2の選択回路と、
前記第2の選択回路の出力をカウントする第1のカウンタと、
所定のデータが格納されるレジスタと、
前記第1のカウンタのカウントデータを前記レジスタに格納されたデータと比較して時刻計時用のクロック信号を生成する比較器と、
前記時刻計時用のクロック信号及び前記第2のクロック信号との論理積をとる第2の論理積回路と、
前記第2の論理積回路の出力をカウントする第2のカウンタとを具備し、
前記レジスタには、前記第1のカウンタのカウントデータもしくはこのカウントデータを一定数で除算したデータ、または前記第2のカウンタのカウントデータもしくはこのカウントデータを一定数で除算したデータが格納されることを特徴とするリアルタイムクロック回路。
A frequency divider that divides the reference clock signal to generate a window pulse;
A first oscillation circuit for generating a first clock signal having a first period;
A second oscillation circuit for generating a second clock signal having a second period longer than the first period;
A first selection circuit that selects and outputs one of the first and second clock signals;
A first AND circuit that takes a logical product of the clock signal selected by the first selection circuit and the window pulse;
A second selection circuit that selects and outputs either the clock signal selected by the first selection circuit or the output of the first AND circuit;
A first counter that counts the output of the second selection circuit;
A register for storing predetermined data; and
A comparator that compares the count data of the first counter with the data stored in the register to generate a clock signal for timekeeping;
A second AND circuit that takes a logical product of the clock signal for timekeeping and the second clock signal;
A second counter that counts the output of the second AND circuit;
The register stores the count data of the first counter or data obtained by dividing the count data by a certain number, or the count data of the second counter or data obtained by dividing the count data by a certain number. A real-time clock circuit.
基準クロック信号を分周してウインドウパルスを生成し、このウインドウパルスの生成期間に、発振回路で発生されるクロック信号をカウントし、そのカウント数に応じたデータをレジスタに格納し、
前記クロック信号を再度、カウントし、比較器によりこのカウントデータを前記レジスタに格納されているデータと比較して時刻計時用のクロック信号を生成することを特徴とするリアルタイムクロック回路。
The reference clock signal is divided to generate a window pulse, and the clock signal generated by the oscillation circuit is counted during the generation period of the window pulse, and data corresponding to the count number is stored in the register.
A real-time clock circuit which counts the clock signal again and compares the count data with data stored in the register by a comparator to generate a clock signal for time measurement.
基準クロック信号を分周してウインドウパルスを生成し、このウインドウパルスの生成期間に、第1の発振回路で発生される第1の周期を有する第1のクロック信号をカウントしてそのカウント数に応じたデータをレジスタに格納し、
前記第1のクロック信号を再度、カウントし、比較器によりこのカウントデータを前記レジスタに格納されているデータと比較して第1の時刻計時用のクロック信号を生成し、
前記第1の時刻計時用のクロック信号をウインドウパルスとして用いて、このウインドウパルスの生成期間に、第2の発振回路で発生される前記第1の周期よりも長い第2の周期を有する第2のクロック信号をカウントしてそのカウント数に応じたデータを前記レジスタに再度、格納し、
前記第2のクロック信号を再度、カウントし、前記比較器によりこのカウントデータを前記レジスタに格納されているデータと比較して第2の時刻計時用のクロック信号を生成することを特徴とするリアルタイムクロック回路。
The reference clock signal is divided to generate a window pulse. During the window pulse generation period, the first clock signal having the first period generated by the first oscillation circuit is counted to obtain the count number. The corresponding data is stored in the register,
The first clock signal is counted again, and the count data is compared with the data stored in the register by a comparator to generate a clock signal for the first clock.
The second clock having the second period longer than the first period generated by the second oscillation circuit is generated in the generation period of the window pulse by using the first clock signal for timekeeping as the window pulse. The clock signal is counted and the data corresponding to the count number is stored again in the register,
The second clock signal is counted again, and the count data is compared with the data stored in the register by the comparator to generate a second clock signal for time measurement. Clock circuit.
外部端子から入力される基準クロック信号を分周してウインドウパルスを生成する分周器と、
制御用データを生成する中央演算処理装置と、
前記中央演算処理装置に接続され、前記中央演算処理装置で生成された制御データを伝達するバスと、
外部端子を介して水晶振動子が接続され、第1の周期を有する第1のクロック信号を発生する第1の発振回路と、
外部端子を介して水晶振動子が接続され、前記第1の周期よりも長い第2の周期を有する第2のクロック信号を発生する第2の発振回路と、
前記バスに接続され、前記バス上の制御用データに応じて、第1及び第2のクロック信号のいずれか一方のクロック信号を選択して出力する第1の選択回路と、
前記第1の選択回路で選択されたクロック信号と前記ウインドウパルスとの論理積をとる第1の論理積回路と、
前記バスに接続され、前記バス上の制御用データに応じて、前記第1の選択回路で選択されたクロック信号及び前記第1の論理積回路の出力のいずれか一方を選択して出力する第2の選択回路と、
前記バスに接続され、前記第2の選択回路の出力をカウントする第1のカウンタと、
前記バスに接続され、前記バス上のデータが格納されるレジスタと、
前記第1のカウンタのカウントデータを前記レジスタに格納されたデータと比較して時刻計時用のクロック信号を生成する比較器と、
前記比較器で生成されたクロック信号及び前記第2のクロック信号との論理積をとる第2の論理積回路と、
前記バスに接続され、前記第2の論理積回路の出力をカウントする第2のカウンタとを具備したリアルタイムクロック回路を内蔵し、
前記レジスタには、前記第1のカウンタのカウントデータもしくはこのカウントデータが前記中央演算処理装置によって一定数で除算された後のデータ、または前記第2のカウンタのカウントデータもしくはこのカウントデータが前記中央演算処理装置によって一定数で除算されたデータが格納されることを特徴とする半導体集積回路。
A frequency divider that divides a reference clock signal input from an external terminal to generate a window pulse;
A central processing unit for generating control data;
A bus connected to the central processing unit for transmitting control data generated by the central processing unit;
A first oscillation circuit that is connected to a crystal resonator via an external terminal and generates a first clock signal having a first period;
A second oscillation circuit that is connected to a crystal resonator via an external terminal and generates a second clock signal having a second period longer than the first period;
A first selection circuit that is connected to the bus and selects and outputs one of the first and second clock signals according to the control data on the bus;
A first AND circuit that takes a logical product of the clock signal selected by the first selection circuit and the window pulse;
A first signal that is connected to the bus and that selects and outputs either the clock signal selected by the first selection circuit or the output of the first AND circuit according to the control data on the bus; Two selection circuits;
A first counter connected to the bus and counting an output of the second selection circuit;
A register connected to the bus for storing data on the bus;
A comparator that compares the count data of the first counter with the data stored in the register to generate a clock signal for timekeeping;
A second AND circuit that takes a logical product of the clock signal generated by the comparator and the second clock signal;
A real-time clock circuit that is connected to the bus and includes a second counter that counts the output of the second AND circuit;
In the register, the count data of the first counter or the data after the count data is divided by a fixed number by the central processing unit, or the count data of the second counter or the count data is the central data A semiconductor integrated circuit in which data divided by a predetermined number by an arithmetic processing unit is stored.
商用交流電源に接続され、使用電力量に応じた周波数を有するパルス信号を生成する電力量測定部と、
前記パルス信号をカウントして使用電力量を算出すると共に、時刻計時用のクロック信号を生成し、このクロック信号を計数して時刻の計時を行うリアルタイムクロック回路を内蔵し、時間帯に応じて異なる複数の課金情報の中から計時時刻の時間帯に応じた課金情報を選択し、この課金情報と前記算出された使用電力量とに応じて使用電力料金を算出する半導体集積回路とを具備し、
前記半導体集積回路は、
外部端子から入力される基準クロック信号を分周してウインドウパルスを生成する分周器と、
制御用データを生成する中央演算処理装置と、
前記中央演算処理装置に接続され、前記中央演算処理装置で生成された制御データを伝達するバスと、
外部端子を介して水晶振動子が接続され、第1の周期を有する第1のクロック信号を発生する第1の発振回路と、
外部端子を介して水晶振動子が接続され、前記第1の周期よりも長い第2の周期を有する第2のクロック信号を発生する第2の発振回路と、
前記バスに接続され、前記バス上の制御用データに応じて、第1及び第2のクロック信号のいずれか一方のクロック信号を選択して出力する第1の選択回路と、
前記第1の選択回路で選択されたクロック信号と前記ウインドウパルスとの論理積をとる第1の論理積回路と、
前記バスに接続され、前記バス上の制御用データに応じて、前記第1の選択回路で選択されたクロック信号及び前記第1の論理積回路の出力のいずれか一方を選択して出力する第2の選択回路と、
前記バスに接続され、前記第2の選択回路の出力をカウントする第1のカウンタと、
前記バスに接続され、前記バス上のデータが格納されるレジスタと、
前記第1のカウンタのカウントデータを前記レジスタに格納されたデータと比較して時刻計時用のクロック信号を生成する比較器と、
前記比較器で生成されたクロック信号及び前記第2のクロック信号との論理積をとる第2の論理積回路と、
前記バスに接続され、前記第2の論理積回路の出力をカウントする第2のカウンタとを有し、
前記レジスタには、前記第1のカウンタのカウントデータもしくはこのカウントデータが前記中央演算処理装置によって一定数で除算された後のデータ、または前記第2のカウンタのカウントデータもしくはこのカウントデータが前記中央演算処理装置によって一定数で除算されたデータが格納されることを特徴とする電力量計装置。
An electric energy measuring unit that is connected to a commercial AC power source and generates a pulse signal having a frequency according to the used electric energy;
The power consumption is calculated by counting the pulse signal, and a clock signal for timekeeping is generated, and a real-time clock circuit that counts the clock signal and counts the time is built in, and varies depending on the time zone A semiconductor integrated circuit that selects billing information according to the time zone of the clocking time from a plurality of billing information, and calculates a power consumption fee according to the billing information and the calculated power consumption amount,
The semiconductor integrated circuit is:
A frequency divider that divides a reference clock signal input from an external terminal to generate a window pulse;
A central processing unit for generating control data;
A bus connected to the central processing unit for transmitting control data generated by the central processing unit;
A first oscillation circuit that is connected to a crystal resonator via an external terminal and generates a first clock signal having a first period;
A second oscillation circuit that is connected to a crystal resonator via an external terminal and generates a second clock signal having a second period longer than the first period;
A first selection circuit that is connected to the bus and selects and outputs one of the first and second clock signals according to the control data on the bus;
A first AND circuit that takes a logical product of the clock signal selected by the first selection circuit and the window pulse;
A first signal that is connected to the bus and that selects and outputs either the clock signal selected by the first selection circuit or the output of the first AND circuit according to the control data on the bus; Two selection circuits;
A first counter connected to the bus and counting an output of the second selection circuit;
A register connected to the bus for storing data on the bus;
A comparator that compares the count data of the first counter with the data stored in the register to generate a clock signal for timekeeping;
A second AND circuit that takes a logical product of the clock signal generated by the comparator and the second clock signal;
A second counter connected to the bus and counting the output of the second AND circuit;
In the register, the count data of the first counter or the data after the count data is divided by a fixed number by the central processing unit, or the count data of the second counter or the count data is the central data A watt-hour meter device storing data divided by a fixed number by an arithmetic processing unit.
JP2004213283A 2004-07-21 2004-07-21 Real-time clock circuit, semiconductor integrated circuit, and watt-hour meter device Pending JP2006030136A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004213283A JP2006030136A (en) 2004-07-21 2004-07-21 Real-time clock circuit, semiconductor integrated circuit, and watt-hour meter device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004213283A JP2006030136A (en) 2004-07-21 2004-07-21 Real-time clock circuit, semiconductor integrated circuit, and watt-hour meter device

Publications (1)

Publication Number Publication Date
JP2006030136A true JP2006030136A (en) 2006-02-02

Family

ID=35896659

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004213283A Pending JP2006030136A (en) 2004-07-21 2004-07-21 Real-time clock circuit, semiconductor integrated circuit, and watt-hour meter device

Country Status (1)

Country Link
JP (1) JP2006030136A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111181552A (en) * 2020-01-08 2020-05-19 电子科技大学 Bidirectional frequency synchronous oscillator circuit
US20220035398A1 (en) * 2020-07-29 2022-02-03 Seiko Epson Corporation Circuit Device And Real-Time Clock Device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111181552A (en) * 2020-01-08 2020-05-19 电子科技大学 Bidirectional frequency synchronous oscillator circuit
US20220035398A1 (en) * 2020-07-29 2022-02-03 Seiko Epson Corporation Circuit Device And Real-Time Clock Device
US11836001B2 (en) * 2020-07-29 2023-12-05 Seiko Epson Corporation Circuit device and real-time clock device

Similar Documents

Publication Publication Date Title
CN101128780B (en) Clock signal output apparatus and control method of same, and electric apparatus and control method of same
US4399510A (en) System for monitoring utility usage
US8823434B2 (en) Clock correction circuit and clock correction method
CN103809658A (en) Semiconductor device and clock correction method
JP6282723B2 (en) High-precision timekeeping method for quartz electronic watches
US4987363A (en) Electric energy meter with power outage recovery circuit
CN105573106A (en) Smart meter RTC timing precision correction circuit and method thereof
CN103226376A (en) High-precision real-time clock chip
JP2007078405A (en) Timing program of software timepiece
US8901983B1 (en) Temperature compensated timing signal generator
JP5477488B2 (en) Real-time clock and data recording method for real-time clock
WO2000041041A1 (en) Electronic apparatus and method of controlling electronic apparatus
JP2013167597A (en) Real time clock
JP2009055178A (en) Integrated circuit device
KR100421298B1 (en) Electrical Energy Meter Oscillator Compensation
JP2006030136A (en) Real-time clock circuit, semiconductor integrated circuit, and watt-hour meter device
JP2002261591A (en) Accurate time delay system and method using innacurate oscillator
US8896359B1 (en) Temperature compensated timing signal generator
JPH0347718B2 (en)
JPS6015905B2 (en) electronic clock
JP7392576B2 (en) Real-time clock circuit, real-time clock module, electronic equipment and real-time clock circuit correction method
CN106444966A (en) Device and method for adjusting real time clock (RTC)
JP5037755B2 (en) Temperature change measuring apparatus and method
JP2005257494A (en) Timepiece accuracy correction control device and watt-hour meter
JP2013003033A (en) Battery life estimation apparatus