JP3611788B2 - Microcomputer timer calibration system - Google Patents
Microcomputer timer calibration system Download PDFInfo
- Publication number
- JP3611788B2 JP3611788B2 JP2001004046A JP2001004046A JP3611788B2 JP 3611788 B2 JP3611788 B2 JP 3611788B2 JP 2001004046 A JP2001004046 A JP 2001004046A JP 2001004046 A JP2001004046 A JP 2001004046A JP 3611788 B2 JP3611788 B2 JP 3611788B2
- Authority
- JP
- Japan
- Prior art keywords
- routine
- operation mode
- reference signal
- signal
- adjustment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Electric Clocks (AREA)
- Measuring Frequencies, Analyzing Spectra (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は、プログラムによってタイマカウントを行うマイクロコンピュータにおいて、そのタイマの校正システムに関する。
【0002】
【従来の技術】
マイクロコンピュータを用いた制御装置が各種電気機器や電子機器に採用されているが、実装部品を出来る限り安価にするために、動作クロック信号の発振回路を水晶やセラミックの振動子を用いずにCR発振回路で構成したものが採用されることがある。このような制御装置では、プログラムによるタイマカウントによって時間計測を行うが、時間計測には、通常、動作クロックを基準として行っている。
【0003】
しかし、CR発振回路は、水晶やセラミック等の振動子を用いた発振回路に比較して安価である反面、発振周波数のバラツキが大きく、精度が要求される場合には適していないという不都合がある。
【0004】
そこで、たとえば、特開平11−052080号公報に示されるように、各命令実行サイクル数を加算することでタイマカウント時間を計数するタイマカウントプログラムを制御プログラム中に設けるとともに、外部から基準信号を入力し、その基準信号の周期をマイクロコンピュータの実行サイクル数でカウントし、被測定信号が入力された時に、上記基準信号の周期が何回繰り返されたかによって被測定信号の時間計測を行うようにしている。
【0005】
【発明が解決しようとする課題】
しかし、上記の装置では、マイクロコンピュータのプログラムに、基準信号をカウントするための機能を付加する必要があるために、プログラムが長くなり、プログラムを格納するROM容量を多く必要とする問題があった。また、基準信号の周期を記憶しておいて、この周期が被測定信号の入力中に何回繰り返されたかによって該被測定信号の計測を行う構成上、その精度は基準信号の周期となるために、高精度な時間計測を行えない問題があった。
【0006】
本発明の目的は、マイクロコンピュータに内蔵するプログラムが長くなるのを防ぎ、且つ、タイマカウント時間を高精度で計数することのできる、マイクロコンピュータのタイマ校正システムを提供することにある。
【0007】
【課題を解決するための手段】
本発明は、動作クロック信号を形成するCR発振回路を備え、各命令実行サイクル数を加算することでタイマカウント時間を計数するタイマカウントプログラムを備えたマイクロコンピュータのタイマ校正システムにおいて、
前記プログラムは、
所定の命令実行サイクル数の処理部Aと、メモリに記憶されている回数分だけ繰り返し実行するループルーチンBとを備える通常動作モードルーチンと、
前記処理部Aと同じ命令実行サイクル数を持ち、外部入力端子からの信号に基づいて前記メモリに記憶されている回数を変更し、または調整終了動作をする処理部Bと、前記ループルーチンBと同じルーチン構造を持つループルーチンCと、前記処理部Bおよび前記ループルーチンCの処理時間を1周期とするパルスを外部出力端子に出力するステップと、を備える基準信号調整動作モードルーチンと、からなり、
前記外部出力端子と前記外部入力端子に接続され、該外部出力端子からのパルスと基準パルスとの周期の比較結果に応じて前記回数を増減すべき信号または調整を終了すべき信号を前記外部入力端子に出力する基準信号調整装置を設けたことを特徴とする。
【0008】
本発明のタイマ校正システムは、タイマ校正を行う時に、マイクロコンピュータに基準信号調整装置が接続される。この基準信号調整装置を接続して、マイクロコンピュータを基準信号調整動作モードに設定し、この基準信号調整動作モードルーチンを実行する。すると、自動的に、CR発振回路の周波数のバラツキが補正され、タイマ校正が行われる。
【0009】
すなわち、マイクロコンピュータは、通常動作モードルーチンと基準信号調整動作モードルーチンとを備えている。通常動作モードルーチンでは、所定の命令実行サイクル数の処理部Aと、メモリに記憶されている回数分だけ繰り返し実行するループルーチンBとを備えている。したがって、この通常動作モードルーチンを一度実行すれば、その実行時間は、処理部Aに要する時間とループルーチンBを実行するに要する時間の和となる。この時、メモリに記憶されている回数を変更すれば、ループルーチンBの処理時間が変わるから、結果として通常動作モードルーチンの実行時間が変わる。本発明では、基準信号調整動作モードルーチンによって、上記メモリに記憶されている回数を適当な値に設定する。これにより、CR発振回路の周波数のバラツキがあっても、それを補正する値をメモリに記憶することで、通常動作モードルーチンの1回の実行時間を所定の時間、すなわち、CR発振回路の周波数が正しい値の時の時間に調整することができる。この調整により、タイマ校正が行われる。
【0010】
基準信号調整動作モードルーチンでは、基本的に、上記通常動作モードルーチンの処理部AとループルーチンBと同等の構造を持つものとする。すなわち、処理部Aに対する処理部Bと、ループルーチンBに対するループルーチンCを備えている。そして、外部入力端子からの信号に基づいてメモリに記憶されている回数を変更し、且つ、処理部BおよびループルーチンCの処理時間を一周期とするパルスを外部出力端子に出力する。このような構成にして、マイクロコンピュータに接続される基準信号調整装置を同時に動作させる。この基準信号調整装置では、内部にセラミックや水晶等の発振子を備える正確な周波数を発振する発振回路を備えている。そして、上記外部出力端子からのパルスと基準信号調整装置内で発生する基準パルスとの周期の比較結果に応じて前記メモリに記憶される回数を増減すべき信号または調整を終了すべき信号を形成し、これをマイクロコンピュータの前記外部入力端子に出力する。すなわち、前記マイクロコンピュータから入力されるパルスが基準パルスに対して周期が長ければ、このマイクロコンピュータのパルスが短くなるよう前記回数を減らすべき信号を出力し、その反対の場合は前記回数を増やすべき信号を出力する。両者が一致した時に調整を終了すべき信号を出力する。
【0011】
マイクロコンピュータでは、上記基準信号調整装置からの信号に基づいてメモリに記憶されている回数を変更したり、または調整終了動作をするために、上記回数が変更された時には、基準信号調整装置に対して出力されるパルスの周期も変更される。こうして、両者の間でやりとりを行うことよって、最終的には基準信号調整装置から調整を終了すべき信号がマイクロコンピュータに返される。マイクロコンピュータの基準信号調整動作モードルーチンでは、上記調整を終了すべき信号を受けると、調整終了動作を行う。この時のメモリに記憶されている回数は、CR発振回路の周波数のバラツキを補正したものとなる。以後、この値を不揮発性メモリに記憶しておくことによって、その後、CR発振回路であっても正確なタイマカウント時間を計数することが可能になる。
【0012】
【発明の実施の形態】
図1は、本発明の実施形態であるタイマ校正システムのブロック図である。
制御装置1は、内部にマイクロコンピュータを内蔵し、任意の電子機器等に組み込まれる。この制御装置1は、後述のように、通常動作モードルーチンと基準信号調整動作モードルーチンとを備え、電子機器等に組み込まれた時には、通常動作モードルーチンが実行される。また、基準信号調整動作モードルーチンは、図1に示す基準信号調整装置2が接続されて基準信号調整動作モードに設定された時に実行される。
【0013】
制御装置1は、以下の端子を備えている。
【0014】
SIGOUT:基準信号調整動作モードルーチンの実行中に、パルス信号を出力する。
【0015】
FUPIN:基準信号調整装置2から周波数アップ信号が入力される。
【0016】
FDNIN:基準信号調整装置2から周波数ダウン信号が入力される。
【0017】
FSIGIN:基準信号調整装置2から調整終了信号が入力される。
【0018】
MODE:動作モードを通常動作モードにするか基準信号調整動作モードにするかの動作モード切り換え信号が入力される。この動作モード切り換え信号は、たとえば、GNDレベルに接続することで基準信号調整動作モードを設定し、これを切り離すことで通常動作モードに設定することができる。
【0019】
基準信号調整動作モードは、通常は、制御装置1を動作させる前に一度行えばよいが、マイクロコンピュータ内のCR発振回路の経時変化により、適宜行うようにしてもよい。基準信号調整装置2は、この基準信号調整動作モードを実行するときにのみ制御装置1に接続され、通常時は、この調整装置2を制御装置1に接続する必要はない。
【0020】
なお、本発明の外部入力端子は、制御装置1のFUPIN、FDNIN、FSIGIN端子が対応し、外部出力端子は、SIGOUT端子が対応している。また、基準信号調整装置2のSIGIN、FUPOUT、FDNOUT、FSIGOUTの各端子は、制御装置1のSIGOUT、FUPIN、FDNIN、FDNIN、FSIGINの端子のそれぞれに接続されている。
【0021】
次に、上記制御装置1と基準信号調整装置2の動作について図2以下を参照して説明する。
【0022】
図2、図3は、制御装置1の動作を示すフローチャートである。
【0023】
制御装置1は、ステップ10において動作モード切り換え信号のレベルを判定し、通常動作モードか基準信号調整動作モードかのいずれかを設定する。動作モード切り換え信号が“L”の場合には、ステップ11以下の通常動作モードを実行し、動作モード切り換え信号が“H”の場合には、ステップ20以下の基準信号調整動作モードルーチンを実行する。
【0024】
通常動作モードでは、まず、ステップ11においてメモリmem1にEEPROMのデータを転送する。次に、ステップ12において処理Aを実行し、ステップ13においてメモリmem1の内容をカウンタCNTに転送する。ステップ14およびステップ15では、このカウンタの回数分だけループさせる。カウンタCNTが0になると、キャリーフラグCFが1となって、再びステップ12に戻る。
【0025】
以上の処理において、処理Aは命令実行サイクル数が470サイクルに固定されている。また、ステップ13〜ステップ15のループルーチンでは、ステップ13に12サイクル、ステップ14およびステップ15においてメモリmem1に記憶されている回数分のループに応じたサイクル数が実行される。したがって、通常動作モードでは、ステップ12〜ステップ15において、メモリmem1に記憶されている回数分に応じたタイマカウント時間を計数することができる。
【0026】
上記動作モード切り換え信号が“H”の場合には、ステップ10からステップ20に移り、以下、基準信号調整動作モードルーチンが実行される。
【0027】
このモードの基本構造は、通常動作モードルーチンの構造と基本的に同一である。すなわち、ステップ12の処理Aが、ステップ21〜ステップ41までの処理Bに対応し、ステップ13〜ステップ15のループルーチンBが、ステップ42〜ステップ44のループルーチンCに対応している。
【0028】
最初に、ステップ20において、定数129が初期値として設定される。初期値を129としているのは、マイクロコンピュータの動作周波数のセンター値を、ここでは1MHzと想定しているためである。
【0029】
ステップ21では、SIGOUT端子を“H”に設定する。これにより、外部出力信号は“H”に立ち上がる。ステップ22、25、28では、外部入力端子を監視する。また、ステップ23、26、30は、外部入力端子からの信号に基づいて、メモリmem1に記憶されている回数を変更したり、または調整終了動作のための処理を行う。
【0030】
すなわち、入力端子FUPINが“H”の時(後述のように、現在のCR発振周波数を上げるべきことを示す)には、ステップ23において、メモリmem1に記憶されている回数をデクリメントし、ステップ25において、入力端子FDNINが“H”の時(後述のように、現在のCR発振周波数を下げるべきことを示す)は、ステップ26において、メモリmem1に記憶されている回数をインクリメントし、ステップ28において、入力端子FSIGINが“H”の時(後述のように、現在のCR発振周波数が基準周波数と一致していて適正であることを示す)には、ステップ30において、現在のメモリmem1の内容をEEPROMに転送する。
【0031】
ステップ24、ステップ27は、NOP処理であって、それぞれ、ステップ23、ステップ26と同じ命令実行サイクル数を持っている。また、ステップ29は、時間待ちステップであり、ステップ21からステップ29までで、総命令実行サイクル数が235サイクルとなるよう、このステップ29で時間待ちが行われる。時間待ちには、NOP等の命令を必要回数分ループさせる等の処理で実行可能である。
【0032】
ステップ22、25、28において、各外部入力端子が“L”の時には、メモリmem1内容の変更を行わずに、ステップ40(図3参照)に進む。ステップ40では、外部出力端子SIGOUTを“L”に落とす。これにより、出力は“H”から“L”となる。次のステップ41では時間待ちを行う。すなわち、ステップ40と41とで、合計235サイクルとなるようにステップ41で時間待ちを行う。
【0033】
以上の、ステップ21からステップ41までの処理Bで命令実行サイクル数の総数は、235+235=470サイクルとなり、通常動作モードルーチンのステップ12の処理Aの命令実行サイクル総数と同じになる。
【0034】
続いて、ステップ42〜ステップ44のループルーチンCにおいて、ステップ13〜ステップ15と同じループルーチンを実行する。このループルーチンCを終了すると、再びステップ21にジャンプして以下同じ処理が繰り返される。この繰り返しにより、外部出力端子はステップ21で“H”となり、ステップ40で“L”となるパルスが連続出力される。そして、そのパルスの周期は、メモリmem1に記憶されている内容(ループルーチンの繰り返し回数)に基づいて決まる。
【0035】
図4は、基準信号調整装置2の動作を示すフローチャートである。
【0036】
ステップ50では、SIGIN端子に入力されるパルスの周期Tsigの測定を行う。この端子に入力されるパルスは、制御装置1の外部出力端子から出力されるパルスである。ステップ51において、Tsigの周期が、基準周期Tsと同じであるかどうかの判定を行う。基準周期Tsは、基準信号調整装置2内で水晶発振子等の高精度素子を用いて発振した基準パルスの周期である。もし違っていれば、ステップ53に進み、両者の大小を判定する。入力されたパルスの周期が基準周期よりも短ければ(周波数が高ければ)、ステップ55に進んで、端子FUPOUTを”L”、端子FDNOUTを“H”にして、制御装置1の外部入力端子FDNINに対し、周波数を低下させるべき信号を出力する。入力されたパルスの周期が基準周期より長ければ(周波数が低ければ)、ステップ54に進んで、端子FUPOUTを”H”、端子FDNOUTを“L”にして、制御装置1の外部入力端子FUPINに対し、周波数を上昇させるべき信号を出力する。ステップ51において、入力パルスの周期が基準周期に一致した場合には、ステップ52において、各端子FUPOUT、FDNOUTを“L”に設定し、且つ、FSIGOUT端子を“H”に設定する。これにより、制御装置1の入力端子FSIGINには、“H”の調整終了動作を示す信号が入力される。
【0037】
上記のように、動作モード切り換え信号が“H”となって、基準信号調整動作モードに入った時には、制御装置1のステップ21〜ステップ44からなる基準信号調整動作モードルーチンと、基準信号調整装置2のステップ50〜ステップ55のルーチンとで信号のやりとりを行い、最終的に、制御装置1のCR発振周波数の周期が基準周期となるようにメモリmem1の内容が調整され、その値がEEPROMに記憶されて、調整が終了する。
【0038】
調整が終了すると、動作モード切り換え信号が“L”に設定され、以下、ステップ11以下の通常動作モードルーチンが実行され、正確なタイマカウント時間の計数が行われていく。
【0039】
具体的な数値を用いて、以下、調整動作の説明を行う。
【0040】
マイクロコンピュータの動作周波数を800kHz、1命令サイクル数を8クロックとする。
【0041】
上記の条件で、調整動作を行うと、最初に、メモリmem1=129として動作を開始した時(ステップ20)、この時のSIGOUTから出力されるパルスの周期は、
235+235+12+4×129+2=1000サイクル
1000×8/800000=0.01s
となり、周期は10msとなる。この場合、基準周期を8msとすると、制御装置1側の外部入力端子FUPINが“H”となるために、メモリmem1の値を減らしていき、メモリmem1=79になった時、
235+235+12+4×79+2=800サイクル
800×8/800000=0.008s
となり、基準周期8msと一致する。この段階で、調整動作が終了する。
【0042】
【発明の効果】
本発明によれば、マイクロコンピュータ側に、基準信号をカウントする機能を付加する必要がないために、そのためのプログラム分が長くならないという利点がある。また、調整の分解能は、ループルーチンCの1回の処理に要する時間となるために、高精度なタイマ校正を行うことができる。
【図面の簡単な説明】
【図1】本発明の実施形態であるマイクロコンピュータのタイマ校正システムの構成図
【図2】制御装置の要部動作を示すフローチャート
【図3】制御装置の要部動作を示すフローチャート
【図4】基準信号調整装置の要部動作を示すフローチャート[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a timer calibration system in a microcomputer that performs timer counting by a program.
[0002]
[Prior art]
Control devices using microcomputers are used in various electrical and electronic equipment, but in order to make the mounted parts as cheap as possible, the oscillation circuit for the operation clock signal is used without using a crystal or ceramic oscillator. An oscillator circuit may be used. In such a control device, the time is measured by a timer count by a program, but the time measurement is usually performed based on the operation clock.
[0003]
However, the CR oscillation circuit is less expensive than an oscillation circuit using a vibrator such as crystal or ceramic, but has a disadvantage that the oscillation frequency varies greatly and is not suitable when accuracy is required. .
[0004]
Therefore, for example, as disclosed in JP-A-11-052080, a timer count program for counting the timer count time by adding the number of instruction execution cycles is provided in the control program, and a reference signal is input from the outside. The period of the reference signal is counted by the number of execution cycles of the microcomputer, and when the signal under measurement is input, the time of the signal under measurement is measured according to how many times the period of the reference signal is repeated. Yes.
[0005]
[Problems to be solved by the invention]
However, the above-described apparatus has a problem that a program for a microcomputer needs to be added with a function for counting reference signals, so that the program becomes long and requires a large ROM capacity for storing the program. . In addition, since the period of the reference signal is stored and the measurement of the signal under measurement is performed according to how many times this period is repeated during input of the signal under measurement, the accuracy is the period of the reference signal. In addition, there is a problem that high-precision time measurement cannot be performed.
[0006]
An object of the present invention is to provide a timer calibration system for a microcomputer that can prevent the program built in the microcomputer from becoming long and can count the timer count time with high accuracy.
[0007]
[Means for Solving the Problems]
The present invention provides a timer calibration system for a microcomputer that includes a CR oscillation circuit that forms an operation clock signal and includes a timer count program that counts a timer count time by adding the number of instruction execution cycles.
The program is
A normal operation mode routine comprising a processing unit A having a predetermined number of instruction execution cycles and a loop routine B that repeatedly executes as many times as stored in the memory;
A processing unit B having the same number of instruction execution cycles as the processing unit A, changing the number of times stored in the memory based on a signal from an external input terminal, or performing an adjustment end operation; and the loop routine B; A loop routine C having the same routine structure, and a step of outputting to the external output terminal a pulse having the processing time of the processing unit B and the loop routine C as one cycle, and a reference signal adjustment operation mode routine. ,
The external input terminal is connected to the external output terminal and the external input terminal, and a signal to increase or decrease the number of times or a signal to end the adjustment according to a comparison result of the period of a pulse from the external output terminal and a reference pulse A reference signal adjusting device for outputting to a terminal is provided.
[0008]
In the timer calibration system of the present invention, a reference signal adjustment device is connected to the microcomputer when performing timer calibration. The reference signal adjustment device is connected, the microcomputer is set to the reference signal adjustment operation mode, and this reference signal adjustment operation mode routine is executed. Then, the frequency variation of the CR oscillation circuit is automatically corrected, and timer calibration is performed.
[0009]
That is, the microcomputer includes a normal operation mode routine and a reference signal adjustment operation mode routine. The normal operation mode routine includes a processing unit A having a predetermined number of instruction execution cycles and a loop routine B that repeatedly executes the number of times stored in the memory. Therefore, once this normal operation mode routine is executed, the execution time is the sum of the time required for the processing unit A and the time required for executing the loop routine B. At this time, if the number of times stored in the memory is changed, the processing time of the loop routine B changes, and as a result, the execution time of the normal operation mode routine changes. In the present invention, the number of times stored in the memory is set to an appropriate value by the reference signal adjustment operation mode routine. As a result, even if there is a variation in the frequency of the CR oscillation circuit, a value for correcting it is stored in the memory, so that one execution time of the normal operation mode routine is a predetermined time, that is, the frequency of the CR oscillation circuit. Can be adjusted to the time when is the correct value. By this adjustment, timer calibration is performed.
[0010]
The reference signal adjustment operation mode routine basically has the same structure as the processing unit A and loop routine B of the normal operation mode routine. That is, a processing unit B for the processing unit A and a loop routine C for the loop routine B are provided. Then, the number of times stored in the memory is changed based on a signal from the external input terminal, and a pulse having the processing time of the processing unit B and the loop routine C as one cycle is output to the external output terminal. With such a configuration, the reference signal adjustment device connected to the microcomputer is operated simultaneously. This reference signal adjusting device includes an oscillation circuit that oscillates at an accurate frequency and includes an oscillator such as ceramic or crystal. Then, a signal to increase or decrease the number of times stored in the memory or a signal to end adjustment is formed according to a comparison result of the period of the pulse from the external output terminal and the reference pulse generated in the reference signal adjustment device. This is output to the external input terminal of the microcomputer. That is, if the pulse input from the microcomputer has a longer period than the reference pulse, a signal to decrease the number of times is output so that the pulse of the microcomputer becomes shorter, and vice versa. Output a signal. When the two match, a signal to end adjustment is output.
[0011]
In the microcomputer, when the number of times is changed in order to change the number of times stored in the memory based on the signal from the reference signal adjustment device or to complete the adjustment, the reference signal adjustment device is The period of the output pulse is also changed. In this way, by exchanging between the two, a signal to be adjusted is finally returned from the reference signal adjusting device to the microcomputer. In the reference signal adjustment operation mode routine of the microcomputer, the adjustment end operation is performed when a signal to end the adjustment is received. The number of times stored in the memory at this time is obtained by correcting the frequency variation of the CR oscillation circuit. Thereafter, by storing this value in the non-volatile memory, it is possible to count the accurate timer count time even in the CR oscillation circuit thereafter.
[0012]
DETAILED DESCRIPTION OF THE INVENTION
FIG. 1 is a block diagram of a timer calibration system according to an embodiment of the present invention.
The
[0013]
The
[0014]
SIGOUT: A pulse signal is output during execution of the reference signal adjustment operation mode routine.
[0015]
FUPIN: A frequency up signal is input from the reference
[0016]
FDNIN: A frequency down signal is input from the reference
[0017]
FSIGIN: An adjustment end signal is input from the reference
[0018]
MODE: An operation mode switching signal indicating whether the operation mode is the normal operation mode or the reference signal adjustment operation mode is input. This operation mode switching signal can be set to the normal operation mode by setting the reference signal adjustment operation mode by connecting to the GND level and disconnecting the operation mode switching signal, for example.
[0019]
The reference signal adjustment operation mode is normally performed once before the
[0020]
The external input terminal of the present invention corresponds to the FUPIN, FDNIN, and FSIGIN terminals of the
[0021]
Next, operations of the
[0022]
2 and 3 are flowcharts showing the operation of the
[0023]
In
[0024]
In the normal operation mode, first, in
[0025]
In the above processing, the number of instruction execution cycles in the processing A is fixed to 470 cycles. In the loop routine of
[0026]
When the operation mode switching signal is “H”, the process proceeds from
[0027]
The basic structure of this mode is basically the same as that of the normal operation mode routine. That is, the process A of
[0028]
First, in
[0029]
In
[0030]
That is, when the input terminal FUPIN is “H” (indicating that the current CR oscillation frequency should be increased as will be described later), the number of times stored in the memory mem1 is decremented in
[0031]
[0032]
In steps 22, 25 and 28, when each external input terminal is “L”, the contents of the memory mem1 are not changed, and the process proceeds to step 40 (see FIG. 3). In
[0033]
The total number of instruction execution cycles in process B from
[0034]
Subsequently, in the loop routine C of
[0035]
FIG. 4 is a flowchart showing the operation of the reference
[0036]
In
[0037]
As described above, when the operation mode switching signal becomes “H” and the reference signal adjustment operation mode is entered, the reference signal adjustment operation mode
[0038]
When the adjustment is completed, the operation mode switching signal is set to “L”. Thereafter, the normal operation mode routine in
[0039]
The adjustment operation will be described below using specific numerical values.
[0040]
The operating frequency of the microcomputer is 800 kHz, and the number of instruction cycles is 8 clocks.
[0041]
When the adjustment operation is performed under the above conditions, when the operation is first started with the memory mem1 = 129 (step 20), the cycle of the pulse output from the SIGOUT at this time is
235 + 235 + 12 + 4 × 129 + 2 = 1000 cycles 1000 × 8/800000 = 0.01 s
And the period is 10 ms. In this case, if the reference period is 8 ms, the external input terminal FUPIN on the
235 + 235 + 12 + 4 × 79 + 2 = 800 cycles 800 × 8/800000 = 0.008 s
And coincides with the reference period of 8 ms. At this stage, the adjustment operation ends.
[0042]
【The invention's effect】
According to the present invention, since it is not necessary to add a function for counting the reference signal to the microcomputer side, there is an advantage that the program for that purpose does not become long. Further, since the adjustment resolution is the time required for one processing of the loop routine C, highly accurate timer calibration can be performed.
[Brief description of the drawings]
FIG. 1 is a configuration diagram of a timer calibration system for a microcomputer according to an embodiment of the present invention. FIG. 2 is a flowchart showing an operation of a main part of a control device. Flow chart showing the operation of the main part of the reference signal adjustment device
Claims (1)
前記プログラムは、
所定の命令実行サイクル数の処理部Aと、メモリに記憶されている回数分だけ繰り返し実行するループルーチンBとを備える通常動作モードルーチンと、
前記処理部Aと同じ命令実行サイクル数を持ち、外部入力端子からの信号に基づいて前記メモリに記憶されている回数を変更し、または調整終了動作をする処理部Bと、前記ループルーチンBと同じルーチン構造を持つループルーチンCと、前記処理部Bおよび前記ループルーチンCの処理時間を1周期とするパルスを外部出力端子に出力するステップと、を備える基準信号調整動作モードルーチンと、からなり、
前記外部出力端子と前記外部入力端子に接続され、該外部出力端子からのパルスと基準パルスとの周期の比較結果に応じて前記回数を増減すべき信号または調整を終了すべき信号を前記外部入力端子に出力する基準信号調整装置を設けたことを特徴とする、マイクロコンピュータのタイマ校正システムIn a timer calibration system for a microcomputer that includes a CR oscillation circuit that forms an operation clock signal and includes a timer count program that counts a timer count time by adding the number of instruction execution cycles,
The program is
A normal operation mode routine comprising a processing unit A having a predetermined number of instruction execution cycles and a loop routine B that repeatedly executes as many times as stored in the memory;
A processing unit B having the same number of instruction execution cycles as the processing unit A, changing the number of times stored in the memory based on a signal from an external input terminal, or performing an adjustment end operation; and the loop routine B; A loop routine C having the same routine structure, and a step of outputting to the external output terminal a pulse having the processing time of the processing unit B and the loop routine C as one cycle, and a reference signal adjustment operation mode routine. ,
The external input terminal is connected to the external output terminal and the external input terminal, and a signal to increase or decrease the number of times or a signal to end the adjustment according to a comparison result of the period of a pulse from the external output terminal and a reference pulse A timer calibration system for a microcomputer, characterized in that a reference signal adjustment device for output to a terminal is provided
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2001004046A JP3611788B2 (en) | 2001-01-11 | 2001-01-11 | Microcomputer timer calibration system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2001004046A JP3611788B2 (en) | 2001-01-11 | 2001-01-11 | Microcomputer timer calibration system |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2002207532A JP2002207532A (en) | 2002-07-26 |
JP3611788B2 true JP3611788B2 (en) | 2005-01-19 |
Family
ID=18872287
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2001004046A Expired - Fee Related JP3611788B2 (en) | 2001-01-11 | 2001-01-11 | Microcomputer timer calibration system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3611788B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE112012007106B4 (en) | 2012-11-05 | 2021-11-11 | Mitsubishi Electric Corporation | Active vibration disturbance control device |
-
2001
- 2001-01-11 JP JP2001004046A patent/JP3611788B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2002207532A (en) | 2002-07-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TW456102B (en) | Calibrating functions of an integrated circuit and storing calibrating parameters thereof in a programmable fuse array and a method of adjusting parameters | |
US6084441A (en) | Apparatus for and method of processing data | |
EP0590607B1 (en) | Low-power baud rate generator | |
JP2885112B2 (en) | Semiconductor integrated circuit | |
US20030137356A1 (en) | Highly stable integrated time reference | |
CN107769774A (en) | The oscillator arrangement and correlation technique of precision with raising | |
CN112148064A (en) | Semiconductor chip and control method thereof | |
JP3611788B2 (en) | Microcomputer timer calibration system | |
WO2006106917A1 (en) | Timer circuit, mobile communication terminal using the same, and electronic device using the same | |
JP2000341092A (en) | Clock signal generating circuit and clock frequency adjustment method | |
CN109617528B (en) | Method and system for correcting frequency of active oscillator | |
CN112737574A (en) | Timing calibration method of chip internal clock source and related device | |
JP3584821B2 (en) | Microcomputer with built-in CR oscillation clock | |
JP3112862B2 (en) | Information processing device | |
JPH08139575A (en) | Pulse output circuit | |
JPH04102910A (en) | Microcomputer | |
CN102130680B (en) | Temperature compensation type crystal oscillator and communication method thereof | |
JP7503683B2 (en) | Integrated Circuits | |
JP4036114B2 (en) | Clock generation circuit | |
JPS59225323A (en) | Electronic thermometer | |
JP4724520B2 (en) | Sensor device | |
JPH10255489A (en) | Microcomputer | |
JPH0366847B2 (en) | ||
JP5037755B2 (en) | Temperature change measuring apparatus and method | |
JP2002183110A (en) | Microcomputer and counting processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20040910 |
|
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: 20041005 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20041020 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 Ref document number: 3611788 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20091029 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111029 Year of fee payment: 7 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111029 Year of fee payment: 7 |
|
S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111029 Year of fee payment: 7 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111029 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111029 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121029 Year of fee payment: 8 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121029 Year of fee payment: 8 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121029 Year of fee payment: 8 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131029 Year of fee payment: 9 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131029 Year of fee payment: 9 |
|
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 |
|
S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
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 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |