[go: up one dir, main page]

JP5266168B2 - Microcomputer - Google Patents

Microcomputer Download PDF

Info

Publication number
JP5266168B2
JP5266168B2 JP2009211262A JP2009211262A JP5266168B2 JP 5266168 B2 JP5266168 B2 JP 5266168B2 JP 2009211262 A JP2009211262 A JP 2009211262A JP 2009211262 A JP2009211262 A JP 2009211262A JP 5266168 B2 JP5266168 B2 JP 5266168B2
Authority
JP
Japan
Prior art keywords
clock signal
circuit
frequency dividing
value
sleep
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2009211262A
Other languages
Japanese (ja)
Other versions
JP2011060159A (en
Inventor
光一 川野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New Japan Radio Co Ltd
Original Assignee
New Japan Radio Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New Japan Radio Co Ltd filed Critical New Japan Radio Co Ltd
Priority to JP2009211262A priority Critical patent/JP5266168B2/en
Publication of JP2011060159A publication Critical patent/JP2011060159A/en
Application granted granted Critical
Publication of JP5266168B2 publication Critical patent/JP5266168B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Power Sources (AREA)
  • Microcomputers (AREA)

Description

本発明は、第1クロック信号を生成する第1発振回路と、第1クロック信号よりも発振周波数が低く、且つ、発振周波数のばらつきが大きい第2クロック信号を生成する第2発振回路と、スリープ機能を有し、第1クロック信号に基づき動作するCPUと、第2クロック信号に基づき動作するタイマによりスリープ時間判定を行うマイクロコンピュータに関する。   The present invention relates to a first oscillation circuit that generates a first clock signal, a second oscillation circuit that generates a second clock signal having an oscillation frequency lower than that of the first clock signal and a large variation in oscillation frequency, and sleep The present invention relates to a microcomputer that has a function and operates based on a first clock signal and performs a sleep time determination using a timer that operates based on a second clock signal.

クロック信号を停止することにより回路の動作を止め、消費電力を抑えるスリープ機能を有するマイクロコンピュータ(以下マイコン)は、CPUを動作させるための高速クロック信号を生成するための水晶発振回路と、低速クロック信号を生成するためのCR発振回路と、CR発振回路が生成するクロック信号に基づいて動作する起動タイマを有するスリープ時間判定回路とを備えている。このようなマイコンは、CPUからのスリープ命令の実行により、水晶発振回路を停止し、スリープ状態へ移行する。それと同時に、スリープ時間判定回路は、起動タイマをリセットし、CR発振回路が生成するクロック信号に同期してカウント動作を開始する。そして、起動時間設定レジスタにより設定されたスリープ時間が経過すると、水晶発振回路を起動させ、CPUに対し割り込み命令を実行する。これによりマイコンは通常動作状態に復帰する。   A microcomputer (hereinafter referred to as a microcomputer) having a sleep function for stopping the operation of the circuit by stopping the clock signal and reducing power consumption includes a crystal oscillation circuit for generating a high-speed clock signal for operating the CPU, and a low-speed clock A CR oscillation circuit for generating a signal and a sleep time determination circuit having a start timer that operates based on a clock signal generated by the CR oscillation circuit are provided. Such a microcomputer stops the crystal oscillation circuit and shifts to a sleep state upon execution of a sleep command from the CPU. At the same time, the sleep time determination circuit resets the activation timer and starts a count operation in synchronization with the clock signal generated by the CR oscillation circuit. When the sleep time set by the start time setting register elapses, the crystal oscillation circuit is started and an interrupt instruction is executed to the CPU. As a result, the microcomputer returns to the normal operation state.

ところで、マイコンに内蔵されるCR発振回路は、発振周波数を決めるための抵抗と容量の製造ばらつきが大きく、CR発振回路が生成するクロック信号の周波数が大きくばらついてしまう。このため、スリープ時間設定値と、実際のスリープ時間との誤差が大きいという問題がある。そこで、この誤差を補正するために、CR発振回路が生成するクロック信号を、水晶発振器が生成する周波数精度の高いクロック信号により補正する方法が提案されている。   By the way, the CR oscillation circuit built in the microcomputer has large manufacturing variations in resistance and capacitance for determining the oscillation frequency, and the frequency of the clock signal generated by the CR oscillation circuit varies greatly. For this reason, there is a problem that an error between the sleep time set value and the actual sleep time is large. In order to correct this error, a method has been proposed in which the clock signal generated by the CR oscillation circuit is corrected by a clock signal with high frequency accuracy generated by the crystal oscillator.

例えば、特許文献1には、水晶発振器からの基準クロックに基づき、CR発振回路からのクロックの予め設定された基準周期に対する誤差を求めて、スリープ時間が所定の期間となるように、スリープ時間の判定に用いるカウント値を補正するスリープ時間補正手段の開示がある。   For example, in Patent Document 1, an error with respect to a preset reference period of a clock from a CR oscillation circuit is obtained based on a reference clock from a crystal oscillator, and the sleep time is set so that the sleep time becomes a predetermined period. There is a disclosure of sleep time correction means for correcting the count value used for determination.

特開平8−202905号公報JP-A-8-202905

図4に、特許文献1で開示されたスリープ時間補正手段のブロック図を示す。同図に示すように、CR発振回路20から出力されるクロック信号は、ダウンカウンタである分周カウンタ42に入力され、この分周カウンタ42のカウント値がゼロに達したことを、ゼロ比較器44が検出し、CPU41に対して割り込み信号を発生させる。同様に、水晶発振器30から出力される基準クロック信号は、ダウンカウンタである分周カウンタ46に入力され、この分周カウンタ46のカウント値がゼロに達したことを、ゼロ比較器48が検出し、CPU41に対して割り込み信号を発生させる。   FIG. 4 shows a block diagram of the sleep time correction means disclosed in Patent Document 1. As shown in the figure, the clock signal output from the CR oscillation circuit 20 is input to a frequency division counter 42 which is a down counter, and a zero comparator indicates that the count value of the frequency division counter 42 has reached zero. 44 detects and causes the CPU 41 to generate an interrupt signal. Similarly, the reference clock signal output from the crystal oscillator 30 is input to the frequency division counter 46 which is a down counter, and the zero comparator 48 detects that the count value of the frequency division counter 46 has reached zero. The CPU 41 generates an interrupt signal.

この回路構成による、スリープ時間の補正方法を以下に示す。
まず、所定の値を分周カウンタ42、46に設定(分周カウンタ42の設定値を「CT1」、分周カウンタ46の設定値を「CT2」)とする)し、分周カウンタ42、46のカウント動作を開始する。そして、分周カウンタ42、46がダウンカウントし、カウント値がゼロに達すると、ゼロ比較器44又は48から、CPU41に対し、割り込み信号が出力される。CPU41は、割り込み信号が出力された分周カウンタ42、又は46を再び元の設定値に戻し、カウント動作を再開させる。この作業を繰り返すことにより、一定期間における、ゼロ比較器44からの割り込み信号の数「C1」と、ゼロ比較器48からの割り込み信号の数「C2」を求める。この「C1」、「C2」より、CR発振器からのクロック信号と水晶発振器からのクロック信号に基づく割り込み周期の比を次式により算出する。
A method for correcting the sleep time according to this circuit configuration will be described below.
First, predetermined values are set in the frequency dividing counters 42 and 46 (the setting values of the frequency dividing counter 42 are “CT1” and the setting values of the frequency dividing counter 46 are “CT2”), and the frequency dividing counters 42 and 46 are set. The counting operation starts. Then, when the frequency division counters 42 and 46 count down and the count value reaches zero, an interrupt signal is output from the zero comparator 44 or 48 to the CPU 41. The CPU 41 returns the frequency dividing counter 42 or 46 to which the interrupt signal is output to the original set value again, and restarts the counting operation. By repeating this operation, the number of interrupt signals “C1” from the zero comparator 44 and the number of interrupt signals “C2” from the zero comparator 48 in a certain period are obtained. From these “C1” and “C2”, the ratio of the interrupt period based on the clock signal from the CR oscillator and the clock signal from the crystal oscillator is calculated by the following equation.

(数1)
補正値Ke=Ta×CT1×C1/(To×CT2×C2) ・・・ (1)
(ただし、Ta:CR発振回路のクロック周期、To:水晶発振回路のクロック周期)
(Equation 1)
Correction value Ke = Ta × CT1 × C1 / (To × CT2 × C2) (1)
(However, Ta: clock cycle of CR oscillation circuit, To: clock cycle of crystal oscillation circuit)

そして、分周カウンタ42の予め設定されていたカウント値CT1XをKeにより除算(CT1X/Ke)し、新たに分周カウンタ42のカウント値に設定する。これにより、スリープ時間の補正を行う。   Then, the preset count value CT1X of the frequency division counter 42 is divided by Ke (CT1X / Ke), and is newly set to the count value of the frequency division counter 42. Thereby, the sleep time is corrected.

しかし、上記の方法では、CR発振回路が生成するクロック信号の周期と、水晶発振器が生成するクロック信号の周期比を、CPUに入力される割り込み信号の回数から算出しているため、CPUへの割り込み回数を増やさないと、高い精度で周期比を求めることはできない。このため、精度の高いスリープ時間の補正を行うには、処理に時間がかかるという問題がある。   However, in the above method, since the cycle ratio of the clock signal generated by the CR oscillation circuit and the cycle ratio of the clock signal generated by the crystal oscillator is calculated from the number of interrupt signals input to the CPU, If the number of interrupts is not increased, the period ratio cannot be obtained with high accuracy. For this reason, there is a problem that processing takes time to correct the sleep time with high accuracy.

係る問題を解決するためになされた請求項1に記載の発明は、第1クロック信号を生成する第1発振回路と、前記第1クロック信号よりも発振周波数が低い第2クロック信号を生成する第2発振回路と、前記第1クロック信号に基づき動作し、スリープ機能を有するCPUと、前記第2クロック信号を入力とする分周比が選択可能な分周回路と、該分周回路により分周された第3クロック信号を入力とする起動タイマと、スリープ時間の設定値を格納するための起動時間設定レジスタと、前記起動タイマのカウント値と前記起動時間設定レジスタの値を比較し、スリープ時間の経過を判定する比較器と、を内蔵するマイクロコンピュータにおいて、前記第2クロック信号のエッジのタイミングから、前記第1クロック信号に基づいた基準期間を示す信号を生成し、該基準期間内の第2クロック信号のサイクル数をカウントし、該カウント値に基づき前記分周回路の分周比を設定するとともに、前記基準期間と、前記第3クロック信号の1周期との差を、前記第1クロック信号によりカウントし、前記基準期間と前記第3クロック信号の1周期の比から、前記起動時間設定レジスタの値を補正する演算手段とを備えたことを特徴とする。   According to a first aspect of the present invention, there is provided a first oscillation circuit for generating a first clock signal, and a second clock signal for generating a second clock signal having an oscillation frequency lower than that of the first clock signal. Two oscillation circuits, a CPU that operates based on the first clock signal and has a sleep function, a frequency dividing circuit that can select a frequency dividing ratio using the second clock signal as input, and frequency dividing by the frequency dividing circuit A start-up timer that receives the set third clock signal, a start-up time setting register for storing a set value of the sleep time, a count value of the start-up timer and a value of the start-up time setting register, and a sleep time A reference period based on the first clock signal from a timing of an edge of the second clock signal in a microcomputer incorporating the comparator Generating a signal indicating, counting the number of cycles of the second clock signal in the reference period, setting a frequency division ratio of the frequency divider circuit based on the count value, and the reference period and the third clock signal And calculating means for correcting the value of the start-up time setting register from a ratio of one period between the reference period and the third clock signal. It is characterized by.

本発明によると、CR発振回路が生成するクロック信号に基づき、スリープ時間をより正確に短時間で補正することが可能になる。   According to the present invention, it is possible to correct the sleep time more accurately and in a short time based on the clock signal generated by the CR oscillation circuit.

本発明に係るマイクロコンピュータの構成を表すブロック図である。It is a block diagram showing the structure of the microcomputer based on this invention. 本発明のスリープ時間補正回路の実施例を表す回路図である。It is a circuit diagram showing the Example of the sleep time correction circuit of this invention. 本発明のスリープ時間補正回路の動作例を表すタイミングチャートである。3 is a timing chart illustrating an operation example of a sleep time correction circuit according to the present invention. 従来例のマイクロコンピュータの構成を表すブロック図である。It is a block diagram showing the structure of the microcomputer of a prior art example.

以下、本発明の実施形態を図面に基づいて説明する。
図1は、本発明に係るマイコンの構成を表すブロック図である。マイコン10は、CR発振器20、クロック分周回路60、起動タイマ62、比較器64、起動時間補正回路66、起動時間設定レジスタ68、スリープ時間補正回路70により構成されている。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing the configuration of a microcomputer according to the present invention. The microcomputer 10 includes a CR oscillator 20, a clock frequency dividing circuit 60, a start timer 62, a comparator 64, a start time correction circuit 66, a start time setting register 68, and a sleep time correction circuit 70.

クロック分周回路60は、分周比が設定可能な分周回路で、CR発振器20から出力されたクロック信号CRCLKを所定の分周比(N)により分周し、クロック信号CRCLK2を出力する。   The clock frequency dividing circuit 60 is a frequency dividing circuit in which a frequency dividing ratio can be set. The clock frequency dividing circuit 60 divides the clock signal CRCLK output from the CR oscillator 20 by a predetermined frequency dividing ratio (N), and outputs a clock signal CRCLK2.

起動タイマ62は、クロック分周回路60から出力されたクロック信号CRCLK2を入力し、CPU40からのスリープ命令を受けると、タイマをリセットし、クロック信号CRCLK2のカウントを開始する。   The activation timer 62 receives the clock signal CRCLK2 output from the clock frequency dividing circuit 60, receives the sleep command from the CPU 40, resets the timer, and starts counting the clock signal CRCLK2.

起動時間設定レジスタ68は、スリープ時間の設定を行うレジスタで、CPU40に割り込みをかけるための起動タイマ62のカウンタ値を設定する。   The activation time setting register 68 is a register for setting the sleep time, and sets the counter value of the activation timer 62 for interrupting the CPU 40.

起動時間補正回路66は、スリープ時間補正回路70から補正用の係数(M)と、起動時間設定レジスタ68から起動時間設定値(CT1X)を入力し、起動時間設定値を補正して比較器64へ出力する。   The activation time correction circuit 66 receives the correction coefficient (M) from the sleep time correction circuit 70 and the activation time setting value (CT1X) from the activation time setting register 68, corrects the activation time setting value, and compares the comparator 64. Output to.

比較器64は、起動タイマ62からのカウント値と、起動時間補正回路からの起動時間補正値が一致したら、CPU40に対し、割り込み信号を出力する。   The comparator 64 outputs an interrupt signal to the CPU 40 when the count value from the activation timer 62 matches the activation time correction value from the activation time correction circuit.

スリープ時間補正回路70は、CR発振器から出力されたクロック信号CRCLKと水晶発振器から出力されたクロック信号CPUCLKを入力し、CPU40からの起動命令により、クロック分周回路60に対し、分周比(N)を出力すると共に、起動時間補正回路66に対し、補正用の係数(M)を出力する。なお、分周比Nと、補正用の係数Mの算出は、以下のスリープ時間補正方法の説明において詳説する。   The sleep time correction circuit 70 receives the clock signal CRCLK output from the CR oscillator and the clock signal CPUCLK output from the crystal oscillator, and supplies a frequency division ratio (N) to the clock frequency dividing circuit 60 in response to an activation command from the CPU 40. ) And a correction coefficient (M) are output to the activation time correction circuit 66. The calculation of the frequency division ratio N and the correction coefficient M will be described in detail in the description of the sleep time correction method below.

スリープ時間補正方法を、図1のブロック図と、図3のタイミングチャートを参照して説明する。スリープ時間補正回路70において、水晶発振器30から出力されるクロック信号CPUCLK(CPUCLK信号)に基づき、基準期間を示す信号(REF信号)を生成する。ここで、CPUCLK信号の1周期をTCPUCLK、CR発振器20から出力されるクロック信号CRCLK(CRCLK信号)の1周期をTCRCLKとすると、図3に示すように、基準期間は、TCPUCLK×Lと表すことができる。また同様に、基準期間は、クロック信号CRCLKのNサイクル分TCRCLK×N(TCRCLK2と表す)と、クロック信号CPUCLKのMサイクル分TCPUCLK×Mを足した期間で表わすことができる。 The sleep time correction method will be described with reference to the block diagram of FIG. 1 and the timing chart of FIG. The sleep time correction circuit 70 generates a signal (REF signal) indicating the reference period based on the clock signal CPUCLK (CPUCLK signal) output from the crystal oscillator 30. Here, if one cycle of the CPUCLK signal is T CPUCLK and one cycle of the clock signal CRCLK (CRCLK signal) output from the CR oscillator 20 is T CRCLK , the reference period is T CPUCLK × L as shown in FIG. It can be expressed as. Similarly, the reference period can be represented by a period obtained by adding N cycles T CRCLK × N (represented as T CRCLK2 ) of the clock signal CRCLK and M CPU cycles T CPUCLK × M of the clock signal CPUCLK.

そこで、クロック分周回路60の分周比に、上記「N」を設定するとともに、上記「L」、「M」の値から、補正値Ke=TCPUCLK×(L−M)/(TCPUCLK×L)を求め、起動時間設定レジスタ68の値をKeで割ることにより、スリープ時間を正確に補正することができる。 Therefore, “N” is set as the frequency dividing ratio of the clock frequency dividing circuit 60, and the correction value Ke = T CPUCLK × (L−M) / (T CPUCLK ) from the values of “L” and “M”. XL) is obtained, and the sleep time can be accurately corrected by dividing the value of the activation time setting register 68 by Ke.

以下に、スリープ時間補正回路70の具体的な回路例と動作について説明する。
図2に示すように、スリープ時間補正回路70は、制御回路71、Lカウンタ72、Mカウンタ73、Nカウンタ74、立ち上りエッジ検出回路75により構成される。
A specific circuit example and operation of the sleep time correction circuit 70 will be described below.
As shown in FIG. 2, the sleep time correction circuit 70 includes a control circuit 71, an L counter 72, an M counter 73, an N counter 74, and a rising edge detection circuit 75.

制御回路71は、CPUからの起動命令により、各カウンタをリセットする。そして、立ち上がりエッジ検出回路75により、クロック信号CRCLKの立ち上りエッジを検出し、REF信号をアクティブにする。REF信号のアクティブ期間の設定は、Lカウンタ72の設定により行い、カウント値は、クロック信号CRCLK2の目標とする周期に相当するカウント値に設定する。   The control circuit 71 resets each counter in response to a start command from the CPU. Then, the rising edge detection circuit 75 detects the rising edge of the clock signal CRCLK and activates the REF signal. The active period of the REF signal is set by setting the L counter 72, and the count value is set to a count value corresponding to the target cycle of the clock signal CRCLK2.

Nカウンタ74は、REF信号がアクティブの期間、クロック信号CRCLKのカウントを行う。これにより、REF信号がアクティブ期間のクロック信号CRCLKのサイクル数「N」が求められる。   The N counter 74 counts the clock signal CRCLK while the REF signal is active. As a result, the number of cycles “N” of the clock signal CRCLK when the REF signal is active is obtained.

Mカウンタ73は、クロック信号CLKCRの立ち上りエッジによりリセットされ、イネーブル端子(EN)がアクティブの間、クロック信号CPUCLKをカウントし、イネーブル端子がノンアクティブになると、そのカウント値を保持する。このため、制御回路71がREF信号をノンアクティブにした後、Mカウンタ73には、クロックCLKCRの立ち上りから補正処理が終了するまでの期間(TCPUCLK×M)(図3参照)に相当するクロック信号CPUCLKのカウント値「M」が格納される。 The M counter 73 is reset by the rising edge of the clock signal CLKCR, counts the clock signal CPUCLK while the enable terminal (EN) is active, and holds the count value when the enable terminal becomes inactive. Therefore, after the control circuit 71 deactivates the REF signal, the M counter 73 has a clock corresponding to a period (T CPUCLK × M) (see FIG. 3) from the rise of the clock CLKCR to the end of the correction process. The count value “M” of the signal CPUCLK is stored.

次に、図1に示す起動時間補正回路66の機能について以下に示す。
まず、クロック信号CRCLK2の1周期(TCRCLK×N)と基準期間(TCPUCLK×L)との比を求める。
Next, the function of the activation time correction circuit 66 shown in FIG.
First, a ratio between one cycle (T CRCLK × N) of the clock signal CRCLK2 and the reference period (T CPUCLK × L) is obtained.

(数2)
補正値Ke=TCPUCLK×(L−M)/(TCPUCLK×L)=(L−M)/L ・・・ (2)
(Equation 2)
Correction value Ke = T CPUCLK * (LM) / (T CPUCLK * L) = (LM) / L (2)

次に、起動時間設定レジスタの予め設定されていたレジスタ値CT1XをKeにより除算(CT1X/Ke)し、起動時間補正回路66の出力とする。   Next, the register value CT1X set in advance in the activation time setting register is divided by Ke (CT1X / Ke) to obtain the output of the activation time correction circuit 66.

ただし、上記のMの値が分かれば、起動時間補正値を、ハードウェアではなくソフトウェハにより具現化することもできる。   However, if the value of M is known, the startup time correction value can be realized by a soft wafer instead of hardware.

本願発明のスリープ時間の補正処理の例を以下に示す。水晶発振回路が生成するクロック信号の周波数が10MHz(周期TCPUCLK=100ns)、CR発振回路が生成するクロック信号の周波数が32kHz(周期TCRCLK=31.25μs)で、CPUのスリープ状態への移行から100s後に通常動作状態に復帰をさせる場合を考える。 An example of the sleep time correction process of the present invention will be described below. When the frequency of the clock signal generated by the crystal oscillation circuit is 10 MHz (cycle T CPUCLK = 100 ns) and the frequency of the clock signal generated by the CR oscillation circuit is 32 kHz (cycle T CRCLK = 31.25 μs), the CPU shifts to the sleep state. Let us consider a case where the normal operation state is restored after 100 seconds.

この場合、クロック分周回路60のクロック分周比を「32」に設定すると、クロック信号CRCLK2は1kHz(周期TCRCLK2=1ms)となるため、起動時間設定レジスタ32に「100,000」を設定すれば、マイコンは100s後にスリープ状態から復帰することができる。 In this case, if the clock frequency dividing ratio of the clock frequency dividing circuit 60 is set to “32”, the clock signal CRCLK2 becomes 1 kHz (period T CRCLK2 = 1 ms), and therefore “100,000” is set in the activation time setting register 32. Then, the microcomputer can return from the sleep state after 100 seconds.

ここで、CRCLK発振回路が生成するクロック信号の周波数が、周波数ばらつきにより、32kHzに対し、30.5kHz(周期TCRCLK=32.79μs)となった場合を考える。
(1)補正処理を行わない場合
スリープ時間=TCRCLK×クロック分周比×起動時間設定レジスタ値
=32.79μs×32×100,000
=104.9s
となり、目標の100sに対し4.9sの誤差が生じる。
(2)補正処理を行った場合
クロック信号CRCLK2の理想周波数は、1kHz(TCPUCLK×L=1ms)であるため、Lの値を「10,000」とする。
そして、クロック分周比は「30」(∵ N=TCPUCLK×L/TCRCLK=30.49・・)となり、Mは「163」(∵ M=(TCPUCLK×L−30×TCRCLK)/TCPUCLK)となる。
これより、起動時間補正値は、
CT1X/Ke=CT1X×L/(L−M)
=100,000×10,000/(10,000−163)
=101,600
となるため、
スリープ時間=TCRCLK×クロック分周比×起動時間補正値
=32.79μs×30×101,600
=99.9s
となり、目標値の100sに対し、略一致する。
Here, a case is considered where the frequency of the clock signal generated by the CRCLK oscillation circuit is 30.5 kHz (period T CRCLK = 32.79 μs) with respect to 32 kHz due to frequency variation.
(1) When correction processing is not performed Sleep time = T CRCLK × clock division ratio × startup time setting register value
= 32.79 μs × 32 × 100,000
= 104.9s
Thus, an error of 4.9 s occurs with respect to the target of 100 s.
(2) When correction processing is performed Since the ideal frequency of the clock signal CRCLK2 is 1 kHz (T CPUCLK × L = 1 ms), the value of L is set to “10,000”.
The clock division ratio is “30” ( ∵N = T CPUCLK × L / T CRCLK = 30.49...), And M is “163” ( ∵M = (T CPUCLK × L−30 × T CRCLK )) / T CPUCLK ).
From this, the startup time correction value is
CT1X / Ke = CT1X × L / (LM)
= 100,000 x 10,000 / (10,000-163)
= 101,600
So that
Sleep time = T CRCLK × clock division ratio × startup time correction value
= 32.79 μs × 30 × 101,600
= 99.9s
Thus, it substantially matches the target value of 100 s.

10,11:マイクロコンピュータ
20:CR発振回路
30:水晶発振回路
31:水晶発振素子
40,41:CPU
60:クロック分周回路
62:起動タイマ
64:比較器
66:起動時間補正回路
68:起動時間設定レジスタ
71:制御回路
72:Lカウンタ(基準期間生成用)
73:Mカウンタ(TCRCLKより短い期間の測定用)
74:Nカウンタ(CRCLK分周比設定用)
75:立ち上がりエッジ検出回路
10, 11: Microcomputer 20: CR oscillation circuit 30: Crystal oscillation circuit 31: Crystal oscillation element 40, 41: CPU
60: Clock divider 62: Startup timer 64: Comparator 66: Startup time correction circuit 68: Startup time setting register 71: Control circuit 72: L counter (for generating a reference period)
73: M counter (for measurement shorter than T CRCLK )
74: N counter (for setting CRCLK division ratio)
75: Rising edge detection circuit

Claims (1)

第1クロック信号を生成する第1発振回路と、前記第1クロック信号よりも発振周波数が低い第2クロック信号を生成する第2発振回路と、前記第1クロック信号に基づき動作し、スリープ機能を有するCPUと、前記第2クロック信号を入力とする分周比が選択可能な分周回路と、該分周回路により分周された第3クロック信号を入力とする起動タイマと、スリープ時間の設定値を格納するための起動時間設定レジスタと、前記起動タイマのカウント値と前記起動時間設定レジスタの値を比較し、スリープ時間の経過を判定する比較器と、を内蔵するマイクロコンピュータにおいて、
前記第2クロック信号のエッジのタイミングから、前記第1クロック信号に基づいた基準期間を示す信号を生成し、該基準期間内の第2クロック信号のサイクル数をカウントし、該カウント値に基づき前記分周回路の分周比を設定するとともに、前記基準期間と、前記第3クロック信号の1周期との差を、前記第1クロック信号によりカウントし、前記基準期間と前記第3クロック信号の1周期の比から、前記起動時間設定レジスタの値を補正する演算手段とを備えたことを特徴とするマイクロコンピュータ。
A first oscillation circuit that generates a first clock signal; a second oscillation circuit that generates a second clock signal having an oscillation frequency lower than that of the first clock signal; and a sleep function that operates based on the first clock signal. A CPU having a frequency dividing circuit capable of selecting a frequency dividing ratio that receives the second clock signal, a start timer that receives a third clock signal divided by the frequency dividing circuit, and a sleep time setting In a microcomputer incorporating a startup time setting register for storing a value, a comparator for comparing the count value of the startup timer and the value of the startup time setting register, and determining the elapse of a sleep time,
A signal indicating a reference period based on the first clock signal is generated from the edge timing of the second clock signal, the number of cycles of the second clock signal in the reference period is counted, and the number of cycles based on the count value A frequency dividing ratio of the frequency dividing circuit is set, a difference between the reference period and one period of the third clock signal is counted by the first clock signal, and 1 of the reference period and the third clock signal is counted. A microcomputer comprising: an arithmetic means for correcting the value of the startup time setting register based on a ratio of periods.
JP2009211262A 2009-09-14 2009-09-14 Microcomputer Active JP5266168B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009211262A JP5266168B2 (en) 2009-09-14 2009-09-14 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009211262A JP5266168B2 (en) 2009-09-14 2009-09-14 Microcomputer

Publications (2)

Publication Number Publication Date
JP2011060159A JP2011060159A (en) 2011-03-24
JP5266168B2 true JP5266168B2 (en) 2013-08-21

Family

ID=43947687

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009211262A Active JP5266168B2 (en) 2009-09-14 2009-09-14 Microcomputer

Country Status (1)

Country Link
JP (1) JP5266168B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5886015B2 (en) * 2011-12-01 2016-03-16 ラピスセミコンダクタ株式会社 Time measuring device, microcontroller, program, and time measuring method
DE112014005796T8 (en) 2013-12-18 2016-09-22 Calsonic Kansei Corporation Microcomputer and method for correcting its clock generator

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0784666A (en) * 1993-09-10 1995-03-31 Kansei Corp Control device for intermittent operation of cpu
JP2868472B2 (en) * 1996-07-30 1999-03-10 日本電気アイシーマイコンシステム株式会社 Microcontroller and control method thereof
JPH10190568A (en) * 1996-12-27 1998-07-21 Matsushita Electric Ind Co Ltd Wireless receiver

Also Published As

Publication number Publication date
JP2011060159A (en) 2011-03-24

Similar Documents

Publication Publication Date Title
JP5659855B2 (en) Calibration method and calibration apparatus
JP5180169B2 (en) Semiconductor integrated circuit
JP5886015B2 (en) Time measuring device, microcontroller, program, and time measuring method
JP2007094931A (en) Correction clock generation circuit and usb device equipped with the same
JP2008028854A (en) Clock generator
US8311169B2 (en) Automatic frequency monitoring circuit, electronic device, automatic frequency monitoring method, and automatic frequency monitoring program
JPH1049251A (en) Microcontroller and its control method
JP5266168B2 (en) Microcomputer
TWI638517B (en) Mitigation of long wake-up delay of a crystal oscillator
CN103023433B (en) Improved high-precision oscillator
US8957795B2 (en) Analog-to-digital conversion device
JP4198639B2 (en) Interrupt generation circuit
JP2011197910A (en) Clock control circuit and microcomputer
TW201815071A (en) Frequency calibration method for digitally controlled oscillator and apparatus using the same
US20100109728A1 (en) Electronic device and method of correcting clock signal deviations in an electronic device
JP4036114B2 (en) Clock generation circuit
JPH0784666A (en) Control device for intermittent operation of cpu
JP2000074962A (en) Cycle-measuring device and method therefor, and storage medium
TWI501555B (en) Control circuit and method for dynamically adjusting a source current for an oscillation source
JP4248963B2 (en) Timing device
JP2016184366A (en) Timer correction device, timer correction method, and timer correction program
JP4826433B2 (en) Timer start circuit
CN120103925A (en) A high-precision timer and timing method thereof
JP2011139285A (en) Jitter removing circuit
JP2004264899A (en) Control device capable of synchronizing with external

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120724

TRDD Decision of grant or rejection written
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130417

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20130423

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130502

R150 Certificate of patent or registration of utility model

Ref document number: 5266168

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250