JP2008234046A - Oscillation circuit and semiconductor device - Google Patents

Oscillation circuit and semiconductor device Download PDF

Info

Publication number
JP2008234046A
JP2008234046A JP2007069345A JP2007069345A JP2008234046A JP 2008234046 A JP2008234046 A JP 2008234046A JP 2007069345 A JP2007069345 A JP 2007069345A JP 2007069345 A JP2007069345 A JP 2007069345A JP 2008234046 A JP2008234046 A JP 2008234046A
Authority
JP
Japan
Prior art keywords
circuit
oscillation
output
oscillation circuit
level
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.)
Granted
Application number
JP2007069345A
Other languages
Japanese (ja)
Other versions
JP5045167B2 (en
Inventor
Masaru Tachibana
大 橘
Manabu Murasawa
学 村澤
Hideki Nakamura
英樹 中村
Yuji Ishii
勇治 石井
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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2007069345A priority Critical patent/JP5045167B2/en
Publication of JP2008234046A publication Critical patent/JP2008234046A/en
Application granted granted Critical
Publication of JP5045167B2 publication Critical patent/JP5045167B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Electronic Switches (AREA)
  • Oscillators With Electromechanical Resonators (AREA)
  • Inductance-Capacitance Distribution Constants And Capacitance-Resistance Oscillators (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To simultaneously reduce power consumption and increas speed of an MCU after power supply, after a reset, and after recovery from a standby state, in an oscillation circuit and a semiconductor device. <P>SOLUTION: This oscillation circuit has: a first oscillation circuit; a second oscillation circuit having a longer oscillation stable time than the first oscillation circuit; a signal generation circuit outputting a stable signal showing a lapse of the oscillation stable time of the second oscillation circuit; a switch circuit selectively outputting one of output of the first and second oscillation circuits based on a selection signal; and an inhibit circuit inhibiting start of the second oscillation circuit based on an inhibit signal. The oscillation circuit has: a mode to start the first and second oscillation circuits simultaneously, and switch to output of the second oscillator circuit after output of the first oscillation circuit is selectively outputted by the switch circuit; and a mode to start the first oscillator circuit, while not starting the second oscillation circuit by the inhibit circuit, and selectively output only the output of the first oscillator circuit by the switch circuit. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、発振回路及び半導体装置に係り、特にクロックを生成するクロック生成回路に適した発振回路及びそのような発振回路を有する半導体装置に関する。   The present invention relates to an oscillation circuit and a semiconductor device, and more particularly to an oscillation circuit suitable for a clock generation circuit that generates a clock and a semiconductor device having such an oscillation circuit.

従来より、マイクロコントローラ(MCU)等の半導体装置(又は、半導体チップ)には、クロック生成回路を内蔵する構成のものがある。クロック生成回路は、CR発振回路或いはリングオシレータ等を有し、MCUのクロックをMCU内のCPUに供給する。水晶振動子或いはセラミック振動子を使用する発振回路は、発振回路の出力周波数が安定するまでの起動時間(又は、発振安定時間)が長いので、発振周波数精度が多少低下しても、このようにより起動時間(又は、発振安定時間)の短いCR発振回路やリングオシレータ等をクロック源として使用することが望ましい場合がある。発振回路の停止と起動を頻繁に繰り返すような応用では、発振回路の起動時の待ち時間(即ち、発振安定時間)の間の消費電力を削減することが、MCUの総合的な性能向上の観点から望ましい場合がある。   Conventionally, some semiconductor devices (or semiconductor chips) such as a microcontroller (MCU) have a configuration in which a clock generation circuit is incorporated. The clock generation circuit includes a CR oscillation circuit, a ring oscillator, or the like, and supplies the MCU clock to the CPU in the MCU. Oscillation circuits that use crystal or ceramic resonators have a long start-up time (or oscillation stabilization time) until the output frequency of the oscillation circuit stabilizes. It may be desirable to use a CR oscillation circuit, a ring oscillator, or the like with a short start-up time (or oscillation stabilization time) as a clock source. In applications where the stop and start of the oscillation circuit are frequently repeated, reducing power consumption during the start-up time of the oscillation circuit (that is, the oscillation stabilization time) is a viewpoint of improving the overall performance of the MCU. May be desirable.

一般に、セラミック発振子や水晶発振子等の発振の鋭さを示すQ値が高い周波数制御素子を用いる発振回路では、非常に精度の高い発振が可能で、公称周波数に対する周波数偏差が小さい。しかしながら、例えば電源が印加されてから発振周波数及び発振回路の信号振幅が十分に安定するまでに要する時間(以下、発振安定時間と言う)が数十マイクロ秒から数百マイクロ秒と長い。一方、Q値が低い素子(Q値の低い周波数制御素子、抵抗、容量)を用いたCR発振回路等では、セラミック発振回路や水晶発振回路とは逆に、発振周波数精度は高くないが、発振回路の起動時の待ち時間(発振安定時間)は短い。   In general, an oscillation circuit using a frequency control element having a high Q value indicating the sharpness of oscillation, such as a ceramic oscillator or a crystal oscillator, can oscillate with extremely high accuracy and has a small frequency deviation with respect to a nominal frequency. However, for example, the time required to sufficiently stabilize the oscillation frequency and the signal amplitude of the oscillation circuit after power is applied (hereinafter referred to as oscillation stabilization time) is as long as several tens to several hundreds of microseconds. On the other hand, a CR oscillation circuit using an element having a low Q value (frequency control element, resistance, capacitance) having a low Q value is not high in oscillation frequency accuracy, contrary to a ceramic oscillation circuit or a crystal oscillation circuit. The waiting time (oscillation stabilization time) at the start of the circuit is short.

このような発振周波数精度及び発振安定時間が異なる発振回路を組み合わせて使用することで、総合的なシステムの性能向上を実現する各種提案が、例えば特許文献1乃至5でなされている。   Various proposals have been made, for example, in Patent Documents 1 to 5, in which a combination of such oscillation circuits having different oscillation frequency accuracy and oscillation stabilization time is used to improve the overall system performance.

図1は従来の発振回路の一例を示す回路図であり、図2は図1の発振回路の動作を説明するタイミングチャートである。図1に示す発振回路は、例えば特許文献1の図3に記載されている。   FIG. 1 is a circuit diagram showing an example of a conventional oscillation circuit, and FIG. 2 is a timing chart for explaining the operation of the oscillation circuit of FIG. The oscillation circuit shown in FIG. 1 is described, for example, in FIG.

発振回路は、図1に示す如く接続されたCR発振回路CRO101、水晶又はセラミック発振回路OSC101、スイッチ回路SW102,SW103、カウンタ回路CUNT101、Dフリップフロップ回路DFF101、バッファ回路BUF101及びアンド回路AND101を有する。発振回路OSC101は、図1に示す如く接続されたスイッチ回路SW101、容量C101,C102、抵抗R101、水晶振動子又はセラミック振動子XTAL101及びインバータ回路INV101を有する。以下の説明では、便宜上、発振回路OSC101はセラミック振動子XTAL101を有するセラミック発振回路であるものとする。図1において、Vddは正の電源電圧(例えば+3V)、GNDはグランド電位(0V)、COUTはカウンタ回路CUNT101の出力、DFOはフリップフロップ回路DFF101の正の出力を、DFOXはフリップフロップ回路DFF101の負の出力、CLCNTはアンド回路AND101の出力、VDDCRはCR発振回路CRO101の電源端子への入力、NX100,NX101はセラミック発振回路OSC101の外部接続端子、OSCO1はセラミック発振回路OSC101の発振出力、OSCO2はCR発振回路CRO101の発振出力、OSCENはセラミック発振回路OSC101のイネーブル端子への入力信号、CKOは出力クロックを示す。   The oscillation circuit includes a CR oscillation circuit CRO101, a crystal or ceramic oscillation circuit OSC101, switch circuits SW102 and SW103, a counter circuit CUNT101, a D flip-flop circuit DFF101, a buffer circuit BUF101, and an AND circuit AND101 connected as shown in FIG. The oscillation circuit OSC101 includes a switch circuit SW101, capacitors C101 and C102, a resistor R101, a crystal resonator or ceramic resonator XTAL101, and an inverter circuit INV101 that are connected as shown in FIG. In the following description, for the sake of convenience, it is assumed that the oscillation circuit OSC101 is a ceramic oscillation circuit having the ceramic resonator XTAL101. In FIG. 1, Vdd is a positive power supply voltage (for example, +3 V), GND is a ground potential (0 V), COUT is an output of the counter circuit CUNT101, DFO is a positive output of the flip-flop circuit DFF101, and DFOX is an output of the flip-flop circuit DFF101. Negative output, CLCNT is the output of the AND circuit AND101, VDDCR is an input to the power supply terminal of the CR oscillation circuit CRO101, NX100 and NX101 are external connection terminals of the ceramic oscillation circuit OSC101, OSCO1 is the oscillation output of the ceramic oscillation circuit OSC101, OSCO2 is The oscillation output of the CR oscillation circuit CRO101, OSCEN indicates an input signal to the enable terminal of the ceramic oscillation circuit OSC101, and CKO indicates an output clock.

発振回路OSC101の起動時の待ち時間(発振安定時間)は長いが、発振周波数精度は高い。一方、CR発振回路CRO101の発振周波数精度は低いが、起動時の待ち時間(発振安定時間)は短い。図1の発振回路では、これらの特性の異なる2つの発振回路OSC101,CRO101を使用して、MCUの総合的な性能向上を図っている。   The waiting time (oscillation stabilization time) when starting up the oscillation circuit OSC101 is long, but the oscillation frequency accuracy is high. On the other hand, the oscillation frequency accuracy of the CR oscillation circuit CRO101 is low, but the waiting time (oscillation stabilization time) at startup is short. In the oscillation circuit of FIG. 1, two oscillation circuits OSC101 and CRO101 having different characteristics are used to improve the overall performance of the MCU.

CR発振回路CRO101の起動時の待ち時間は短いので、MCUの電源投入後又はリセット後にセラミック発振回路OSC101の出力OSCO1より先にCR発振発振回路CRO101の出力OSCO2が安定する。出力OSCO1だけを使用する場合には、出力OSCO1が安定するまでは例えばMCUの処理を開始できないが、出力OSCO2をクロックとして使用することで、出力OSCO1が安定するまでの期間中も例えばMCUの処理を進めることができる。出力OSCO1が安定した後は、クロックを出力OSCO2から出力OSCO1に切り替えることで周波数精度の高い出力OSCO1をクロック源として使用することができる。   Since the waiting time when starting up the CR oscillation circuit CRO101 is short, the output OSCO2 of the CR oscillation oscillation circuit CRO101 is stabilized before the output OSCO1 of the ceramic oscillation circuit OSC101 after the MCU is turned on or reset. When only the output OSCO1 is used, for example, MCU processing cannot be started until the output OSCO1 is stabilized. However, by using the output OSCO2 as a clock, for example, processing of the MCU is performed during the period until the output OSCO1 is stabilized. Can proceed. After the output OSCO1 is stabilized, the output OSCO1 with high frequency accuracy can be used as a clock source by switching the clock from the output OSCO2 to the output OSCO1.

図2は、このような切り替え動作の詳細を示す。MCUの電源投入直後又はリセット時には、信号OSCENはロー(L)レベルとなっている。信号OSCENがLレベルなので、アンド回路AND101の出力CLCNTもLレベルである。出力CLCNTがLレベルなので、カウンタ回路CUNT101はクリアされ、出力COUTはLレベルである。又、カウンタ回路CUNT101は初期化される。同様に、信号OSCENがLレベルなので、Dフリップフロップ回路DFF101もクリアされ、出力DFOはLレベルである。出力DFOXは出力DFOの反転信号なので、ハイ(H)レベルである。   FIG. 2 shows the details of such a switching operation. Immediately after the MCU is powered on or reset, the signal OSCEN is at a low (L) level. Since the signal OSCEN is at L level, the output CLCNT of the AND circuit AND101 is also at L level. Since the output CLCNT is at L level, the counter circuit CUNT101 is cleared and the output COUT is at L level. Also, the counter circuit CUNT101 is initialized. Similarly, since the signal OSCEN is at L level, the D flip-flop circuit DFF101 is also cleared and the output DFO is at L level. Since the output DFOX is an inverted signal of the output DFO, it is at a high (H) level.

電源投入後又はリセット後、信号OSCENをLレベルからHレベルに変化させることで、発振回路OSC101,CRO101の動作が開始される。信号OSCENをHレベルにすると、スイッチ回路SW101がオン(ON)となってインバータ回路INV101に電源電圧Vddが供給され、セラミック発振回路OSC101が動作を始める。又、出力DFOXがHレベルになっているので、信号OSCENがHレベルであると、アンド回路AND101の出力CLCNTもHレベルになる。出力CLCNTがHレベルになると、スイッチ回路SW102がオンとなり、入力VDDCRがHレベルになってCR発振回路CRO101に電源電圧Vddが供給され、CR発振回路CRO101も動作を開始する。   After the power is turned on or reset, the operation of the oscillation circuits OSC101 and CRO101 is started by changing the signal OSCEN from the L level to the H level. When the signal OSCEN is set to the H level, the switch circuit SW101 is turned on, the power supply voltage Vdd is supplied to the inverter circuit INV101, and the ceramic oscillation circuit OSC101 starts operating. Since the output DFOX is at the H level, if the signal OSCEN is at the H level, the output CLCNT of the AND circuit AND101 is also at the H level. When the output CLCNT becomes H level, the switch circuit SW102 is turned on, the input VDDCR becomes H level, the power supply voltage Vdd is supplied to the CR oscillation circuit CRO101, and the CR oscillation circuit CRO101 also starts operation.

スイッチ回路SW102がオンとなった後、出力OSCO2は安定する。出力OSCO2の信号振幅及び発振周波数が安定した後、出力OSCO1の信号振幅及び発振周波数が安定する。出力OSCO2が安定した後、スイッチ回路SW103により出力OSCO2が出力クロックCKOとして出力される。この出力クロックCKOを基準クロックとして、例えばMCUの動作を開始させることができる。   After the switch circuit SW102 is turned on, the output OSCO2 is stabilized. After the signal amplitude and the oscillation frequency of the output OSCO2 are stabilized, the signal amplitude and the oscillation frequency of the output OSCO1 are stabilized. After the output OSCO2 is stabilized, the output OSCO2 is output as the output clock CKO by the switch circuit SW103. For example, the operation of the MCU can be started using the output clock CKO as a reference clock.

図2に示す例では、出力OSCO2の発振周波数が出力OSCO1の発振周波数より低い。セラミック発振回路OSC101の発振周波数精度が高いので、MCUが動作する規定の周波数に発振周波数を設定すれば良いが、CR発振回路CRO101の発振周波数精度が低いので、発振周波数が最大となった場合でもMCUが動作できるような設計としななければならない。このため、CR発振回路CRO101の発振周波数の中心値は、ある程度小さく設計しなければならない。このような事情を考慮して、出力OSCO2の発振周波数は出力OSCO1の発振周波数より低いものとして示されている。   In the example shown in FIG. 2, the oscillation frequency of the output OSCO2 is lower than the oscillation frequency of the output OSCO1. Since the oscillation frequency accuracy of the ceramic oscillation circuit OSC101 is high, the oscillation frequency may be set to a specified frequency at which the MCU operates. However, since the oscillation frequency accuracy of the CR oscillation circuit CRO101 is low, even when the oscillation frequency becomes maximum. The design must be such that the MCU can operate. For this reason, the center value of the oscillation frequency of the CR oscillation circuit CRO101 must be designed to be small to some extent. In view of such circumstances, the oscillation frequency of the output OSCO2 is shown as being lower than the oscillation frequency of the output OSCO1.

出力OSCO1が発振を開始してある程度時間が経過すると、セラミック発振回路OSC101の信号振幅及び発振周波数が安定する。この時間の経過を知るために、カウンタ回路CUNT101で出力OSCO1をカウントする。ある規定の回数出力OSCO1がHレベルとLレベルの変化を繰り返すことで、カウンタ回路CUNT101の出力COUTがLレベルからHレベルに変化する。出力COUTがLレベルからHレベルに変化することで、フリップフロップ回路DFF101の出力DFOもLレベルからHレベルに変化する。出力DFOがLレベルからHレベルに変化することで、スイッチ回路SW103が切り替えられて、出力OSCO1が出力クロックCKOとして出力される。   When a certain amount of time elapses after the output OSCO1 starts oscillating, the signal amplitude and oscillation frequency of the ceramic oscillation circuit OSC101 are stabilized. In order to know the passage of this time, the output OSCO1 is counted by the counter circuit CUNT101. The output COUT of the counter circuit CUNT101 changes from the L level to the H level by repeating the change between the H level and the L level by the predetermined number of times of output OSCO1. As the output COUT changes from L level to H level, the output DFO of the flip-flop circuit DFF101 also changes from L level to H level. When the output DFO changes from the L level to the H level, the switch circuit SW103 is switched, and the output OSCO1 is output as the output clock CKO.

出力DFOがLレベルからHレベルに変化することで、フリップフロップ回路DFF101の出力DFOXはHレベルからLレベルに変化する。出力DFOXがLレベルになることで、アンド回路AND101の出力CLCNTもLレベルになる。カウンタ回路CUNT101のクリア端子CLがLレベルになるので、カウンタ回路CUNT101は動作を停止してクリアされ、出力COUTはLレベルになる。アンド回路AND101の出力CLCNTがLレベルになることで、スイッチ回路SW102がオフ(OFF)となりCR発振回路CRO101には電源電圧Vddが供給されなくなり、CR発振回路CRO101は動作を停止する。図2において入力VDDCRがHレベルからLレベルに変化しているのは、アンド回路AND101の出力CLCNTにより電源供給が停止されることを表している。   As the output DFO changes from L level to H level, the output DFOX of the flip-flop circuit DFF101 changes from H level to L level. When the output DFOX becomes L level, the output CLCNT of the AND circuit AND101 also becomes L level. Since the clear terminal CL of the counter circuit CUNT101 becomes L level, the counter circuit CUNT101 stops its operation and is cleared, and the output COUT becomes L level. When the output CLCNT of the AND circuit AND101 becomes L level, the switch circuit SW102 is turned off, the power supply voltage Vdd is not supplied to the CR oscillation circuit CRO101, and the CR oscillation circuit CRO101 stops its operation. In FIG. 2, the change of the input VDDCR from the H level to the L level indicates that the power supply is stopped by the output CLCNT of the AND circuit AND101.

以上説明したような構成と動作により、電源投入直後はCR発振回路CRO101の出力OSCO2を出力クロックCKOとして使用し、セラミック発振回路OSC101の出力が安定した後はセラミック発振回路OSC101の出力OSCO1を出力クロックCKOとして使用すると共にCR発振回路CRO101の動作を停止している。このように、セラミック発振回路OSC101の出力OSCO1が安定するまではCR発振回路CRO101の出力OSCO2を出力クロックCKOとして使用することでMCUの処理を進めることができ、且つ、セラミック発振回路OSC101の出力OSCO1が安定した後は発振周波数精度の高いセラミック発振回路OSC101の出力OSCO1を出力クロックCKOとして使用できる。
特開2002−314336号公報 特開2001−251140号公報 特開平10−161768号公報 特開平4−171513号公報 特開昭53−60149号公報
With the configuration and operation as described above, the output OSCO2 of the CR oscillation circuit CRO101 is used as the output clock CKO immediately after the power is turned on, and after the output of the ceramic oscillation circuit OSC101 is stabilized, the output OSCO1 of the ceramic oscillation circuit OSC101 is output clock. It is used as CKO and the operation of the CR oscillation circuit CRO101 is stopped. In this way, until the output OSCO1 of the ceramic oscillation circuit OSC101 is stabilized, the MCU processing can be advanced by using the output OSCO2 of the CR oscillation circuit CRO101 as the output clock CKO, and the output OSCO1 of the ceramic oscillation circuit OSC101. Is stabilized, the output OSCO1 of the ceramic oscillation circuit OSC101 with high oscillation frequency accuracy can be used as the output clock CKO.
JP 2002-314336 A JP 2001-251140 A Japanese Patent Laid-Open No. 10-161768 JP-A-4-171513 JP-A-53-60149

図1に示す発振回路では、カウンタ回路CUNT101により、セラミック発振回路OSC101の出力OSCO1をカウントして一定時間経過した後、出力クロックCKOをCR発振回路CRO101の出力OSCO2からセラミック発振回路OSC101の出力OSCO1に切り替える。MCUの電源投入後、実行すべきプログラムが大きい場合には、図1のような回路構成としても問題がないが、一般の制御用途のMCUに適用した場合、以下のような問題が発生することに本発明者らは気づいた。   In the oscillation circuit shown in FIG. 1, the counter circuit CUNT101 counts the output OSCO1 of the ceramic oscillation circuit OSC101, and after a predetermined time has elapsed, the output clock CKO is changed from the output OSCO2 of the CR oscillation circuit CRO101 to the output OSCO1 of the ceramic oscillation circuit OSC101. Switch. If the program to be executed is large after the MCU power is turned on, there is no problem with the circuit configuration as shown in FIG. 1, but the following problems occur when applied to a general control MCU. The present inventors have noticed.

例えば、スタンバイ状態(発振回路は停止しているものとする)から、割り込みによりプログラム実行が再開され(割り込みプログラムが実行され)るような場合、割り込みプログラムの規模が大きい場合には、セラミック発振回路OSC101を起動し、周波数精度の高いクロックで最高動作周波数で処理を進めた方が効率が良い。しかしながら、割り込みプログラムの規模が小さく、処理の量が小さい場合には、セラミック発振回路OSC101の出力OSCO1が安定する前に必要な処理が終了することも有り得る。このような場合には、セラミック発振回路OSC101を起動せず、CR発振回路CRO101によりクロックを供給して処理を終了させ、再びスタンバイ状態として次の割り込みを待っている状態とした方が電力効率が高い。   For example, when the program execution is restarted (interrupt program is executed) by an interrupt from the standby state (assuming that the oscillation circuit is stopped), or when the interrupt program is large, the ceramic oscillation circuit It is more efficient to activate the OSC 101 and proceed with the processing at the maximum operating frequency with a clock with high frequency accuracy. However, if the interrupt program is small and the amount of processing is small, the necessary processing may be completed before the output OSCO1 of the ceramic oscillation circuit OSC101 is stabilized. In such a case, it is more efficient to supply the clock by the CR oscillation circuit CRO101 without activating the ceramic oscillation circuit OSC101, to end the processing, and to set the standby state again to wait for the next interrupt. high.

つまり、セラミック発振回路CRO101の出力OSCO2を使用した方が良いか否かは、一般のMCUの場合はプログラムに依存し、各種の状況で適切なクロック制御を行うには、図1の回路のようにハードウエアで一律に制御したのでは、無駄が生じることになる。   In other words, whether or not it is better to use the output OSCO2 of the ceramic oscillation circuit CRO101 depends on the program in the case of a general MCU, and in order to perform appropriate clock control in various situations, the circuit shown in FIG. However, if it is controlled uniformly by hardware, waste will occur.

一例として、MCUがスタンバイ状態から小規模な割り込みプログラムを実行し、再びスタンバイ状態になるような場合について、図1の発振回路の動作を説明する。ここでは、CR発振回路CRO101の出力OSCO2が安定した時点で、割り込みプログラム実行が始まるものとする。CR発振回路CRO101を起動すると同時に、図1の発振回路では、セラミック発振回路OSC101も起動される。セラミック発振回路OSC101の出力OSCO1が安定する前に、割り込みプログラムの処理が終了し、MCUは再びスタンバイ状態となる。このような状況では、図1の発振回路では、使用しないセラミック発振回路OSC101を毎回起動し、セラミック発振回路OSC101の消費電力相当分を浪費することになる。   As an example, the operation of the oscillation circuit of FIG. 1 will be described in the case where the MCU executes a small interrupt program from the standby state and again enters the standby state. Here, it is assumed that interrupt program execution starts when the output OSCO2 of the CR oscillation circuit CRO101 becomes stable. Simultaneously with activation of the CR oscillation circuit CRO101, the ceramic oscillation circuit OSC101 is also activated in the oscillation circuit of FIG. Before the output OSCO1 of the ceramic oscillation circuit OSC101 is stabilized, the interrupt program processing is completed, and the MCU is again in the standby state. In such a situation, in the oscillation circuit of FIG. 1, the ceramic oscillation circuit OSC101 that is not used is started up every time, and a portion corresponding to the power consumption of the ceramic oscillation circuit OSC101 is wasted.

つまり、図1の発振回路では、ハードウエアの制御に基づいて、CR発振回路CRO101とセラミック発振回路OSC101を同時に起動し、クロックCKOをCR発振回路CRO101の出力OSCO2からセラミック発振回路OSC101の出力OSCO1に切り替える構成となっているので、プログラムの状況に応じて消費電力を削減する最適な制御ができないという問題があった。   That is, in the oscillation circuit of FIG. 1, the CR oscillation circuit CRO101 and the ceramic oscillation circuit OSC101 are simultaneously activated based on hardware control, and the clock CKO is changed from the output OSCO2 of the CR oscillation circuit CRO101 to the output OSCO1 of the ceramic oscillation circuit OSC101. Since it is configured to be switched, there is a problem that optimal control for reducing power consumption cannot be performed according to the program status.

そこで、本発明は、電源投入後、リセット後、スタンバイ状態からの復帰後のMCUの処理の高速化と低消費電力化を両立できる発振回路及び半導体装置を提供することを目的とする。   Therefore, an object of the present invention is to provide an oscillation circuit and a semiconductor device that can achieve both high speed processing and low power consumption of an MCU after power-on, reset, and recovery from a standby state.

上記の課題は、第1の発振回路と、該第1の発振回路より長い発振安定時間を有する第2の発振回路と、該第2の発振回路の発振安定時間の経過を示す安定信号を出力する信号生成回路と、選択信号に基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路と、抑止信号に基づいて該第2の発振回路の起動を抑止する抑止回路とを備え、該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられるモードと、該第1の発振回路が起動されて該抑止回路により該第2の発振回路が起動されず該スイッチ回路により該第1の発振回路の出力のみが選択出力されるモードを有することを特徴とする発振回路により達成できる。   The above-described problem is that a first oscillation circuit, a second oscillation circuit having an oscillation stabilization time longer than the first oscillation circuit, and a stabilization signal indicating the passage of the oscillation stabilization time of the second oscillation circuit are output. A signal generation circuit that performs selection, a switch circuit that selectively outputs one of the outputs of the first and second oscillation circuits based on a selection signal, and a suppression circuit that suppresses activation of the second oscillation circuit based on a suppression signal A mode in which the first and second oscillation circuits are activated simultaneously and the switch circuit selects and outputs the output of the first oscillation circuit and then is switched to the output of the second oscillation circuit; The first oscillation circuit is activated, and the second oscillation circuit is not activated by the suppression circuit, and only the output of the first oscillation circuit is selectively output by the switch circuit. This can be achieved by an oscillation circuit.

上記の課題は、第1の発振回路と、該第1の発振回路より長い発振安定時間を有する第2の発振回路と、外部からも情報を設定可能であると共に、外部より設定されている情報を参照可能な制御レジスタ部と、該第2の発振回路の発振安定時間の経過を示す安定フラグを出力して該制御レジスタ部に設定する信号生成回路と、該制御レジスタ部に設定されている選択ビットに基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路とを備え、該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられる第1のモードを有することを特徴とする発振回路により達成できる。   The above problem is that the first oscillation circuit, the second oscillation circuit having an oscillation stabilization time longer than the first oscillation circuit, information that can be set from the outside, and information that is set from the outside Is set in the control register unit, a signal generation circuit that outputs a stability flag indicating the passage of the oscillation stabilization time of the second oscillation circuit and sets the control register unit in the control register unit And a switch circuit that selectively outputs one of the outputs of the first and second oscillation circuits based on a selection bit, and the first and second oscillation circuits are activated simultaneously and are switched by the switch circuit. This can be achieved by an oscillation circuit characterized by having a first mode that is switched to the output of the second oscillation circuit after the output of the oscillation circuit is selectively output.

上記の課題は、クロック生成回路と、制御レジスタ部と、CPUを備えた半導体装置であって、該クロック生成回路は第1の発振回路と、該第1の発振回路より長い発振安定時間を有する第2の発振回路と、該CPUのソフトウェアからも情報を設定可能であると共に該ソフトウェアより設定されている情報を参照可能な制御レジスタ部と、該第2の発振回路の発振安定時間の経過を示す安定フラグを出力して該制御レジスタ部に設定する信号生成回路と、該制御レジスタ部に設定されている選択ビットに基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路とを備え、該半導体装置の電源投入後、リセット後又はスタンバイ状態から動作状態への復帰後に、該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられる第1のモードを有することを特徴とする半導体装置により達成できる。   The above-described problem is a semiconductor device including a clock generation circuit, a control register unit, and a CPU, and the clock generation circuit has a first oscillation circuit and an oscillation stabilization time longer than that of the first oscillation circuit. The second oscillation circuit, the control register unit that can set information from the software of the CPU and can refer to the information set by the software, and the passage of the oscillation stabilization time of the second oscillation circuit A signal generation circuit that outputs a stability flag to set in the control register unit, and selectively outputs one of the outputs of the first and second oscillation circuits based on a selection bit set in the control register unit A switch circuit, and after the semiconductor device is turned on, after resetting or after returning from the standby state to the operating state, the first and second oscillation circuits are activated simultaneously, and the switch It can be achieved by a semiconductor device and having a first mode in which the output of the first oscillator circuit is switched to the output of the second oscillator circuit after the selected output by road.

本発明によれば、電源投入後、リセット後、スタンバイ状態からの復帰後のMCUの処理の高速化と低消費電力化を両立できる発振回路及び半導体装置を実現可能である。   According to the present invention, it is possible to realize an oscillation circuit and a semiconductor device that can achieve both high speed processing and low power consumption of an MCU after power-on, reset, and recovery from a standby state.

本発明では、発振回路内に第1及び第2の発振回路がソフトウェアにより選択可能に設けられている。第1の発振回路は、Q値が低い素子(Q値の低い周波数制御素子、抵抗、容量)を用い、発振周波数精度は高くないが、起動時の待ち時間(発振安定時間)は比較的短い。第2の発振回路は、Q値が高い周波数制御素子を用い、非常に精度の高い発振が可能であると共に、公称周波数に対する周波数偏差が小さいが、例えば電源が印加されてから発振周波数及び信号振幅が十分に安定するまでに要する時間(発振安定時間)は例えば数十マイクロ秒から数百マイクロ秒と比較的長い。   In the present invention, the first and second oscillation circuits are provided in the oscillation circuit so as to be selectable by software. The first oscillation circuit uses an element having a low Q value (frequency control element, resistance, capacitance) having a low Q value, and the oscillation frequency accuracy is not high, but the waiting time at startup (oscillation stabilization time) is relatively short. . The second oscillation circuit uses a frequency control element having a high Q value and can oscillate with very high accuracy and has a small frequency deviation with respect to the nominal frequency. For example, the oscillation frequency and signal amplitude after the power supply is applied. The time required to sufficiently stabilize (oscillation stabilization time) is relatively long, for example, from several tens of microseconds to several hundreds of microseconds.

本発明では、第1の発振回路の出力と第2の発振回路の出力を切り替えて使用するモードと、第1の発振回路の出力だけを使用して第2の発振回路を起動しないモードを選択可能である。つまり、プログラムを設計する設計者が、最適なクロック源をソフトウエアから指定することが可能であり、第1の発振回路しか使用しない場合には第2の発振回路を起動しないので、消費電力を削減することができる。   In the present invention, a mode in which the output of the first oscillation circuit and the output of the second oscillation circuit are switched and used, and a mode in which only the output of the first oscillation circuit is used and the second oscillation circuit is not activated are selected. Is possible. In other words, the designer who designs the program can specify the optimum clock source from the software, and when only the first oscillation circuit is used, the second oscillation circuit is not started. Can be reduced.

以下に、本発明の発振回路及び半導体装置の各実施例を、図3以降と共に説明する。   Hereinafter, embodiments of the oscillation circuit and the semiconductor device of the present invention will be described with reference to FIG.

図3は、本発明の一実施例を示すブロック図である。図3に示すMCU1は、クロック生成回路11、CPU12及び制御レジスタ部13を有する。半導体装置を構成するMCU1は、所謂ワンチップマイコンである。クロック生成回路11は、後述する発振回路110を有し、CPU12にクロックを供給する。CPU12に供給されるクロックは、発振回路110から出力されるクロックであっても、発振回路110から出力されるクロックを基準としてクロック生成回路11内で生成されたクロックであっても良い。制御レジスタ部13は、メモリ等の各種記憶手段で構成可能であり、発振回路110の情報が発振回路110から設定可能であると共に、CPU12のソフトウェアにより参照可能であり、且つ、ソフトウェアにより情報を設定可能である。   FIG. 3 is a block diagram showing an embodiment of the present invention. 3 includes a clock generation circuit 11, a CPU 12, and a control register unit 13. The MCU 1 constituting the semiconductor device is a so-called one-chip microcomputer. The clock generation circuit 11 has an oscillation circuit 110 described later, and supplies a clock to the CPU 12. The clock supplied to the CPU 12 may be a clock output from the oscillation circuit 110 or a clock generated in the clock generation circuit 11 based on the clock output from the oscillation circuit 110. The control register unit 13 can be configured by various storage means such as a memory, information of the oscillation circuit 110 can be set from the oscillation circuit 110, can be referred to by software of the CPU 12, and information is set by software. Is possible.

尚、制御レジスタ部13は、クロック生成回路11内の発振回路110の一部を構成するものであっても良い。   Note that the control register unit 13 may constitute a part of the oscillation circuit 110 in the clock generation circuit 11.

発振回路110には、図4と共に後述するように、第1及び第2の発振回路が制御レジスタ部13を介してソフトウェアにより選択可能に設けられている。第1の発振回路は、Q値が低い素子(Q値の低い周波数制御素子、抵抗、容量)を用い、発振周波数精度は高くないが、起動時の待ち時間(発振安定時間)は比較的短い。第2の発振回路は、Q値が高い周波数制御素子を用い、非常に精度の高い発振が可能であると共に、公称周波数に対する周波数偏差が小さいが、例えば電源が印加されてから発振周波数及び信号振幅が十分に安定するまでに要する時間(発振安定時間)は例えば数十マイクロ秒から数百マイクロ秒と比較的長い。   As will be described later with reference to FIG. 4, the oscillation circuit 110 is provided with first and second oscillation circuits that can be selected by software via the control register unit 13. The first oscillation circuit uses an element having a low Q value (frequency control element, resistance, capacitance) having a low Q value, and the oscillation frequency accuracy is not high, but the waiting time at startup (oscillation stabilization time) is relatively short. . The second oscillation circuit uses a frequency control element having a high Q value and can oscillate with very high accuracy and has a small frequency deviation with respect to the nominal frequency. For example, the oscillation frequency and signal amplitude after the power supply is applied. The time required to sufficiently stabilize (oscillation stabilization time) is relatively long, for example, from several tens of microseconds to several hundreds of microseconds.

図4は発振回路110の構成を制御レジスタ部13と共に示す回路図である。発振回路110は、図4に示す如く接続されたCR発振回路CRO1、水晶又はセラミック発振回路OSC1、スイッチ回路SW2,SW3、カウンタ回路CUNT1、Dフリップフロップ回路DFF1、バッファ回路BUF1及びアンド回路AND1,AND2,AND3を有する。アンド回路AND3は、一方の入力を反転してから他方の入力との論理積を演算する構成を有する。発振回路OSC1は、図4に示す如く接続されたスイッチ回路SW1、容量C1,C2、抵抗R1、水晶振動子又はセラミック振動子XTAL1及びインバータ回路INV1を有する。以下の説明では、便宜上、発振回路OSC1はセラミック振動子XTAL1を有するセラミック発振回路であるものとする。CR発振回路CRO1は上記第1の発振回路を構成し、セラミック発振回路OSC1は上記第2の発振回路を構成する。 アンド回路AND1、カウンタ回路CUNT1及びDフリップフロップ回路DFF1は、第2の発振回路の発振安定時間の経過を示す安定信号を出力する(即ち、OSC1安定負ラフOSFを制御レジスタ部13に設定する)信号生成回路を構成する。スイッチ回路SW3は、選択信号(即ち、制御レジスタ部13からのOS1選択ビットSOS1)に基づいて第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路を構成する。又、アンド回路AND2、スイッチ回路SW1及びインバータ回路INV1は、抑止信号(即ち、制御レジスタ部13からのOSC1起動抑止ビットIHOS1)に基づいて第2の発振回路の起動を抑止する抑止回路を構成する。   FIG. 4 is a circuit diagram showing the configuration of the oscillation circuit 110 together with the control register unit 13. The oscillation circuit 110 includes a CR oscillation circuit CRO1, a crystal or ceramic oscillation circuit OSC1, a switch circuit SW2, SW3, a counter circuit CUNT1, a D flip-flop circuit DFF1, a buffer circuit BUF1, and AND circuits AND1, AND2 connected as shown in FIG. , AND3. The AND circuit AND3 has a configuration that inverts one input and then calculates a logical product with the other input. The oscillation circuit OSC1 includes a switch circuit SW1, capacitors C1 and C2, a resistor R1, a crystal resonator or ceramic resonator XTAL1, and an inverter circuit INV1, which are connected as shown in FIG. In the following description, for the sake of convenience, it is assumed that the oscillation circuit OSC1 is a ceramic oscillation circuit having a ceramic resonator XTAL1. The CR oscillation circuit CRO1 constitutes the first oscillation circuit, and the ceramic oscillation circuit OSC1 constitutes the second oscillation circuit. The AND circuit AND1, the counter circuit CUNT1, and the D flip-flop circuit DFF1 output a stable signal indicating the lapse of the oscillation stabilization time of the second oscillation circuit (that is, the OSC1 stable negative rough OSF is set in the control register unit 13). A signal generation circuit is configured. The switch circuit SW3 constitutes a switch circuit that selects and outputs one of the outputs of the first and second oscillation circuits based on the selection signal (that is, the OS1 selection bit SOS1 from the control register unit 13). The AND circuit AND2, the switch circuit SW1, and the inverter circuit INV1 constitute a suppression circuit that suppresses activation of the second oscillation circuit based on the inhibition signal (that is, the OSC1 activation inhibition bit IHOS1 from the control register unit 13). .

図4において、Vddは正の電源電圧(例えば+3V)、GNDはグランド電位(0V)、COUTはカウンタ回路CUNT1の出力、DFOはフリップフロップ回路DFF1の正の出力を、DFOXはフリップフロップ回路DFF1の負の出力、CLCNTはアンド回路AND1の出力、VDDCRはCR発振回路CRO1の電源端子への入力、NX0,NX1はセラミック発振回路OSC1の外部接続端子、OSCO1はセラミック発振回路OSC1の発振出力、OSCO2はCR発振回路CRO1の発振出力、OSCENはセラミック発振回路OSC1に対するイネーブル信号、CKOは出力クロックを示す。更に、CSW1はスイッチ回路SW1の制御信号、CSW2はスイッチ回路SW2の制御信号、OSCCRはソフトウエアから発振回路110を切り替え制御するための制御レジスタ、OSIFは割り込み信号を発生するための割り込みフラグ、OSFはセラミック発振回路OSC1の出力が安定したことを示すフラグ、OSFIEは割り込みフラグOSIFがセットされた場合に割り込みを許可するためのビット、SOS1はソフトウエアで明示的に発振回路110をCR発振回路CRO1からセラミック発振回路OSC1に切り替えるビット、IHOS1はセラミック発振回路OSC1の起動を抑止するためのビット、IRQOSCはセラミック発振回路OSC1の出力が安定した場合に発生される割り込み信号を示す。   In FIG. 4, Vdd is a positive power supply voltage (for example, +3 V), GND is a ground potential (0 V), COUT is an output of the counter circuit CUNT1, DFO is a positive output of the flip-flop circuit DFF1, and DFOX is an output of the flip-flop circuit DFF1. Negative output, CLCNT is output of AND circuit AND1, VDDCR is input to the power supply terminal of CR oscillation circuit CRO1, NX0 and NX1 are external connection terminals of ceramic oscillation circuit OSC1, OSCO1 is oscillation output of ceramic oscillation circuit OSC1, and OSCO2 is The oscillation output of the CR oscillation circuit CRO1, OSCEN indicates an enable signal for the ceramic oscillation circuit OSC1, and CKO indicates an output clock. Further, CSW1 is a control signal for the switch circuit SW1, CSW2 is a control signal for the switch circuit SW2, OSCCR is a control register for switching and controlling the oscillation circuit 110 from software, OSIF is an interrupt flag for generating an interrupt signal, OSF Is a flag indicating that the output of the ceramic oscillation circuit OSC1 has been stabilized, OSFIE is a bit for permitting an interrupt when the interrupt flag OSIF is set, SOS1 is the software to explicitly set the oscillation circuit 110 to the CR oscillation circuit CRO1 Is a bit for switching from 1 to ceramic oscillation circuit OSC1, IHOS1 is a bit for suppressing activation of ceramic oscillation circuit OSC1, and IRQOSC is an interrupt signal generated when the output of ceramic oscillation circuit OSC1 is stabilized.

発振回路OSC1の起動時の待ち時間(発振安定時間)は長いが、発振周波数精度は高い。一方、CR発振回路CRO1の発振周波数精度は低いが、起動時の待ち時間(発振安定時間)は短い。図4の発振回路110では、これらの特性の異なる2つの発振回路OSC1,CRO1を使用して、MCU1の総合的な性能向上を図っている。   Although the waiting time (oscillation stabilization time) when starting up the oscillation circuit OSC1 is long, the oscillation frequency accuracy is high. On the other hand, the oscillation frequency accuracy of the CR oscillation circuit CRO1 is low, but the waiting time (oscillation stabilization time) at startup is short. In the oscillation circuit 110 of FIG. 4, the two oscillation circuits OSC1 and CRO1 having different characteristics are used to improve the overall performance of the MCU1.

制御レジスタ部13には、後述するように、OSC1選択ビットSOS1、OSC1安定割り込み許可ビットOSFIE、OSC1安定フラグOSF、OSC1割り込みフラグ、OSC1起動抑止ビット等が設定される。   As will be described later, the control register unit 13 is set with an OSC1 selection bit SOS1, an OSC1 stable interrupt permission bit OSFIE, an OSC1 stability flag OSF, an OSC1 interrupt flag, an OSC1 activation inhibition bit, and the like.

図1に示す従来の発振回路では、スイッチ回路SW103、カウンタ回路CUNT101及びDフリップフロップ回路DFF101を用いて、セラミック発振回路OSC101の出力OSCO1が安定した後、ハードウエアで自動的にクロックCKOをCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC101の出力OSCO1に切り替えている。   In the conventional oscillation circuit shown in FIG. 1, after the output OSCO1 of the ceramic oscillation circuit OSC101 is stabilized using the switch circuit SW103, the counter circuit CUNT101, and the D flip-flop circuit DFF101, the clock CKO is automatically CR-oscillated by hardware. The output OSCO2 of the circuit CRO1 is switched to the output OSCO1 of the ceramic oscillation circuit OSC101.

これに対し、図4に示す本実施例の発振回路110では、割り込み信号と割り込みプログラムにより、MCU1に供給するクロックを、CR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替える。   On the other hand, in the oscillation circuit 110 of this embodiment shown in FIG. 4, the clock supplied to the MCU 1 is switched from the output OSCO2 of the CR oscillation circuit CRO1 to the output OSCO1 of the ceramic oscillation circuit OSC1 by an interrupt signal and an interrupt program.

次に、発振回路110の動作を完全に停止したMCU1のスタンバイ状態から動作状態に復帰させ、MCU1でプログラム処理を進めることを想定して、処理の流れの概略を図5乃至図8と共に説明する。尚、MCU1の電源投入後又はリセット後の発振回路110の処理の流れも、スタンバイ状態から動作状態に復帰後の処理の流れと同様であるため、その説明は省略する。図5及び図8は発振回路110の動作を説明するタイミングチャートであり、Hはハイレベル、Lはローレベルを示す。又、図6及び図7は発振回路110の動作を説明するフローチャートである。具体的には、図6(a)及び図7はメインプログラムの処理を示し、図6(b)は割り込みプログラムの処理を示す。   Next, an outline of the processing flow will be described with reference to FIG. 5 to FIG. 8 on the assumption that the MCU 1 is restored from the standby state where the operation of the oscillation circuit 110 is completely stopped and the MCU 1 proceeds with the program processing. . Note that the flow of processing of the oscillation circuit 110 after powering on or resetting the MCU 1 is the same as the flow of processing after returning from the standby state to the operating state, and a description thereof will be omitted. 5 and 8 are timing charts for explaining the operation of the oscillation circuit 110, where H indicates a high level and L indicates a low level. 6 and 7 are flowcharts for explaining the operation of the oscillation circuit 110. FIG. Specifically, FIGS. 6A and 7 show processing of the main program, and FIG. 6B shows processing of the interrupt program.

ここでは説明の便宜上、MCU1はスタンバイ状態にあり、例えば割り込み信号で動作状態への復帰が始まるものとする。MCU1の動作状態への復帰が始まると、CR発振CRO1と、セラミック発振回路OSC1の起動が始まる。CR発振回路CRO1の出力OSCO2は短時間で安定するので、この出力OSCO2が発振回路110の出力クロックCKOとして出力される。この例では、出力クロックCKOがそのままMCU1のクロックとしてCPU12に供給され、図6(a)に示すようにステップS1で発振周波数精度の必要ないMCU1の処理を実行し始める。発振周波数精度の必要ないMCU1の処理の例としては、例えばMCU1内のレジスタやメモリの値の初期化等が挙げられる。尚、発振周波数精度が必要なMCU1の処理としては、例えば通信、タイマによる時間の測定、一定時間間隔でのパルスの発生等の処理が挙げられる。   Here, for convenience of explanation, it is assumed that the MCU 1 is in a standby state and, for example, the return to the operation state is started by an interrupt signal. When the MCU1 returns to the operating state, the CR oscillation CRO1 and the ceramic oscillation circuit OSC1 start to start. Since the output OSCO2 of the CR oscillation circuit CRO1 is stabilized in a short time, the output OSCO2 is output as the output clock CKO of the oscillation circuit 110. In this example, the output clock CKO is supplied as it is to the CPU 12 as the clock of the MCU1, and as shown in FIG. 6A, the processing of the MCU1 that does not require the oscillation frequency accuracy is started in step S1. As an example of the processing of the MCU 1 that does not require the oscillation frequency accuracy, for example, initialization of values of registers and memories in the MCU 1 can be cited. Examples of processing of the MCU 1 that requires oscillation frequency accuracy include processing such as communication, measurement of time by a timer, generation of pulses at a constant time interval, and the like.

CR発振回路CRO1の出力OSCO2を利用して、発振周波数精度が必要ないMCU1の処理の実行を進めておくことで、セラミック発振回路OSC1の出力OSCO1の安定を待たずにプログラムの実行を進めることができ、MCU1の処理を高速化することができる。   By using the output OSCO2 of the CR oscillation circuit CRO1 and executing the processing of the MCU1 that does not require the oscillation frequency accuracy, the execution of the program can be advanced without waiting for the stabilization of the output OSCO1 of the ceramic oscillation circuit OSC1. It is possible to speed up the processing of the MCU1.

図6(a)に示すように、ステップS4で発振周波数精度が必要なMCU1の処理を実行する前に、セラミック発振回路CRO1の出力OSCO1が安定したことを確認するステップS2と、MCU1内のCPU12に供給されるクロックがセラミック発振回路OSC1の出力OSCO1となっていることを確認するステップS3を行う。セラミック発振回路OSC1の出力OSCO1が安定していない場合には、ステップS2の判定結果はNOであるため、出力OSCO1が安定するまでステップS2が繰り返される。出力OSCO1が安定してステップS2の判定結果がYESになり、且つ、MCU1のクロックCKOがCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替わったことが確認されてステップS3の判定結果がYESになると、ステップS4で発振周波数精度が必要なMCU1の処理を実行する。このようにプログラムを構成しておくことで、発振周波数精度が必要な処理を、CR発振回路CRO1の出力OSCO2をクロックCKOとして用いて実行することを防ぐことができる。   As shown in FIG. 6 (a), before executing the processing of MCU1 that requires oscillation frequency accuracy in step S4, step S2 for confirming that the output OSCO1 of the ceramic oscillation circuit CRO1 is stable, and the CPU 12 in the MCU1. Step S3 for confirming that the clock supplied to the output OSCO1 of the ceramic oscillation circuit OSC1 is performed. If the output OSCO1 of the ceramic oscillation circuit OSC1 is not stable, the determination result of step S2 is NO, and therefore step S2 is repeated until the output OSCO1 becomes stable. In step S3, it is confirmed that the output OSCO1 is stable, the determination result in step S2 is YES, and the clock CKO of the MCU1 is switched from the output OSCO2 of the CR oscillation circuit CRO1 to the output OSCO1 of the ceramic oscillation circuit OSC1. If the result is YES, in step S4, the processing of MCU1 that requires oscillation frequency accuracy is executed. By configuring the program in this way, it is possible to prevent the processing that requires the oscillation frequency accuracy from being executed using the output OSCO2 of the CR oscillation circuit CRO1 as the clock CKO.

図6(b)は、MCU1のクロックCKOをCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替えるための割り込みプログラムの処理の概略を示す。出力OSCO1が安定することで、図4に示した割り込み信号IRQOSCが発生されるものとする。図6(b)の処理は、割り込み信号IRQOSCにより実行される割り込みプログラムとして記述されるものとする。割り込み信号IRQOSCが発生されると、この時点で、出力OSCO1が安定していることになるので、ステップS11でCPU12に供給するクロックCKOを出力OSCO2から出力OSCO1に切り替える。又、MCU1のクロックCKOを出力OSCO2から出力OSCO1に切り替えた後、ステップS12でプログラムの制御を元のプログラムの割り込みが発生した時点に戻す。   FIG. 6B shows an outline of processing of an interrupt program for switching the clock CKO of the MCU1 from the output OSCO2 of the CR oscillation circuit CRO1 to the output OSCO1 of the ceramic oscillation circuit OSC1. It is assumed that the interrupt signal IRQOSC shown in FIG. 4 is generated when the output OSCO1 is stabilized. The processing in FIG. 6B is described as an interrupt program executed by the interrupt signal IRQOSC. When the interrupt signal IRQOSC is generated, the output OSCO1 is stable at this time, so the clock CKO supplied to the CPU 12 is switched from the output OSCO2 to the output OSCO1 in step S11. Further, after switching the clock CKO of the MCU 1 from the output OSCO 2 to the output OSCO 1, the control of the program is returned to the time when the interruption of the original program occurs in step S 12.

例えば、出力OSCO1が安定して割り込み信号IRQOSCが発生される時点が、発振周波数精度が必要ない処理を進めている最中だと仮定する。この場合、発振周波数精度が必要ない処理の最中に、OSC1安定割り込み(IRQOSC)が発生し、MCU1のクロックCKOはCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替えられる。発振周波数精度が必要ない処理を進めている最中であるため、クロックCKOが発振周波数精度が高いクロックに切り替わっても問題は生じない。図6(a)のステップS1は、セラミック発振回路OSC1の出力OSCO1をクロック源として発振周波数精度が必要ない処理を終わらせ、ステップS2は、出力OSCO1の安定の判定を行う。この場合、既に出力OSCO1は安定しており、又、MCU1のクロックCKOは出力OSCO1となっているので、ステップS2及びS3の判定結果はいずれもYESであり、ステップS4で発振周波数精度が必要な処理が実行される。   For example, it is assumed that the time when the output OSCO1 is stabilized and the interrupt signal IRQOSC is generated is during a process that does not require oscillation frequency accuracy. In this case, an OSC1 stable interrupt (IRQOSC) is generated during processing that does not require oscillation frequency accuracy, and the clock CKO of MCU1 is switched from the output OSCO2 of the CR oscillation circuit CRO1 to the output OSCO1 of the ceramic oscillation circuit OSC1. Since processing that does not require oscillation frequency accuracy is in progress, there is no problem even when the clock CKO is switched to a clock with high oscillation frequency accuracy. Step S1 in FIG. 6A ends the processing that does not require the oscillation frequency accuracy using the output OSCO1 of the ceramic oscillation circuit OSC1 as a clock source, and step S2 determines whether the output OSCO1 is stable. In this case, since the output OSCO1 is already stable and the clock CKO of the MCU1 is the output OSCO1, the determination results in steps S2 and S3 are both YES, and the oscillation frequency accuracy is required in step S4. Processing is executed.

又、出力OSCO1が安定して割り込み信号IRQOSCが発生される時点が、発振周波数精度が必要ない処理が終わり、出力OSCO1の安定を待っている時点だと仮定する。この場合も上記の場合と同様に、出力OSCO1が安定した時点で、割り込み信号IRQOSCが発生し、割り込みプログラムによりMCU1のクロックCKOが出力OSCO2から出力OSCO1に切り替えられる。ステップS1は発振周波数精度が必要ない処理を終わらせ、その後、ステップS2及びステップS3の判定を経て、ステップS4で発振周波数精度が必要な処理が実行される。   Further, it is assumed that the time when the output signal OSCO1 is stabilized and the interrupt signal IRQOSC is generated is the time when the processing that does not require the oscillation frequency accuracy is finished and the output OSCO1 is waiting for stabilization. Also in this case, as in the above case, when the output OSCO1 is stabilized, the interrupt signal IRQOSC is generated, and the clock CKO of the MCU1 is switched from the output OSCO2 to the output OSCO1 by the interrupt program. Step S1 ends the process that does not require the oscillation frequency accuracy, and then, after the determinations in steps S2 and S3, the process that requires the oscillation frequency accuracy is executed in step S4.

このように、図4に示す構成を有する発振回路110によれば、割り込み信号と割り込みプログラムを用いても、図1に示す従来の発振回路の場合と同様に、CR発振回路CRO1の出力OSCO2を用いて、セラミック発振回路OSC1の出力OSCO1が安定する前にMCU1の処理を開始することできる。   As described above, according to the oscillation circuit 110 having the configuration shown in FIG. 4, the output OSCO2 of the CR oscillation circuit CRO1 can be obtained even when the interrupt signal and the interrupt program are used, as in the case of the conventional oscillation circuit shown in FIG. It is possible to start processing of the MCU 1 before the output OSCO 1 of the ceramic oscillation circuit OSC 1 is stabilized.

又、図4に示す構成を有する発振回路110によれば、図1に示す従来の発振回路とは異なり、セラミック発振回路CRO1を使用しないようにMCU1をプログラムすることも可能である。例えば、割り込み信号に応答してMCU1がスタンバイ状態から復帰し、あるセンサの値を確認して直ちに再度スタンバイ状態に戻るような場合を想定すると、セラミック発振回路OSC1をわざわざ起動せずとも、CR発振回路CRO1を起動してごく短時間の処理さえ行えれば問題がない場合がある。このような場合には、CR発振回路CRO1だけを起動した方が発振回路110の消費電力は少なくて済み、MCU1全体としての消費電力を低減可能である。   Further, according to the oscillation circuit 110 having the configuration shown in FIG. 4, unlike the conventional oscillation circuit shown in FIG. 1, the MCU 1 can be programmed not to use the ceramic oscillation circuit CRO1. For example, assuming that the MCU 1 returns from the standby state in response to the interrupt signal and immediately returns to the standby state after confirming the value of a certain sensor, the CR oscillation can be performed without bothering the ceramic oscillation circuit OSC1 to start. There may be no problem as long as the circuit CRO1 is activated to perform a very short process. In such a case, the power consumption of the oscillation circuit 110 can be reduced by activating only the CR oscillation circuit CRO1, and the power consumption of the MCU 1 as a whole can be reduced.

図7は、このような場合のメインプログラムの処理を示す。予め、MCU1がスタンバイ状態から動作状態へ復帰し、処理を行う時間がごく短いことが予想される場合には、図7のような処理とすることが可能であり、このような処理とすることが望ましい。割り込み信号に応答してMCU1がスタンバイ状態から動作状態に復帰するに際して、CR発振回路CRO1の起動を開始するが、このときステップS21ではセラミック発振回路OSC1は起動しない。CR発振回路CRO1の出力OSCO2が安定した時点でCPU12に出力OSCO2をクロックCKOとして供給し、ステップS22で発振精度の必要ない処理を実行する。ステップS22の処理が終了した時点で、ステップS23ではCR発振回路CRO1の動作を停止して、再びMCU1をスタンバイ状態とする。   FIG. 7 shows the processing of the main program in such a case. If the MCU 1 is expected to return from the standby state to the operating state in advance and the processing time is expected to be very short, the processing as shown in FIG. 7 can be performed. Is desirable. When the MCU 1 returns from the standby state to the operating state in response to the interrupt signal, the activation of the CR oscillation circuit CRO1 is started. At this time, however, the ceramic oscillation circuit OSC1 is not activated. When the output OSCO2 of the CR oscillation circuit CRO1 is stabilized, the output OSCO2 is supplied to the CPU 12 as the clock CKO, and processing that does not require oscillation accuracy is executed in step S22. When the process of step S22 is completed, the operation of the CR oscillation circuit CRO1 is stopped in step S23, and the MCU 1 is again set to the standby state.

図1に示す従来の発振回路では、このような状況でも、セラミック発振回路が起動されるのに対して、図4に示す構成を有する発振回路110によれば、セラミック発振回路OSC1の起動を抑止するのでMCU1の低消費電力化が可能である。   In the conventional oscillation circuit shown in FIG. 1, the ceramic oscillation circuit is activated even in such a situation, whereas the oscillation circuit 110 having the configuration shown in FIG. 4 suppresses activation of the ceramic oscillation circuit OSC1. Therefore, the power consumption of the MCU 1 can be reduced.

次に、図4、図5及び図8を参照して、より具体的な回路接続も含めて説明する。   Next, with reference to FIGS. 4, 5 and 8, a description will be given including more specific circuit connections.

図1に示す従来の発振回路の場合と同様に、MCU1の電源投入直後、又は、リセット直後、又は、スタンバイ状態では、イネーブル信号OSCENはLレベルであるものとする。イネーブル信号OSCENがLレベルなので、アンド回路AND1の出力CLCNTもLレベルである。出力CLCNTがLレベルなので、カウンタ回路CUNT1はクリアされ、その出力COUTはLレベルになる。又、カウンタ回路CUNT1は初期化される。同様に、イネーブル信号OSCENがLレベルなので、Dフリップフロップ回路DFF1もクリアされ、その出力DFOはLレベルになる。出力DFOXは出力DFOの反転信号なので、Hレベルになる。OSC1起動抑止ビットIHOS1は図5に示すようにHレベルであるものとする。OSC1起動抑止ビットIHOS1がHレベルのときセラミック発振回路OSC1も起動されるものとする。   As in the case of the conventional oscillation circuit shown in FIG. 1, it is assumed that the enable signal OSCEN is at L level immediately after the MCU 1 is powered on, immediately after reset, or in a standby state. Since the enable signal OSCEN is at L level, the output CLCNT of the AND circuit AND1 is also at L level. Since the output CLCNT is at L level, the counter circuit CUNT1 is cleared and its output COUT becomes L level. In addition, the counter circuit CUNT1 is initialized. Similarly, since the enable signal OSCEN is at L level, the D flip-flop circuit DFF1 is also cleared and its output DFO becomes L level. Since the output DFOX is an inverted signal of the output DFO, it becomes H level. Assume that the OSC1 activation inhibition bit IHOS1 is at the H level as shown in FIG. It is assumed that the ceramic oscillation circuit OSC1 is also activated when the OSC1 activation inhibition bit IHOS1 is at the H level.

電源投入後又はリセット後、イネーブル信号OSCENをLレベルからHレベルに変化させることで、発振回路OSC1,CRO1の動作が開始される。イネーブル信号OSCENをHレベルにすると、OSC1起動抑止ビットIHOS1がHレベルなので、アンド回路AND2の出力CSW1もHレベルになる。出力CSW1がHレベルになると、スイッチ回路SW1がオンとなってインバータ回路INV1に電源電圧Vddが供給され、発振回路OSC1が動作を始める。又、出力DFOXがHレベルなので、イネーブル信号OSCENがHレベルになると、アンド回路AND1の出力CLCNTもHレベルになる。出力CLCNTがHレベルになるので、セラミック発振回路OSC1が動作を始めると、カウンタ回路CUNT1がセラミック発振回路OSC1の出力OSCO1の変化をカウントする。OSC1選択ビットSOS1は、図5に示すように、MCU1のスタンバイ状態からの復帰直後はLレベルであるものとする。OSC1選択ビットSOS1がLレベルであるため、イネーブル信号OSCENがHレベルになるとアンド回路AND3の出力CSW2がHレベルになる。アンド回路AND3の出力CSW2がHレベルになると、スイッチ回路SW2はオンとなる。スイッチ回路SW2がオンとなると、入力VDDCRがHレベルになってCR発振回路CRO1に電源電圧Vddが供給され、CR発振回路CRO1も動作を開始する。   The operation of the oscillation circuits OSC1 and CRO1 is started by changing the enable signal OSCEN from L level to H level after power-on or reset. When the enable signal OSCEN is set to H level, since the OSC1 activation inhibition bit IHOS1 is at H level, the output CSW1 of the AND circuit AND2 also becomes H level. When the output CSW1 becomes H level, the switch circuit SW1 is turned on, the power supply voltage Vdd is supplied to the inverter circuit INV1, and the oscillation circuit OSC1 starts operating. Since the output DFOX is at the H level, when the enable signal OSCEN becomes the H level, the output CLCNT of the AND circuit AND1 also becomes the H level. Since the output CLCNT becomes H level, when the ceramic oscillation circuit OSC1 starts operation, the counter circuit CUNT1 counts a change in the output OSCO1 of the ceramic oscillation circuit OSC1. As shown in FIG. 5, the OSC1 selection bit SOS1 is assumed to be L level immediately after the MCU1 returns from the standby state. Since the OSC1 selection bit SOS1 is at L level, when the enable signal OSCEN becomes H level, the output CSW2 of the AND circuit AND3 becomes H level. When the output CSW2 of the AND circuit AND3 becomes H level, the switch circuit SW2 is turned on. When the switch circuit SW2 is turned on, the input VDDCR becomes H level, the power supply voltage Vdd is supplied to the CR oscillation circuit CRO1, and the CR oscillation circuit CRO1 also starts its operation.

スイッチ回路SW2がオンとなった後、ごく短い時間で、CR発振回路CRO1の出力OSCO2は出力が安定する。出力OSCO2の信号振幅及び発振周波数が安定した後、セラミック発振回路OSC1の出力OSCO1の信号振幅及び発振周波数が安定する。CR発振回路CRO1の出力OSCO2が安定した後、スイッチ回路SW3により、出力OSCO2を出力クロックCKOとして出力する。この出力クロックCKOを基準クロックとして、MCU1の動作を開始することができる。   The output OSCO2 of the CR oscillation circuit CRO1 stabilizes in a very short time after the switch circuit SW2 is turned on. After the signal amplitude and oscillation frequency of the output OSCO2 are stabilized, the signal amplitude and oscillation frequency of the output OSCO1 of the ceramic oscillation circuit OSC1 are stabilized. After the output OSCO2 of the CR oscillation circuit CRO1 is stabilized, the output OSCO2 is output as the output clock CKO by the switch circuit SW3. The operation of the MCU 1 can be started using the output clock CKO as a reference clock.

セラミック発振回路OSC1が発振を開始してからある程度時間が経過すると、出力OSCO1の信号振幅及び発振周波数が安定する。この時間の経過を知るために、カウンタ回路CUNT1で出力OSCO1をカウントする。ある規定の回数だけ出力OSC1がHレベルとLレベルの変化を繰り返すことで、カウンタ回路CUNT1の出力COUTがLレベルからHレベルに変化する。   When a certain amount of time elapses after the ceramic oscillation circuit OSC1 starts oscillating, the signal amplitude and oscillation frequency of the output OSCO1 are stabilized. In order to know the passage of this time, the output OSCO1 is counted by the counter circuit CUNT1. By repeating the change of the output OSC1 between the H level and the L level for a predetermined number of times, the output COUT of the counter circuit CUNT1 changes from the L level to the H level.

カウンタ回路CUNT1の出力COUTがLレベルからHレベルに変化することで、Dフリップフロップ回路DFF1の出力DFOもLレベルからHレベルに変化する。出力DFOがLレベルからHレベルに変化することで、割り込み信号のためのOSC1割り込みフラグOSIF及びセラミック発振回路OSC1の出力OSCO1が安定したことを示すOSC1安定フラグOSFがHレベルになる。このとき、予めOSC1安定割り込み許可ビットOSFIEをHレベルにしておくことで、OSC1安定割り込み信号IRQOSCが発生されるものとする。   As the output COUT of the counter circuit CUNT1 changes from L level to H level, the output DFO of the D flip-flop circuit DFF1 also changes from L level to H level. When the output DFO changes from the L level to the H level, the OSC1 interrupt flag OSIF for the interrupt signal and the OSC1 stability flag OSF indicating that the output OSCO1 of the ceramic oscillation circuit OSC1 is stabilized become the H level. At this time, the OSC1 stable interrupt signal IRQOSC is generated by previously setting the OSC1 stable interrupt permission bit OSFIE to the H level.

Dフリップフロップ回路DFF1の出力DFOがLレベルからHレベルに変化することで、出力DFOXはHレベルからLレベルに変化する。出力DFOXがLレベルになることで、アンド回路AND1の出力CLCNTもLレベルになる。カウンタ回路CUNT1のクリア端子CLがLレベルになるので、カウンタ回路CUNT1は動作を停止し、クリアされる。この結果、カウンタ回路CUNT1の出力COUTはLレベルになる。   As the output DFO of the D flip-flop circuit DFF1 changes from the L level to the H level, the output DFOX changes from the H level to the L level. When the output DFOX becomes L level, the output CLCNT of the AND circuit AND1 also becomes L level. Since the clear terminal CL of the counter circuit CUNT1 becomes L level, the counter circuit CUNT1 stops its operation and is cleared. As a result, the output COUT of the counter circuit CUNT1 becomes L level.

図5に示すように、OSC1安定割り込み信号IRQOSCがHレベルになることで、プログラムの制御は割り込みプログラムに移る。この割り込みプログラム中で、先ず例えばOSC1割り込みフラグOSIFをクリアする(Lレベルに書き換える)。これにより、MCU1がクロック切り替えの割り込みプログラムから元のプログラムに復帰したときに再度、クロック切り替え割り込みプログラムに制御が移ることを防げる。又、図5に示すように、OSC1安定割り込み信号IRQOSCは、例えばLレベルに戻る。一方、図5では図示を省略するが、セラミック発振回路OSC1の出力OSCO1が安定したことを示すOSC1安定フラグOSFはHレベルに保たれる。これにより、MCU1が割り込みプログラムから復帰した後も、OSC1安定フラグOSFを参照することで、セラミック発振回路OSC1の出力OSCO1が安定したか否かを判定することができる。   As shown in FIG. 5, when the OSC1 stable interrupt signal IRQOSC becomes H level, the program control shifts to the interrupt program. In this interrupt program, first, for example, the OSC1 interrupt flag OSIF is cleared (rewritten to L level). As a result, when the MCU 1 returns from the clock switching interrupt program to the original program, control can be prevented from being transferred to the clock switching interrupt program again. Further, as shown in FIG. 5, the OSC1 stable interrupt signal IRQOSC returns to, for example, the L level. On the other hand, although not shown in FIG. 5, the OSC1 stability flag OSF indicating that the output OSCO1 of the ceramic oscillation circuit OSC1 is stabilized is kept at the H level. Thereby, even after MCU1 returns from the interrupt program, it is possible to determine whether or not the output OSCO1 of the ceramic oscillation circuit OSC1 is stable by referring to the OSC1 stability flag OSF.

つまり、割り込み発生のためのOSC1割り込みフラグOSIFと、セラミック発振回路OSC1の出力OSCO1が安定したことを示すOSC1安定フラグOSFを夫々設けることで、MCU1のメインプログラムから割り込みプログラムへの制御の移動と、割り込みプログラムからメインプログラムに制御が復帰した後もセラミック発振回路OSC1の出力OSCO1が安定したか否かを判定する機能の両立が可能となる。   That is, by providing the OSC1 interrupt flag OSIF for generating an interrupt and the OSC1 stability flag OSF indicating that the output OSCO1 of the ceramic oscillation circuit OSC1 is stable, the transfer of control from the main program of the MCU1 to the interrupt program, Even after the control returns from the interrupt program to the main program, it is possible to achieve both functions of determining whether or not the output OSCO1 of the ceramic oscillation circuit OSC1 is stable.

OSC1割り込みフラグOSIFをクリアした後、クロック切り替えのための割り込みプログラムでは、クロック切り替えのためのOSC1選択ビットSOS1をHレベルに書き換える。OSC1選択ビットSOS1がHレベルになることで、スイッチ回路SW3が切り替えられて、セラミック発振回路OSC1の出力OSCO1が出力クロックCKOとして出力される。図5に示す出力クロックCKOは、このような動作の場合の波形を示す。   After clearing the OSC1 interrupt flag OSIF, the OSC1 selection bit SOS1 for clock switching is rewritten to H level in the interrupt program for clock switching. When the OSC1 selection bit SOS1 becomes H level, the switch circuit SW3 is switched, and the output OSCO1 of the ceramic oscillation circuit OSC1 is output as the output clock CKO. The output clock CKO shown in FIG. 5 shows a waveform in such an operation.

又、OSC選択ビットSOS1がHレベルになると、アンド回路AND3の出力CSW2がLレベルになる。出力CSW2がLレベルになると、スイッチ回路SW2がオフとなり、CR発振回路CRO1には電源電圧Vddが供給されなくなり、CR発振回路CRO1は動作を停止する。又、入力VDDCRはLレベルになる。   When the OSC selection bit SOS1 becomes H level, the output CSW2 of the AND circuit AND3 becomes L level. When the output CSW2 becomes L level, the switch circuit SW2 is turned off, the power supply voltage Vdd is not supplied to the CR oscillation circuit CRO1, and the CR oscillation circuit CRO1 stops its operation. Further, the input VDDCR becomes L level.

以上説明したように、電源投入直後はCR発振回路CRO1によりMCU1のクロックを供給し、セラミック発振回路OSC1の出力OSCO1が安定した後は、セラミック発振回路OSC1によりMCU1のクロックを供給すると共にCR発振回路CRO1の動作を停止する。このような発振回路110の構成により、セラミック発振回路OSC1の出力OSCO1が安定する前であってもCR発振回路CRO1の出力OSCO2をMCU1のクロックとして供給することでMCU1の処理を進めることができ、且つ、セラミック発振回路OSC1の出力OSCO1が安定した後は発振周波数精度の高いセラミック発振回路OSC1の出力OSCO1をMCU1のクロックとして利用できる。   As described above, the clock of MCU1 is supplied by the CR oscillation circuit CRO1 immediately after the power is turned on, and after the output OSCO1 of the ceramic oscillation circuit OSC1 is stabilized, the clock of the MCU1 is supplied by the ceramic oscillation circuit OSC1 and the CR oscillation circuit. The operation of CRO1 is stopped. With such a configuration of the oscillation circuit 110, even before the output OSCO1 of the ceramic oscillation circuit OSC1 is stabilized, the processing of the MCU1 can be advanced by supplying the output OSCO2 of the CR oscillation circuit CRO1 as the clock of the MCU1, In addition, after the output OSCO1 of the ceramic oscillation circuit OSC1 is stabilized, the output OSCO1 of the ceramic oscillation circuit OSC1 with high oscillation frequency accuracy can be used as the clock of the MCU1.

図5は、MCU1に供給するクロックをCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替える場合の発振回路110の各部での波形を示す。これに対し、図8は、CR発振回路CRO1の出力OSCO2のみを使用する場合の発振回路110の各部での波形を示す。   FIG. 5 shows waveforms at various parts of the oscillation circuit 110 when the clock supplied to the MCU 1 is switched from the output OSCO2 of the CR oscillation circuit CRO1 to the output OSCO1 of the ceramic oscillation circuit OSC1. On the other hand, FIG. 8 shows waveforms at various parts of the oscillation circuit 110 when only the output OSCO2 of the CR oscillation circuit CRO1 is used.

図8の場合、図5の場合と同様に、MCU1のスタンバイ状態ではイネーブル信号OSCENはLレベルである。MCU1のスタンバイ状態から動作状態への復帰によりCR発振回路CRO1が起動されることは、図5の場合と同様である。図5との場合異なる点は、図8ではOSC1起動抑止ビットIHOS1がLレベルになっている点である。セラミック発振回路OSC1の起動を抑止するためのOSC1起動抑止ビットIHOS1を設けてこれを予めLレベルに設定しておけば、セラミック発振回路OSC1を起動しないように制御することができる。或いは、一旦セラミック発振回路OSC1を起動し始めても、CR発振回路CRO1の出力OSCO2が安定し、MCU1が動作を始めた時点で、制御レジスタOSCCR(図4では、そのアドレスを仮に000FFFとして示す)のOSC1起動抑止ビットIHOS1にLレベルを設定することで、セラミック発振回路OSC1の起動を中止することができる。   In the case of FIG. 8, as in the case of FIG. 5, the enable signal OSCEN is at the L level in the standby state of the MCU1. The activation of the CR oscillation circuit CRO1 by the return of the MCU1 from the standby state to the operating state is the same as in the case of FIG. The difference from FIG. 5 is that the OSC1 activation inhibition bit IHOS1 is at L level in FIG. If the OSC1 activation inhibition bit IHOS1 for inhibiting activation of the ceramic oscillation circuit OSC1 is provided and set to L level in advance, it can be controlled not to activate the ceramic oscillation circuit OSC1. Alternatively, once the ceramic oscillation circuit OSC1 starts to be activated, when the output OSCO2 of the CR oscillation circuit CRO1 is stabilized and the MCU1 starts to operate, the control register OSCCR (in FIG. 4, the address is temporarily shown as 000FFF) By setting the OSC1 activation inhibition bit IHOS1 to L level, the activation of the ceramic oscillation circuit OSC1 can be stopped.

次に、このようにセラミック発振回路OSC1の出力OSCO1を使用しない場合の発振回路110の動作を、図4及び図8と共に説明する。この場合、イネーブル信号OSCENがHレベルになりCR発振回路CRO1の出力OSCO2が安定した時点でMCU1がプログラムの実行を開始する。MCU1が動作した後、例えばOSC1起動抑止ビットIHOS1をLレベルにすると、アンド回路AND2の出力CSW1がLレベルになり、セラミック発振回路OSC1には電源電圧Vddが供給されなくなる。このため、セラミック発振回路OSC1の動作は停止し、その出力OSCO1は停止したままとなる。OSC1選択ビットSOS1は、セラミック発振回路OSC1を選択しないので、Lレベルにする。従って、CR発振回路CRO1の出力OSCO2がMCU1のクロックCKOとして供給される。図5の場合のようにOSC1選択ビットSOS1をHレベルにしないので、CR発振回路CRO1には電源電圧Vddが供給され続け、その出力OSCO2がMCU1のクロックCKOとして供給されてMCU1の処理が続けられる。   Next, the operation of the oscillation circuit 110 when the output OSCO1 of the ceramic oscillation circuit OSC1 is not used will be described with reference to FIGS. In this case, MCU1 starts executing the program when the enable signal OSCEN becomes H level and the output OSCO2 of the CR oscillation circuit CRO1 becomes stable. For example, when the OSC1 activation inhibition bit IHOS1 is set to L level after the MCU1 operates, the output CSW1 of the AND circuit AND2 becomes L level, and the power supply voltage Vdd is not supplied to the ceramic oscillation circuit OSC1. Therefore, the operation of the ceramic oscillation circuit OSC1 is stopped and the output OSCO1 remains stopped. The OSC1 selection bit SOS1 is set to L level because the ceramic oscillation circuit OSC1 is not selected. Accordingly, the output OSCO2 of the CR oscillation circuit CRO1 is supplied as the clock CKO of the MCU1. Since the OSC1 selection bit SOS1 is not set to the H level as in the case of FIG. 5, the power supply voltage Vdd is continuously supplied to the CR oscillation circuit CRO1, and the output OSCO2 is supplied as the clock CKO of the MCU1 to continue the processing of the MCU1. .

このように、本実施例では、セラミック発振回路OSC1の動作を停止してCR発振回路CRO1の出力OSCO2だけを使用することも可能になる。このため、セラミック発振回路OSC1の出力OSCO1が安定する前に必要なMCU1の処理が終了してしまうような処理の量が小さい場合には、セラミック発振回路OSC1を起動せず、CR発振回路CRO1によりクロックCKOを供給してMCU1の処理を終了させ、再びスタンバイ状態とするようなモードが可能となる。この場合、使用しないセラミック発振回路OSC1を起動しないよう制御できるので、MCU1全体としての消費電力を削減できる。   Thus, in this embodiment, it is possible to stop the operation of the ceramic oscillation circuit OSC1 and use only the output OSCO2 of the CR oscillation circuit CRO1. For this reason, when the amount of processing required to complete the processing of MCU1 before the output OSCO1 of the ceramic oscillation circuit OSC1 is stabilized is small, the ceramic oscillation circuit OSC1 is not activated and the CR oscillation circuit CRO1 A mode in which the clock CKO is supplied to end the processing of the MCU 1 and the standby state is set again becomes possible. In this case, the ceramic oscillation circuit OSC1 that is not used can be controlled so as not to be activated, so that the power consumption of the entire MCU1 can be reduced.

図9は、図4に示すCR発振回路CRO1の構成の一例を示す回路図である。言うまでもないが、CR発振回路CRO1の構成は、図9に示す構成に限定されるものではない。図9中、図4と同一信号には同一符号を付し、その説明は省略する。CR発振回路CRO1は、図9に示す如く接続されたナンド回路NA21、インバータ回路INV2,INV3,INV4、容量CT1、抵抗RT1、アンド回路AND4,AND5、カウンタCUNT2及びDフリップフロップ回路DFF2を有する。図9において、Vddは正の電源(例えば+3V)、COUT2はカウンタ回路CUNT2の出力、CDFO2はDフリップフロップ回路DFF2の正の出力、DFOX2はDフリップフロップ回路DFF2の負の出力、CREはCR発振回路CRO1のイネーブル制御信号(図4のアンド回路AND3の出力CSW2と略同じ働きをする信号)、NODE1乃至NODE5はノードを示す。   FIG. 9 is a circuit diagram showing an example of the configuration of the CR oscillation circuit CRO1 shown in FIG. Needless to say, the configuration of the CR oscillation circuit CRO1 is not limited to the configuration shown in FIG. 9, the same signals as those in FIG. 4 are denoted by the same reference numerals, and the description thereof is omitted. The CR oscillation circuit CRO1 includes a NAND circuit NA21, inverter circuits INV2, INV3, and INV4, a capacitor CT1, a resistor RT1, AND circuits AND4 and AND5, a counter CUNT2, and a D flip-flop circuit DFF2 connected as shown in FIG. In FIG. 9, Vdd is a positive power supply (for example, + 3V), COUT2 is an output of the counter circuit CUNT2, CDFO2 is a positive output of the D flip-flop circuit DFF2, DFOX2 is a negative output of the D flip-flop circuit DFF2, and CRE is CR oscillation. An enable control signal of the circuit CRO1 (a signal having substantially the same function as the output CSW2 of the AND circuit AND3 in FIG. 4), NODE1 to NODE5 indicate nodes.

図10は、図9に示すCR発振回路CRO1の動作を説明するタイミングチャートである。具体的には、図10はノードNODE1乃至NODE4における信号波形を示す。イネーブル制御信号CREは、CR発振回路CRO1の動作が停止しているときはLレベルであるものとする。   FIG. 10 is a timing chart for explaining the operation of the CR oscillation circuit CRO1 shown in FIG. Specifically, FIG. 10 shows signal waveforms at the nodes NODE1 to NODE4. The enable control signal CRE is at L level when the operation of the CR oscillation circuit CRO1 is stopped.

イネーブル制御信号CREがLレベルのとき、ナンド回路NA21の出力(NODE1)はLレベルに固定されるので、CR発振回路CRO1は停止状態となる。イネーブル制御信号CREがHレベルになったときのナンド回路NA21、インバータ回路INV2,INV3、抵抗RT1及び容量CT1からなる回路部分の動作を説明する。   When the enable control signal CRE is at L level, the output (NODE1) of the NAND circuit NA21 is fixed at L level, so that the CR oscillation circuit CRO1 is stopped. An operation of the circuit portion including the NAND circuit NA21, the inverter circuits INV2 and INV3, the resistor RT1, and the capacitor CT1 when the enable control signal CRE becomes H level will be described.

図10に示すように、ノードNODE1,NODE2,NODE3における信号波形はCMOS回路の一般的な出力波形である矩形波となる。ノードNODE4における信号波形は、ノードNODE2との容量結合により、ノードNODE2の電位変化の時刻にノードNODE4の電位がノードNODE2と同じ方向に変化し、その後緩やかにノードNODE3の電位により充放電される波形となる。   As shown in FIG. 10, the signal waveforms at the nodes NODE1, NODE2, and NODE3 are rectangular waves that are general output waveforms of the CMOS circuit. The signal waveform at the node NODE4 is a waveform in which the potential of the node NODE4 changes in the same direction as the node NODE2 at the time of the potential change of the node NODE2 due to capacitive coupling with the node NODE2, and then is gradually charged / discharged by the potential of the node NODE3. It becomes.

ノードNODE2において図10に示すような発振波形が得られるので、例えば図9に示すように、インバータ回路INV4を用いることによりノードNODE5において発振波形を得ることができる。カウンタ回路CUNT2、Dフリップフロップ回路DFF2及びアンド回路AND5からなる回路部分は、図4に示すカウンタ回路CUNT1、Dフリップフロップ回路DFF1及びアンド回路AND1からなる回路部分と同様に動作する。ノードNODE5における発振波形のレベルの変化をカウンタ回路CUNT2によりカウントし、規定の回数に達したところで出力COUT2がLレベルからHレベルに変化するものとする。CR発振回路CRO1を起動する前はイネーブル制御信号CREがLレベルになっているので、アンド回路AND5出力はLレベルになっており、カウンタ回路CUNT2はクリアされ、初期化されている。同様に、Dフリップフロップ回路DFF2も初期化されている。ノードNODE5における変化が規定の回数に達して、カウンタ回路CUNT2の出力COUT2がLレベルからHレベルに変化すると、Dフリップフロップ回路DFF2の出力CDFO2がHレベルに変化する。又、Dフリップフロップ回路DFF2の出力DFOX2がLレベルに変化し、カウンタ回路CUNT2はクリアされ、初期化される。Dフリップフロップ回路DFF2の出力CDFO2がHレベルになると、アンド回路AND4の出力にはノードNODE5と同相の信号が現れ、CR発振回路CRO1の出力OSCO2として出力される。   Since an oscillation waveform as shown in FIG. 10 is obtained at the node NODE2, for example, as shown in FIG. 9, an oscillation waveform can be obtained at the node NODE5 by using the inverter circuit INV4. The circuit portion including the counter circuit CUNT2, the D flip-flop circuit DFF2, and the AND circuit AND5 operates in the same manner as the circuit portion including the counter circuit CUNT1, the D flip-flop circuit DFF1, and the AND circuit AND1 shown in FIG. It is assumed that the change in the level of the oscillation waveform at the node NODE5 is counted by the counter circuit CUNT2, and the output COUT2 changes from the L level to the H level when the specified number of times is reached. Since the enable control signal CRE is at L level before the CR oscillation circuit CRO1 is activated, the AND circuit AND5 output is at L level, and the counter circuit CUNT2 is cleared and initialized. Similarly, the D flip-flop circuit DFF2 is also initialized. When the change in the node NODE5 reaches a specified number of times and the output COUT2 of the counter circuit CUNT2 changes from L level to H level, the output CDFO2 of the D flip-flop circuit DFF2 changes to H level. Further, the output DFOX2 of the D flip-flop circuit DFF2 changes to the L level, and the counter circuit CUNT2 is cleared and initialized. When the output CDFO2 of the D flip-flop circuit DFF2 becomes H level, a signal in phase with the node NODE5 appears at the output of the AND circuit AND4, and is output as the output OSCO2 of the CR oscillation circuit CRO1.

図11は、図4に示すスイッチ回路SW3の構成の一例を示す回路図である。言うまでもないが、スイッチ回路SW3の構成は、図11に示す構成に限定されるものではない。図11中、図4と同一部分には同一符号を付し、その説明は省略する。スイッチ回路SW3は、図11に示す如く接続されたインバータ回路INV5,INV6,INV7、ナンド回路NA22乃至NA25、アンド回路AND6及びDフリップフロップ回路DFF3乃至DFF6を有する。図11において、NA22O乃至NA25Oはナンド回路NA22乃至NA25の出力、DFF3O乃至DFF6OはDフリップフロップ回路DFF3乃至DFF6の出力、SELI,SELIXはセレクタ制御信号を示す。   FIG. 11 is a circuit diagram showing an example of the configuration of the switch circuit SW3 shown in FIG. Needless to say, the configuration of the switch circuit SW3 is not limited to the configuration shown in FIG. In FIG. 11, the same parts as those of FIG. The switch circuit SW3 includes inverter circuits INV5, INV6, INV7, NAND circuits NA22 to NA25, an AND circuit AND6, and D flip-flop circuits DFF3 to DFF6 connected as shown in FIG. In FIG. 11, NA22O through NA25O indicate outputs from the NAND circuits NA22 through NA25, DFF3O through DFF6O indicate outputs from the D flip-flop circuits DFF3 through DFF6, and SELI and SELIX indicate selector control signals.

図12は、図11に示すスイッチ回路SW3の動作を説明するタイミングチャートである。図11に示すスイッチ回路SW3は、クロックCKOをCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替える際に、Hレベルの幅(期間)、或いは、Lレベルの幅(期間)が短すぎるパルスがクロックCKOとして出力されない回路構成となっている。ここでは、説明の便宜上、MCU1のスタンバイ状態からの復帰後、発振回路CRO1,OSC1の起動を開始し、出力OSCO2,OSCO1が図12に示す状態にあるものとする。OSC1選択ビットSOS1は最初Lレベルであるものとする。OSC1選択ビットSOS1がLレベルなので、Dフリップフロップ回路DFF3乃至DFF6はクリアされている。Dフリップフロップ回路DFF5がクリアされているので、セレクタ制御信号SELIもLレベルである。   FIG. 12 is a timing chart for explaining the operation of the switch circuit SW3 shown in FIG. The switch circuit SW3 shown in FIG. 11 has an H level width (period) or an L level width (period) when the clock CKO is switched from the output OSCO2 of the CR oscillation circuit CRO1 to the output OSCO1 of the ceramic oscillation circuit OSC1. The circuit configuration is such that a pulse that is too short is not output as the clock CKO. Here, for convenience of explanation, it is assumed that after the MCU 1 returns from the standby state, the oscillation circuits CRO1 and OSC1 are started and the outputs OSCO2 and OSCO1 are in the state shown in FIG. Assume that the OSC1 selection bit SOS1 is initially at the L level. Since the OSC1 selection bit SOS1 is at L level, the D flip-flop circuits DFF3 to DFF6 are cleared. Since the D flip-flop circuit DFF5 is cleared, the selector control signal SELI is also at the L level.

セレクタ制御信号SELIがLレベルなので、ナンド回路NA23の出力NA23OはHレベルに固定されている。又、セレクタ制御信号SELIXがHレベルなので、ナンド回路NA24の出力NA24OはCR発振回路CRO1の出力OSCO2と同相の信号となる。ナンド回路NA22,NA23,NA24はセレクタ回路として機能し、出力NA24OとしてCR発振回路CRO1の出力OSCO2又はセラミック発振回路OSC1の出力OSCO1を選択出力する。図12において、セレクタ制御信号SELIがLレベルのときに、CR発振回路CRO1の出力OSCO2とナンド回路NA24の出力NA24Oが同じ波形になっているのは、このことを表している。   Since the selector control signal SELI is at L level, the output NA23O of the NAND circuit NA23 is fixed at H level. Since the selector control signal SELIX is at the H level, the output NA24O of the NAND circuit NA24 is a signal in phase with the output OSCO2 of the CR oscillation circuit CRO1. The NAND circuits NA22, NA23, NA24 function as selector circuits, and selectively output the output OSCO2 of the CR oscillation circuit CRO1 or the output OSCO1 of the ceramic oscillation circuit OSC1 as the output NA24O. In FIG. 12, when the selector control signal SELI is at the L level, the output OSCO2 of the CR oscillation circuit CRO1 and the output NA24O of the NAND circuit NA24 have the same waveform.

OSC1選択ビットSOS1がLレベルなので、Dフリップフロップ回路DFF4の出力DFF4OはLレベルである。Dフリップフロップ回路DFF4の出力DFF4OがLレベルなので、ナンド回路NA25の出力NA25OはHレベルである。ナンド回路NA25の出力NA25OがHレベルなので、クロックCKOはナンド回路NA24の出力NA24Oと同相の信号となり、CR発振回路CRO1の出力OSCO2がMCU1のクロックCKOとして出力される。又、OSC1選択ビットSOS1がLレベルなので、Dフリップフロップ回路DFF6の出力DFF6OはLレベルである。   Since the OSC1 selection bit SOS1 is L level, the output DFF4O of the D flip-flop circuit DFF4 is L level. Since the output DFF4O of the D flip-flop circuit DFF4 is L level, the output NA25O of the NAND circuit NA25 is H level. Since the output NA25O of the NAND circuit NA25 is at the H level, the clock CKO becomes a signal in phase with the output NA24O of the NAND circuit NA24, and the output OSCO2 of the CR oscillation circuit CRO1 is output as the clock CKO of the MCU1. Since the OSC1 selection bit SOS1 is at L level, the output DFF6O of the D flip-flop circuit DFF6 is at L level.

セラミック発振回路OSC1の出力OSCO1が安定すると、OSC1安定割り込み(IRQOSC)が発生し、割り込みプログラムによりOSC1選択ビットSOS1がHレベルに書き換えられる。図12において、OSC1選択ビットSOS1がLレベルからHレベルに変化しているのは、この割り込みプログラムによるOSC1選択ビットSOS1のLレベルからHレベルへの書き換えを表している。OSC1選択ビットSOS1がHレベルになると、DフリップフロップDFF3のD入力がHレベルになるので、クロックCKOの次の立ち上がり(即ち、出力OSCO2の次の立ち上がり)で、Dフリップフロップ回路DFF3の出力DFF3OがHレベルになる。Dフリップフロップ回路DFF4のクロック入力端子CKには、出力OSCO2をインバータ回路INV6により反転した信号が入力されるので、出力OSCO2の次の立下りでDフリップフロップ回路DFF4の出力DFF4OがHレベルになる。Dフリップフロップ回路DFF4の出力DFF4OがHレベルになると、この時点ではDフリップフロップ回路DFF6の出力DFF6OはLレベルなので、インバータ回路INV7の出力はHレベルである。インバータ回路INV7出力とDフリップフロップ回路DFF4の出力DFF4Oが同時にHレベルになると、ナンド回路NA25の出力NA25OはLレベルになる。   When the output OSCO1 of the ceramic oscillation circuit OSC1 is stabilized, an OSC1 stability interrupt (IRQOSC) is generated, and the OSC1 selection bit SOS1 is rewritten to the H level by the interrupt program. In FIG. 12, the change of the OSC1 selection bit SOS1 from the L level to the H level represents the rewriting of the OSC1 selection bit SOS1 from the L level to the H level by this interrupt program. When the OSC1 selection bit SOS1 becomes H level, the D input of the D flip-flop DFF3 becomes H level, so that the output DFF3O of the D flip-flop circuit DFF3 at the next rising edge of the clock CKO (that is, the next rising edge of the output OSCO2). Becomes H level. Since the signal obtained by inverting the output OSCO2 by the inverter circuit INV6 is input to the clock input terminal CK of the D flip-flop circuit DFF4, the output DFF4O of the D flip-flop circuit DFF4 becomes H level at the next fall of the output OSCO2. . When the output DFF4O of the D flip-flop circuit DFF4 becomes H level, since the output DFF6O of the D flip-flop circuit DFF6 is L level at this time, the output of the inverter circuit INV7 is H level. When the output of the inverter circuit INV7 and the output DFF4O of the D flip-flop circuit DFF4 simultaneously become H level, the output NA25O of the NAND circuit NA25 becomes L level.

Dフリップフロップ回路DFF4の出力DFF4OがHレベルになった後、Dフリップフロップ回路DFF5により出力OSCO2の次の立ち上がりでセレクタ制御信号SELIがHレベルになる。セレクタ制御信号SELIがHレベルになるので、ナンド回路NA22,NA23,NA24で構成されるセレクタ回路は出力OSCO1を選択出力するようになる。図12は、セレクタ制御信号SELIがHレベルになった後、ナンド回路NA24の出力NA24Oにより出力クロックCKOが出力OSCO2から出力OSCO1に切り替えられる場合を示す。   After the output DFF4O of the D flip-flop circuit DFF4 becomes H level, the selector control signal SELI becomes H level at the next rise of the output OSCO2 by the D flip-flop circuit DFF5. Since the selector control signal SELI becomes H level, the selector circuit constituted by the NAND circuits NA22, NA23, NA24 selects and outputs the output OSCO1. FIG. 12 shows a case where the output clock CKO is switched from the output OSCO2 to the output OSCO1 by the output NA24O of the NAND circuit NA24 after the selector control signal SELI becomes H level.

発振回路OSC1,CRO1の出力OSCO1,OSCO2は同期して発振しているわけではないので、切り替えのタイミングによっては、Hレベルの幅又はLレベルの幅が非常に短いパルスがナンド回路NA24の出力NA24Oに現れる可能性がある。そこで、アンド回路AND6等により、この望ましくない短いパルスを除去する。図11では、セレクタ制御信号SELIがLレベルからHレベルに切り替わる時点より前に、ナンド回路NA25の出力NA25OをLレベルにして、セレクタ制御信号SELIが変化した後の出力OSCO1の立ち上がりまで、出力NA25OがLレベルを保つような回路構成が採用されている。これにより、アンド回路AND6回路により、ナンド回路NA25の出力NA25OがLレベルの期間、クロックCKOをLレベルに固定している。   Since the outputs OSCO1 and OSCO2 of the oscillation circuits OSC1 and CRO1 do not oscillate synchronously, depending on the switching timing, a pulse having a very short H level width or L level width may be output NA24O of the NAND circuit NA24. May appear in Therefore, this undesirable short pulse is removed by an AND circuit AND6 or the like. In FIG. 11, before the selector control signal SELI switches from the L level to the H level, the output NA25O of the NAND circuit NA25 is set to the L level and the output NA25O is output until the output OSCO1 rises after the selector control signal SELI changes. A circuit configuration is employed in which the L level is maintained. Thus, the clock CKO is fixed at the L level during the period when the output NA25O of the NAND circuit NA25 is at the L level by the AND circuit AND6 circuit.

図12において破線で示すように、セレクタ制御信号SELIがHレベルに変化すると、Dフリップフロップ回路DFF6のD入力もHレベルになるので、次の出力OSCO1の立ち上がりで、Dフリップフロップ回路DFF6の出力DFF6OがHレベルになる。インバータ回路INV7により、ナンド回路NA25にはLレベルの信号が供給されるので、ナンド回路NA25の出力NA25OはLレベルからHレベルに戻る。つまり、切り替え前の出力OSCO2の立下りから、切り替え後の出力OSCO1の立ち上がりまでの期間、ナンド回路NA25の出力NA25OはLレベルとなり、クロックCKOをこの期間だけLレベルに固定する。この結果、図12に示すように、出力OSCO2の波形と出力OSCO1の波形の切り替わり時に多少長いLレベル期間が挿入された波形が得られる。   As indicated by a broken line in FIG. 12, when the selector control signal SELI changes to H level, the D input of the D flip-flop circuit DFF6 also becomes H level, so that the output of the D flip-flop circuit DFF6 is output at the next rise of the output OSCO1. DFF6O becomes H level. Since the inverter circuit INV7 supplies an L level signal to the NAND circuit NA25, the output NA25O of the NAND circuit NA25 returns from the L level to the H level. That is, during the period from the fall of the output OSCO2 before switching to the rise of the output OSCO1 after switching, the output NA25O of the NAND circuit NA25 becomes L level, and the clock CKO is fixed to L level only during this period. As a result, as shown in FIG. 12, a waveform in which a slightly longer L level period is inserted when the waveform of the output OSCO2 and the waveform of the output OSCO1 are switched is obtained.

図5乃至図8では、MCU1のプログラムの設計者が明示的に、CR発振回路CRO1だけ、或いは、CR発振回路CRO1とセラミック発振回路OSC1の両方を使用し、それらを切り替えて使用する場合の処理について説明した。   5 to 8, a process in which the MCU 1 program designer explicitly uses only the CR oscillation circuit CRO1 or both the CR oscillation circuit CRO1 and the ceramic oscillation circuit OSC1 and uses them by switching them. Explained.

タイマ又はパルス発生器の時間精度が必要とされるような場合、或いは、通信が予定されていてクロックの周波数精度が必要なことが予めかっている場合には、図5及び図6と共に説明したような処理で、クロックCKOをCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替えれば良い。あるプログラムの一連の処理に発振周波数精度が必要ないことが予めわかっている場合には、図7及び図8と共に説明したような処理で、CR発振回路CRO1だけを起動してMCU1のクロックCKOを出力すれば良い。   When the time accuracy of the timer or the pulse generator is required, or when the communication is scheduled and the frequency accuracy of the clock is required in advance, as described with reference to FIGS. In this process, the clock CKO may be switched from the output OSCO2 of the CR oscillation circuit CRO1 to the output OSCO1 of the ceramic oscillation circuit OSC1. When it is known in advance that the oscillation frequency accuracy is not necessary for a series of processing of a program, only the CR oscillation circuit CRO1 is activated and the clock CKO of MCU1 is set by the processing described with reference to FIGS. Just output.

ところが、発振周波数精度が必要ない処理を進めている最中に、外部から例えば通信を要求された場合であってもこれに対処できるようにMPUを構成しておくことが望ましい場合がある。つまり、発振周波数精度を必要としない処理を進めて、処理が終了すればCR発振回路の動作を停止し、スタンバイ状態に戻ることを想定してプログラムが構成されていたとしても、外部から非同期に例えば通信を要求される可能性があれば、通信を要求された時点でセラミック発振回路を起動できるようにMPUを構成しておくことが望ましい場合がある。   However, it may be desirable to configure the MPU so that it can cope with, for example, a case where communication is requested from the outside while processing that does not require the oscillation frequency accuracy is in progress. In other words, even if the program is configured assuming that the processing that does not require the oscillation frequency accuracy is advanced and the operation of the CR oscillation circuit is stopped and the operation returns to the standby state when the processing is completed, the program is configured asynchronously from the outside. For example, if there is a possibility that communication is required, it may be desirable to configure the MPU so that the ceramic oscillation circuit can be activated when communication is requested.

次に、発振周波数精度の必要ない処理をMCU1で進めて再びスタンバイ状態に戻ろうとしている途中で、外部の何らかの装置又はデバイスから非同期に例えば通信を要求された場合の処理を、図13と共に説明する。図13は、発振回路110の処理を説明するフローチャートであり、同図(a)はメインプログラムの処理、同図(b)は通信要求受け付け割り込みプログラムの処理、同図(c)はOSC1安定割り込みプログラムの処理を示す。このように、外部から非同期で通信が要求される可能性がある場合には、外部からの通信要求により割り込み信号を発生することで、図13のような処理を進めることが可能となる。   Next, a process when, for example, communication is requested asynchronously from some external device or device while the process that does not require the oscillation frequency accuracy is advanced by the MCU 1 to return to the standby state will be described with reference to FIG. To do. FIG. 13 is a flowchart for explaining the processing of the oscillation circuit 110. FIG. 13A shows the main program processing, FIG. 13B shows the communication request acceptance interrupt program processing, and FIG. 13C shows the OSC1 stable interrupt. Indicates the processing of the program. As described above, when there is a possibility that communication is requested asynchronously from the outside, the processing shown in FIG. 13 can be advanced by generating an interrupt signal in response to a communication request from the outside.

図13(a)では、MCU1のスタンバイ状態の解除後、ステップS31ではCR発振回路CRO1だけを起動し、セラミック発振回路OSC1の動作は停止する。ステップS32では発振周波数精度の必要ない処理を進め、処理が終了すると、ステップS33ではCR発振回路CRO1の動作を停止してMCU1を再びスタンバイ状態へ戻す。   In FIG. 13A, after the MCU 1 is released from the standby state, in step S31, only the CR oscillation circuit CRO1 is activated and the operation of the ceramic oscillation circuit OSC1 is stopped. In step S32, a process that does not require the oscillation frequency accuracy is performed. When the process is completed, the operation of the CR oscillation circuit CRO1 is stopped and the MCU1 is returned to the standby state again in step S33.

外部から通信を要求された場合には、通信要求により割り込み信号を発生し、図13(b)の通信要求受け付け割り込みプログラムに処理が移る。ステップS41では通信要求に従って、セラミック発振回路OSC1を起動する。具体的には、OSC1起動抑止ビットIHOS1をLレベルからHレベルに書き換えて、セラミック発振回路OSC1を起動する。セラミック発振回路OSC1を起動した後、ステップS42では元のメインプログラムに処理を戻し、残りの処理を実行する。このとき、メインプログラムの処理が終了しても、通信要求を処理していないので、MCU1がスタンバイ状態に戻らないように待ち状態となるようにプログラムを構成しておく。   When communication is requested from the outside, an interrupt signal is generated by the communication request, and the process proceeds to the communication request acceptance interrupt program of FIG. In step S41, the ceramic oscillation circuit OSC1 is activated according to the communication request. Specifically, the OSC1 activation inhibition bit IHOS1 is rewritten from L level to H level to activate the ceramic oscillation circuit OSC1. After starting the ceramic oscillation circuit OSC1, the process returns to the original main program in step S42, and the remaining processes are executed. At this time, since the communication request is not processed even when the processing of the main program is completed, the program is configured so that the MCU 1 enters a waiting state so as not to return to the standby state.

セラミック発振回路OSC1を起動した後、その出力OSCO1が安定するとOSC1安定割り込みIRQOSCが発生されるので、図13(c)のOSC1安定割り込みプログラムの処理で、ステップS51では例えばMCU1のクロックCKOをCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替え、ステップS52では通信要求も処理する。ステップS53ではメインプログラムに処理を戻す。   Since the OSC1 stable interrupt IRQOSC is generated when the output OSCO1 is stabilized after the ceramic oscillation circuit OSC1 is started, the OSC1 stable interrupt program shown in FIG. 13C performs CR oscillation on the clock CKO of the MCU1, for example, in step S51. The output OSCO2 of the circuit CRO1 is switched to the output OSCO1 of the ceramic oscillation circuit OSC1, and a communication request is processed in step S52. In step S53, the process is returned to the main program.

プログラムの構成の詳細は、各種の変形が可能であり、実際のハードウェア構成に適した構成を採用する必要がある。OSC1安定割り込みでは、クロックCKOをCR発振回路CRO1の出力OSCO2からセラミック発振回路OSC1の出力OSCO1に切り替え、メインプログラム中で通信を処理しても良い。この場合には、発振周波数精度が必要ない処理が終了した時点で、通信要求を処理したか否かを確認することになる。或いは、通信要求を受け付けて、まだ通信処理が終了していない時点でセラミック発振回路OSC1の出力OSCO1が安定したことを検出した場合、専用の通信実行のための割り込み信号を発生するようにして、その割り込み信号に対応したプログラムを記述しても良い。   The details of the program configuration can be variously modified, and it is necessary to adopt a configuration suitable for the actual hardware configuration. In the OSC1 stable interrupt, the clock CKO may be switched from the output OSCO2 of the CR oscillation circuit CRO1 to the output OSCO1 of the ceramic oscillation circuit OSC1, and communication may be processed in the main program. In this case, when the processing that does not require the oscillation frequency accuracy is completed, it is confirmed whether or not the communication request has been processed. Alternatively, when it is detected that the output OSCO1 of the ceramic oscillation circuit OSC1 is stable at the time when the communication request is received and the communication processing has not been completed, an interrupt signal for executing dedicated communication is generated. A program corresponding to the interrupt signal may be described.

図13と共に説明したような状況も考慮しておくことで、図4の発振回路110を使用して、セラミック発振回路OSC1とCR発振回路CRO1を、プログラムの状況で使い分けることができるようになり、セラミック発振回路OSC1の起動回数を削減することにより低消費電力化が可能となる。   Considering the situation described in conjunction with FIG. 13, it becomes possible to use the ceramic oscillation circuit OSC1 and the CR oscillation circuit CRO1 properly in the program situation by using the oscillation circuit 110 of FIG. The power consumption can be reduced by reducing the number of activations of the ceramic oscillation circuit OSC1.

以上説明したように、本実施例では、発振回路110を切り替え制御するための制御レジスタ部13に、発振回路110から設定可能でありセラミック発振回路OSC1の出力が安定したことを示すOSC1安定フラグOSFをMCU1のソフトウェアから参照可能に設けることで、ソフトウェアによりセラミック発振回路OSC1の出力が安定したか否かを判定することができるようになる。又、制御レジスタ部13に、発振回路110から設定可能であり割り込み信号を発生するためのOSC1割り込みフラグOSIFをMCU1のソフトウェアから参照可能に設けると共に、MCU1のソフトウェアから設定可能でありOSC1割り込みフラグOSIFがセットされた場合に割り込みを許可するためのOSC1安定割り込み許可ビットOSFIE及びセラミック発振回路OS1の出力が安定した場合に発生されるOSC安定割り込み信号IRQOSCを設けることで、セラミック発振回路OSC1の出力が安定した場合にOSC1安定割り込み信号IRQOSCを発生することができる。   As described above, in this embodiment, the control register unit 13 for switching and controlling the oscillation circuit 110 can be set from the oscillation circuit 110 and the OSC1 stability flag OSF indicating that the output of the ceramic oscillation circuit OSC1 is stabilized. Can be referred to from the software of the MCU 1, it becomes possible to determine whether or not the output of the ceramic oscillation circuit OSC 1 is stabilized by the software. Further, the control register unit 13 is provided with an OSC1 interrupt flag OSIF that can be set from the oscillation circuit 110 and can be referred to from the MCU1 software, and can be set from the MCU1 software, and the OSC1 interrupt flag OSIF. By setting the OSC1 stable interrupt permission bit OSFIE for allowing an interrupt when the signal is set and the OSC stable interrupt signal IRQOSC generated when the output of the ceramic oscillation circuit OS1 is stabilized, the output of the ceramic oscillation circuit OSC1 is set. When stable, the OSC1 stable interrupt signal IRQOSC can be generated.

更に、制御レジスタ部13に、MCU1のソフトウェアから設定可能であり明示的に発振回路110をCR発振回路CRO1からセラミック発振回路OSC1に切り替えるOSC1選択ビットSOS1を設け、割り込みプログラム中にこのOSC1選択ビットSOS1を設定することで、ソフトウエアでMCU1のクロックCKOをCR発振回路CRO1の出力からセラミック発振回路OSC1の出力に切り替えることができる。又、このOSC1選択ビットSOS1を設けることで、クロックCKOをCR発振回路CRO1の出力からセラミック発振回路OSC1の出力に切り替えた後、CR発振回路CRO1の動作を停止することもできる。   Further, the control register unit 13 is provided with an OSC1 selection bit SOS1 that can be set from the MCU1 software and explicitly switches the oscillation circuit 110 from the CR oscillation circuit CRO1 to the ceramic oscillation circuit OSC1, and this OSC1 selection bit SOS1 is provided in the interrupt program. By setting, the clock CKO of MCU1 can be switched from the output of CR oscillation circuit CRO1 to the output of ceramic oscillation circuit OSC1 by software. Further, by providing the OSC1 selection bit SOS1, the operation of the CR oscillation circuit CRO1 can be stopped after the clock CKO is switched from the output of the CR oscillation circuit CRO1 to the output of the ceramic oscillation circuit OSC1.

制御レジスタ部13に、MCU1のソフトウェアから設定可能でありセラミック発振回路OSC1の起動を抑止するためのOSC1起動抑止ビットIHOS1を設けることで、セラミック発振回路OSC1の出力を使用しない場合には、セラミック発振回路OSC1の起動を抑止することができる。   If the output of the ceramic oscillation circuit OSC1 is not used by providing the control register unit 13 with the OSC1 activation inhibition bit IHOS1 that can be set from the software of the MCU1 and inhibits the activation of the ceramic oscillation circuit OSC1, the ceramic oscillation circuit The activation of the circuit OSC1 can be suppressed.

上記の如き制御レジスタ部13を設けることにより、CR発振回路CRO1の出力OSCO2とセラミック発振回路OSC1の出力OSCO1を切り替えて使用するモードと、CR発振回路CRO1の出力OSCO2だけを使用し、セラミック発振回路OSC1を起動しないモードを選択することが可能となり、CR発振回路CRO1しか使用しない場合には、セラミック発振回路OSC1を起動しないことでMCU1全体の消費電力を削減することが可能となる。   By providing the control register unit 13 as described above, a mode in which the output OSCO2 of the CR oscillation circuit CRO1 and the output OSCO1 of the ceramic oscillation circuit OSC1 are switched and used, and only the output OSCO2 of the CR oscillation circuit CRO1 is used. It is possible to select a mode in which the OSC 1 is not activated. When only the CR oscillation circuit CRO1 is used, it is possible to reduce the power consumption of the entire MCU 1 by not activating the ceramic oscillation circuit OSC1.

尚、本発明は、以下に付記する発明をも包含するものである。
(付記1)
第1の発振回路と、
該第1の発振回路より長い発振安定時間を有する第2の発振回路と、
該第2の発振回路の発振安定時間の経過を示す安定信号を出力する信号生成回路と、
選択信号に基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路と、
抑止信号に基づいて該第2の発振回路の起動を抑止する抑止回路とを備え、
該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられるモードと、
該第1の発振回路が起動されて該抑止回路により該第2の発振回路が起動されず該スイッチ回路により該第1の発振回路の出力のみが選択出力されるモードと
を有することを特徴とする発振回路。
(付記2)
該信号生成回路は、該第1の発振回路の出力をカウントして該安定信号を生成することを特徴とする付記1記載の発振回路。
(付記3)
該第1の発振回路はCR発振回路からなり、該第2の発振回路は水晶発振回路又はセラミック発振回路からなることを特徴とする付記1又は2記載の発振回路。
(付記4)
該安定信号が該信号生成回路からMCUのソフトウェアにより参照可能に設定されると共に、該ソフトウェアにより該選択信号及び該抑止信号が設定される制御レジスタ部を更に備えたことを特徴とする付記1乃至3のいずれか1項記載の発振回路。
(付記5)
第1の発振回路と、
該第1の発振回路より長い発振安定時間を有する第2の発振回路と、
外部からも情報を設定可能であると共に、外部より設定されている情報を参照可能な制御レジスタ部と、
該第2の発振回路の発振安定時間の経過を示す安定フラグを出力して該制御レジスタ部に設定する信号生成回路と、
該制御レジスタ部に設定されている選択ビットに基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路とを備え、
該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられる第1のモードを有することを特徴とする発振回路。
(付記6)
該制御レジスタ部に設定されている抑止信号に基づいて該第2の発振回路の起動を抑止する抑止回路を更に備え、
該第1の発振回路が起動されて該抑止回路により該第2の発振回路が起動されず該スイッチ回路により該第1の発振回路の出力のみが選択出力される第2のモードを有することを特徴とする付記5記載の発振回路。
(付記7)
該制御レジスタ部は、該外部に対する割り込み信号を発生するための割り込みフラグが該信号生成回路から設定されると共に、該割り込みフラグが設定された場合に割り込みを許可するためのビットが該外部から設定され、該第2の発振回路の発振安定時間の経過後に割り込み信号を発生することを特徴とする付記6記載の発振回路。
(付記8)
クロック生成回路と、制御レジスタ部と、CPUを備えた半導体装置であって、
該クロック生成回路は第1の発振回路と、該第1の発振回路より長い発振安定時間を有する第2の発振回路と、該CPUのソフトウェアからも情報を設定可能であると共に該ソフトウェアより設定されている情報を参照可能な制御レジスタ部と、該第2の発振回路の発振安定時間の経過を示す安定フラグを出力して該制御レジスタ部に設定する信号生成回路と、該制御レジスタ部に設定されている選択ビットに基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路とを備え、
該半導体装置の電源投入後、リセット後又はスタンバイ状態から動作状態への復帰後に、該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられる第1のモードを有することを特徴とする半導体装置。
(付記9)
該クロック生成回路は、該制御レジスタ部に設定されている抑止信号に基づいて該第2の発振回路の起動を抑止する抑止回路を更に備え、
該半導体装置は、該第1の発振回路が起動されて該抑止回路により該第2の発振回路が起動されず該スイッチ回路により該第1の発振回路の出力のみが選択出力される第2のモードを有することを特徴とする付記8記載の半導体装置。
(付記10)
該制御レジスタ部は、該ソフトウェアに対する割り込み信号を発生するための割り込みフラグが該信号生成回路から設定されると共に、該割り込みフラグが設定された場合に該ソフトウェアへの割り込みを許可するためのビットが該ソフトウェアから設定され、該第2の発振回路の発信安定時間の経過後に割り込み信号を発生することを特徴とする付記9記載の半導体装置。
(付記11)
該スイッチ回路の出力は、クロックとして該CPUに供給されることを特徴とする付記8乃至10のいずれか1項記載の半導体装置。
(付記12)
該制御レジスタ部は、該クロック生成回路の一部を構成することを特徴とする付記11記載の半導体装置。
In addition, this invention also includes the invention attached to the following.
(Appendix 1)
A first oscillation circuit;
A second oscillation circuit having an oscillation stabilization time longer than that of the first oscillation circuit;
A signal generation circuit that outputs a stability signal indicating the lapse of the oscillation stabilization time of the second oscillation circuit;
A switch circuit that selectively outputs one of the outputs of the first and second oscillation circuits based on a selection signal;
A suppression circuit that suppresses activation of the second oscillation circuit based on a suppression signal;
A mode in which the first and second oscillating circuits are simultaneously activated and the switch circuit selects and outputs the output of the first oscillating circuit and then is switched to the output of the second oscillating circuit;
A mode in which the first oscillation circuit is activated, the second oscillation circuit is not activated by the suppression circuit, and only the output of the first oscillation circuit is selectively output by the switch circuit. Oscillator circuit to perform.
(Appendix 2)
The oscillation circuit according to appendix 1, wherein the signal generation circuit counts the output of the first oscillation circuit to generate the stable signal.
(Appendix 3)
The oscillation circuit according to appendix 1 or 2, wherein the first oscillation circuit comprises a CR oscillation circuit, and the second oscillation circuit comprises a crystal oscillation circuit or a ceramic oscillation circuit.
(Appendix 4)
The stability signal is set so that it can be referred to by the software of the MCU from the signal generation circuit, and further includes a control register unit in which the selection signal and the suppression signal are set by the software 4. The oscillation circuit according to any one of 3.
(Appendix 5)
A first oscillation circuit;
A second oscillation circuit having an oscillation stabilization time longer than that of the first oscillation circuit;
A control register unit that can set information from outside and can refer to information set from outside,
A signal generation circuit that outputs a stability flag indicating the lapse of the oscillation stabilization time of the second oscillation circuit and sets it in the control register unit;
A switch circuit that selectively outputs one of the outputs of the first and second oscillation circuits based on a selection bit set in the control register unit;
A first mode in which the first and second oscillating circuits are activated simultaneously and the switch circuit selects and outputs the output of the first oscillating circuit and then is switched to the output of the second oscillating circuit; An oscillation circuit characterized by.
(Appendix 6)
A suppression circuit that suppresses activation of the second oscillation circuit based on a suppression signal set in the control register unit;
A second mode in which the first oscillation circuit is activated, the second oscillation circuit is not activated by the suppression circuit, and only the output of the first oscillation circuit is selectively output by the switch circuit; The oscillation circuit according to appendix 5, which is characterized.
(Appendix 7)
The control register unit sets an interrupt flag for generating an interrupt signal to the outside from the signal generation circuit, and sets a bit for permitting an interrupt when the interrupt flag is set from the outside. The oscillation circuit according to appendix 6, wherein an interrupt signal is generated after the oscillation stabilization time of the second oscillation circuit has elapsed.
(Appendix 8)
A semiconductor device including a clock generation circuit, a control register unit, and a CPU,
The clock generation circuit can set information from the first oscillation circuit, the second oscillation circuit having an oscillation stabilization time longer than that of the first oscillation circuit, and software of the CPU and is set by the software. A control register unit that can refer to the information stored therein, a signal generation circuit that outputs a stability flag indicating the lapse of the oscillation stabilization time of the second oscillation circuit and sets the control register unit, and a setting in the control register unit A switching circuit that selectively outputs one of the outputs of the first and second oscillation circuits based on the selected bit.
After powering on the semiconductor device, after resetting or returning from the standby state to the operating state, the first and second oscillation circuits are activated simultaneously, and the output of the first oscillation circuit is selected and output by the switch circuit. A semiconductor device having a first mode that is switched to the output of the second oscillation circuit after being turned on.
(Appendix 9)
The clock generation circuit further includes a suppression circuit that suppresses activation of the second oscillation circuit based on a suppression signal set in the control register unit,
In the semiconductor device, the first oscillation circuit is activated, the second oscillation circuit is not activated by the suppression circuit, and only the output of the first oscillation circuit is selectively output by the switch circuit. 9. The semiconductor device according to appendix 8, which has a mode.
(Appendix 10)
The control register unit has an interrupt flag for generating an interrupt signal for the software set from the signal generation circuit, and a bit for permitting an interrupt to the software when the interrupt flag is set. The semiconductor device according to appendix 9, wherein the semiconductor device is set by the software and generates an interrupt signal after an elapse of a stable oscillation time of the second oscillation circuit.
(Appendix 11)
11. The semiconductor device according to claim 8, wherein an output of the switch circuit is supplied to the CPU as a clock.
(Appendix 12)
12. The semiconductor device according to appendix 11, wherein the control register unit constitutes a part of the clock generation circuit.

以上、本発明を実施例により説明したが、本発明は上記実施例に限定されるものではなく、本発明の範囲内で種々の変形及び改良が可能であることは言うまでもない。   While the present invention has been described with reference to the embodiments, it is needless to say that the present invention is not limited to the above-described embodiments, and various modifications and improvements can be made within the scope of the present invention.

従来のCR発振回路とセラミック発振回路を組み合わせた発振回路の例である。It is an example of the oscillation circuit which combined the conventional CR oscillation circuit and the ceramic oscillation circuit. 図1の回路の動作波形例である。It is an example of an operation waveform of the circuit of FIG. 本発明の一実施例を示すブロック図である。It is a block diagram which shows one Example of this invention. 発振回路の構成を制御レジスタ部と共に示す回路図である。It is a circuit diagram which shows the structure of an oscillation circuit with a control register part. 発振回路の動作を説明するタイミングチャートである。3 is a timing chart for explaining the operation of the oscillation circuit. 発振回路の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of an oscillation circuit. 発振回路の動作を説明するフローチャートである。It is a flowchart explaining operation | movement of an oscillation circuit. 発振回路の動作を説明するタイミングチャートである。3 is a timing chart for explaining the operation of the oscillation circuit. CR発振回路の構成の一例を示す回路図である。It is a circuit diagram which shows an example of a structure of CR oscillation circuit. CR発振回路の動作を説明するタイミングチャートである。6 is a timing chart for explaining the operation of the CR oscillation circuit. スイッチ回路の構成の一例を示す回路図である。It is a circuit diagram which shows an example of a structure of a switch circuit. スイッチ回路の動作を説明するタイミングチャートである。6 is a timing chart for explaining the operation of the switch circuit. 発振回路の処理を説明するフローチャートである。It is a flowchart explaining the process of an oscillation circuit.

符号の説明Explanation of symbols

1 MCU
11 クロック生成回路
12 CPU
13 レジスタ部
110 発振回路
CRO1 CR発振回路
OSC1 セラミック発振回路
1 MCU
11 Clock generation circuit 12 CPU
13 register unit 110 oscillation circuit CRO1 CR oscillation circuit OSC1 ceramic oscillation circuit

Claims (5)

第1の発振回路と、
該第1の発振回路より長い発振安定時間を有する第2の発振回路と、
該第2の発振回路の発振安定時間の経過を示す安定信号を出力する信号生成回路と、
選択信号に基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路と、
抑止信号に基づいて該第2の発振回路の起動を抑止する抑止回路とを備え、
該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられるモードと、
該第1の発振回路が起動されて該抑止回路により該第2の発振回路が起動されず該スイッチ回路により該第1の発振回路の出力のみが選択出力されるモードと
を有することを特徴とする発振回路。
A first oscillation circuit;
A second oscillation circuit having an oscillation stabilization time longer than that of the first oscillation circuit;
A signal generation circuit that outputs a stability signal indicating the lapse of the oscillation stabilization time of the second oscillation circuit;
A switch circuit that selectively outputs one of the outputs of the first and second oscillation circuits based on a selection signal;
A suppression circuit that suppresses activation of the second oscillation circuit based on a suppression signal;
A mode in which the first and second oscillating circuits are simultaneously activated and the switch circuit selects and outputs the output of the first oscillating circuit and then is switched to the output of the second oscillating circuit;
A mode in which the first oscillation circuit is activated, the second oscillation circuit is not activated by the suppression circuit, and only the output of the first oscillation circuit is selectively output by the switch circuit. Oscillator circuit to perform.
第1の発振回路と、
該第1の発振回路より長い発振安定時間を有する第2の発振回路と、
外部からも情報を設定可能であると共に、外部より設定されている情報を参照可能な制御レジスタ部と、
該第2の発振回路の発振安定時間の経過を示す安定フラグを出力して該制御レジスタ部に設定する信号生成回路と、
該制御レジスタ部に設定されている選択ビットに基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路とを備え、
該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられる第1のモードを有することを特徴とする発振回路。
A first oscillation circuit;
A second oscillation circuit having an oscillation stabilization time longer than that of the first oscillation circuit;
A control register unit that can set information from outside and can refer to information set from outside,
A signal generation circuit that outputs a stability flag indicating the lapse of the oscillation stabilization time of the second oscillation circuit and sets it in the control register unit;
A switch circuit that selectively outputs one of the outputs of the first and second oscillation circuits based on a selection bit set in the control register unit;
A first mode in which the first and second oscillating circuits are activated simultaneously and the switch circuit selects and outputs the output of the first oscillating circuit and then is switched to the output of the second oscillating circuit; An oscillation circuit characterized by.
該制御レジスタ部に設定されている抑止信号に基づいて該第2の発振回路の起動を抑止する抑止回路を更に備え、
該第1の発振回路が起動されて該抑止回路により該第2の発振回路が起動されず該スイッチ回路により該第1の発振回路の出力のみが選択出力される第2のモードを有することを特徴とする請求項2記載の発振回路。
A suppression circuit that suppresses activation of the second oscillation circuit based on a suppression signal set in the control register unit;
A second mode in which the first oscillation circuit is activated, the second oscillation circuit is not activated by the suppression circuit, and only the output of the first oscillation circuit is selectively output by the switch circuit; The oscillation circuit according to claim 2.
該制御レジスタ部は、該外部に対する割り込み信号を発生するための割り込みフラグが該信号生成回路から設定されると共に、該割り込みフラグが設定された場合に割り込みを許可するためのビットが該外部から設定され、該第2の発振回路の発振安定時間の経過後に割り込み信号を発生することを特徴とする請求項3記載の発振回路。   The control register unit sets an interrupt flag for generating an interrupt signal to the outside from the signal generation circuit, and sets a bit for permitting an interrupt when the interrupt flag is set from the outside. 4. The oscillation circuit according to claim 3, wherein an interrupt signal is generated after the oscillation stabilization time of the second oscillation circuit has elapsed. クロック生成回路と、制御レジスタ部と、CPUを備えた半導体装置であって、
該クロック生成回路は第1の発振回路と、該第1の発振回路より長い発振安定時間を有する第2の発振回路と、該CPUのソフトウェアからも情報を設定可能であると共に該ソフトウェアより設定されている情報を参照可能な制御レジスタ部と、該第2の発振回路の発振安定時間の経過を示す安定フラグを出力して該制御レジスタ部に設定する信号生成回路と、該制御レジスタ部に設定されている選択ビットに基づいて該第1及び第2の発振回路の出力の一方を選択出力するスイッチ回路とを備え、
該半導体装置の電源投入後、リセット後又はスタンバイ状態から動作状態への復帰後に、該第1及び第2の発振回路が同時に起動されて該スイッチ回路により該第1の発振回路の出力が選択出力された後に該第2の発振回路の出力に切り替えられる第1のモードを有することを特徴とする半導体装置。
A semiconductor device including a clock generation circuit, a control register unit, and a CPU,
The clock generation circuit can set information from the first oscillation circuit, the second oscillation circuit having an oscillation stabilization time longer than that of the first oscillation circuit, and software of the CPU and is set by the software. A control register unit that can refer to the information stored therein, a signal generation circuit that outputs a stability flag indicating the lapse of the oscillation stabilization time of the second oscillation circuit and sets the control register unit, and a setting in the control register unit A switching circuit that selectively outputs one of the outputs of the first and second oscillation circuits based on the selected bit.
After powering on the semiconductor device, after resetting or returning from the standby state to the operating state, the first and second oscillation circuits are activated simultaneously, and the output of the first oscillation circuit is selected and output by the switch circuit. A semiconductor device having a first mode that is switched to the output of the second oscillation circuit after being turned on.
JP2007069345A 2007-03-16 2007-03-16 Oscillation circuit and semiconductor device Expired - Fee Related JP5045167B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007069345A JP5045167B2 (en) 2007-03-16 2007-03-16 Oscillation circuit and semiconductor device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007069345A JP5045167B2 (en) 2007-03-16 2007-03-16 Oscillation circuit and semiconductor device

Publications (2)

Publication Number Publication Date
JP2008234046A true JP2008234046A (en) 2008-10-02
JP5045167B2 JP5045167B2 (en) 2012-10-10

Family

ID=39906785

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007069345A Expired - Fee Related JP5045167B2 (en) 2007-03-16 2007-03-16 Oscillation circuit and semiconductor device

Country Status (1)

Country Link
JP (1) JP5045167B2 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011223470A (en) * 2010-04-13 2011-11-04 Seiko Epson Corp Mems device and electronic device
US8207751B2 (en) 2009-04-16 2012-06-26 Kabushiki Kaisha Toshiba Receiver which receives video information
JP2013109559A (en) * 2011-11-21 2013-06-06 Toyota Motor Corp Information processor and data return method
JP2015092372A (en) * 2014-12-15 2015-05-14 株式会社東芝 Memory controller, semiconductor device, system board, and information processing device
JP2020071604A (en) * 2018-10-30 2020-05-07 株式会社日立製作所 Clock generation circuit, semiconductor integrated circuit, and device including semiconductor integrated circuit

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0511877A (en) * 1991-07-04 1993-01-22 Nec Corp Microcomputer
JPH0772951A (en) * 1993-09-03 1995-03-17 Mitsubishi Electric Corp Oscillation detecting circuit, oscillation attenuation detecting circuit and oscillation control circuit
JP2002023884A (en) * 2000-07-12 2002-01-25 Toshiba Corp Lsi having clock frequency switching function, computer system and clock frequency switching method
JP2002123330A (en) * 2000-08-31 2002-04-26 Samsung Electronics Co Ltd Processor clock generating circuit and clock generating method
JP2002314336A (en) * 2001-04-13 2002-10-25 Matsushita Electric Ind Co Ltd Oscillation circuit
JP2006279824A (en) * 2005-03-30 2006-10-12 Matsushita Electric Ind Co Ltd Semiconductor integrated device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0511877A (en) * 1991-07-04 1993-01-22 Nec Corp Microcomputer
JPH0772951A (en) * 1993-09-03 1995-03-17 Mitsubishi Electric Corp Oscillation detecting circuit, oscillation attenuation detecting circuit and oscillation control circuit
JP2002023884A (en) * 2000-07-12 2002-01-25 Toshiba Corp Lsi having clock frequency switching function, computer system and clock frequency switching method
JP2002123330A (en) * 2000-08-31 2002-04-26 Samsung Electronics Co Ltd Processor clock generating circuit and clock generating method
JP2002314336A (en) * 2001-04-13 2002-10-25 Matsushita Electric Ind Co Ltd Oscillation circuit
JP2006279824A (en) * 2005-03-30 2006-10-12 Matsushita Electric Ind Co Ltd Semiconductor integrated device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8207751B2 (en) 2009-04-16 2012-06-26 Kabushiki Kaisha Toshiba Receiver which receives video information
JP2011223470A (en) * 2010-04-13 2011-11-04 Seiko Epson Corp Mems device and electronic device
JP2013109559A (en) * 2011-11-21 2013-06-06 Toyota Motor Corp Information processor and data return method
JP2015092372A (en) * 2014-12-15 2015-05-14 株式会社東芝 Memory controller, semiconductor device, system board, and information processing device
JP2020071604A (en) * 2018-10-30 2020-05-07 株式会社日立製作所 Clock generation circuit, semiconductor integrated circuit, and device including semiconductor integrated circuit
JP7173833B2 (en) 2018-10-30 2022-11-16 株式会社日立製作所 Semiconductor integrated circuits and devices equipped with the semiconductor integrated circuits

Also Published As

Publication number Publication date
JP5045167B2 (en) 2012-10-10

Similar Documents

Publication Publication Date Title
JP4750564B2 (en) Reset signal generation circuit
JP4535170B2 (en) Microcomputer system
JP5045167B2 (en) Oscillation circuit and semiconductor device
KR100340361B1 (en) A detector of an oscillation stopping and an apparatus for executing a treatment after the detection of an oscillation stopping
JP2011199481A (en) Clock system
JP4701898B2 (en) External signal detection circuit and real-time clock
JP2003234947A (en) Control unit, electronic device and camera
JP2003316469A (en) Clock control device and method therefor
JPH08166834A (en) Clock generating circuit and microcomputer
JP5241450B2 (en) Semiconductor device and abnormality detection method thereof
JP2006285823A (en) Semiconductor integrated circuit
TWI638517B (en) Mitigation of long wake-up delay of a crystal oscillator
JP4328319B2 (en) Clock supply circuit
JP5513359B2 (en) Semiconductor device and control system for automobile
JP6585977B2 (en) Semiconductor device and oscillation circuit control method
US6496078B1 (en) Activating on-chip oscillator using ring oscillator
US6888418B2 (en) Control circuit and method for a crystal oscillator using a timer
JP2010066809A (en) Microcomputer
JP2006209186A (en) Clock control device and electronic device
JP2002314336A (en) Oscillation circuit
JPH0818338A (en) Oscillation circuit
JP2014068219A (en) Clock generation circuit and semiconductor device using the same
JP4821749B2 (en) Clock supply control circuit
JP2007140878A (en) System clock generation circuit
JP2004070722A (en) Microcomputer

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20080729

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20091211

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110913

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111109

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20120104

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120403

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20120416

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20120619

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120702

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20150727

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313113

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees