JP2648003B2 - Timer counter - Google Patents
Timer counterInfo
- Publication number
- JP2648003B2 JP2648003B2 JP2233071A JP23307190A JP2648003B2 JP 2648003 B2 JP2648003 B2 JP 2648003B2 JP 2233071 A JP2233071 A JP 2233071A JP 23307190 A JP23307190 A JP 23307190A JP 2648003 B2 JP2648003 B2 JP 2648003B2
- Authority
- JP
- Japan
- Prior art keywords
- counter
- comparison value
- comparison
- setting register
- value setting
- 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
Landscapes
- Electronic Switches (AREA)
Description
【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、タイマカウンタに関し、特にマイクロコン
ピュータ等に内蔵されるプログラマブルなタイマカウン
タに関する。Description: TECHNICAL FIELD The present invention relates to a timer counter, and more particularly, to a programmable timer counter built in a microcomputer or the like.
従来、ワンチップマイクロコンピュータ等に内蔵され
るタイマカウンタは、種々のものがあるが、ここで取上
げる計測時間をソフトウェアにより設定できるものの一
例を第3図に示す。Conventionally, there are various types of timer counters built in a one-chip microcomputer or the like, and FIG. 3 shows an example of a type in which the measurement time taken here can be set by software.
第3図を参照すると、従来のタイマカウンタは、クロ
ックパルスCLKにより動作する所定ビット長のカウンタ
1と、カウンタ1の数値を比較値として設定するための
カウンタ1と同ビット長の比較値設定レジスタ2と、比
較値設定レジスタ2とカウンタ1との数値を比較し、双
方の一致により一致信号COを出力する比較回路3と、上
記のデータやコマンド等の入出力のための内部バス8と
から構成されていた。Referring to FIG. 3, a conventional timer counter includes a counter 1 having a predetermined bit length operated by a clock pulse CLK and a comparison value setting register having the same bit length as the counter 1 for setting the value of the counter 1 as a comparison value. 2 and a comparison circuit 3 for comparing the values of the comparison value setting register 2 and the counter 1 and outputting a coincidence signal CO when both coincide with each other, and an internal bus 8 for inputting / outputting the above data and commands. Was composed.
次に、第3図に示す従来のタイマカウンタの動作につ
いて説明する。Next, the operation of the conventional timer counter shown in FIG. 3 will be described.
まず、内部バス8を介して、カウンタ1の計測時間の
数値を比較値Bとして比較値設定レジスタ2に格納す
る。First, the value of the measurement time of the counter 1 is stored as the comparison value B in the comparison value setting register 2 via the internal bus 8.
次に、カウンタ初期化信号INがカウンタ1に印加され
ると、カウンタ1は初期化され、すなわち、リセットさ
れるとともに、クロックパルスCLKをカウントし始め
る。カウンタ1の計数値出力Aと比較値設定レジスタ2
の比較値Bとが一致すると、比較回路3は一致信号COを
出力し、これは、タイマ出力TOとしてマイクロコンピュ
ータの割込み信号等に使用されていた。Next, when the counter initialization signal IN is applied to the counter 1, the counter 1 is initialized, that is, reset, and starts counting the clock pulse CLK. Count value output A of counter 1 and comparison value setting register 2
When the comparison value B coincides with the comparison value B, the comparison circuit 3 outputs a coincidence signal CO, which is used as a timer output TO for an interrupt signal or the like of the microcomputer.
上述した従来のタイマカウンタは、計測時間の最大値
が、カウンタ1のビット長で制限されるという欠点があ
った。The conventional timer counter described above has a disadvantage that the maximum value of the measurement time is limited by the bit length of the counter 1.
この種のタイマカウンタを備えるワンチップマイクロ
コンピュータは、様々に応用されており、それらの応用
における時間計測の要求内容も様々であるので、計測時
間の制限により応用範囲が制約されるという欠点があっ
た。One-chip microcomputers equipped with this kind of timer counter have been applied to various applications, and the requirements for time measurement in those applications are also various. Therefore, there is a drawback that the application range is restricted by the limitation of the measurement time. Was.
本発明のタイマカウンタは、クロックパルスを計数する
第一のカウンタと、 予め定められた値を比較値として設定するカウンタと
して動作可能な記憶手段と、 前記第一のカウンタの計数値と前記記憶手段に設定さ
れた前記比較値を比較して一致した場合一致信号を出力
する比較器と、 外部制御信号により前期記憶手段をカウンタとして前
記クロックパルスをカウントするよう設定するとともに
前記記憶手段を前記第一のカウンタと直列に動作するよ
う設定する動作様態切替手段を有するものである。The timer counter of the present invention includes: a first counter that counts clock pulses; a storage unit that can operate as a counter that sets a predetermined value as a comparison value; a count value of the first counter and the storage unit A comparator that outputs a match signal when the comparison values are set to match, and sets an external control signal to count the clock pulse using the first storage unit as a counter and set the storage unit to the first storage unit. Operation mode switching means for setting to operate in series with the above counter.
次に、本発明について図面を参照して説明する。 Next, the present invention will be described with reference to the drawings.
第1図は、本発明の第一の実施例を示す回路図であ
る。FIG. 1 is a circuit diagram showing a first embodiment of the present invention.
第1図を参照すると、本発明のタイマカウンタは、従
来の例と同様の、クロックパルスCLKにより動作する所
定ビット長のカウンタ1と、カウンタ1の数値を比較値
として設定するためのカウンタ1と同ビット長の比較値
設定レジスタ2と、比較値設定レジスタ2とカウンタ1
との数値を比較し、双方の一致により一致信号COを出力
する比較回路3と、上記のデータやコマンド等の入出力
のための内部バス8とから構成される部分に加えて、次
のものが追加されている。Referring to FIG. 1, a timer counter according to the present invention includes a counter 1 having a predetermined bit length operated by a clock pulse CLK and a counter 1 for setting a numerical value of the counter 1 as a comparison value, as in the conventional example. Comparison value setting register 2 having the same bit length, comparison value setting register 2 and counter 1
In addition to the portion composed of the comparison circuit 3 for comparing the two values and outputting a coincidence signal CO when the two coincide with each other, and the internal bus 8 for inputting and outputting data and commands, the following: Has been added.
すなわち、クロックパルスCLKを比較値設定レジスタ
2に対しオン・オフするための第1切替回路4と、カウ
ンタ1の計数パルス入力を、クロックパルスCLKと比較
値設定レジスタ2からのオーバフロー出力信号OF2とを
切替えるための第2切替回路5と、タイマカウンタの出
力TOを、比較回路3の出力COと、カウンタ1からのオー
バフロー出力信号とを切替える第3切替回路6と、内部
バス8を介してプログラムを設定され、第1〜第3切替
回路4〜6を制御するレジスタであるモードレジスタ7
とである。That is, the first switching circuit 4 for turning on / off the clock pulse CLK with respect to the comparison value setting register 2, and the counting pulse input of the counter 1 are connected to the clock pulse CLK and the overflow output signal OF 2 from the comparison value setting register 2. A second switching circuit 5 for switching the output TO of the timer counter, an output CO of the comparison circuit 3 and an overflow output signal from the counter 1, and a program via the internal bus 8. Mode register 7 which is a register for controlling the first to third switching circuits 4 to 6
And
なお、比較値設定レジスタ2は、基本的には、周知の
並列入力シフトレジスタであり、比較値設定時には、デ
ータを並列に入力するが、クロックパルスCLKを印加す
ることによりカウンタとして動作するものである。The comparison value setting register 2 is basically a well-known parallel input shift register, which inputs data in parallel when setting a comparison value, but operates as a counter by applying a clock pulse CLK. is there.
次に、本実施例の動作について説明する。 Next, the operation of the present embodiment will be described.
まず、モードレジスタ7に「0」が書込みされた場合
について説明する。First, a case where “0” is written to the mode register 7 will be described.
この場合は、タイマカウンタはプログラムモードとな
り、第1切替回路4はオフ、第2切替回路5はクロック
パルスCLKに、第3切替回路6は比較回路出力COにそれ
ぞれ切替えられる。In this case, the timer counter enters the program mode, the first switching circuit 4 is turned off, the second switching circuit 5 is switched to the clock pulse CLK, and the third switching circuit 6 is switched to the comparison circuit output CO.
したがって、この場合は前述の従来例と同一であり、
説明が重複するので冗長とならないよう省略する。Therefore, this case is the same as the above-mentioned conventional example,
Since the description is duplicated, it is omitted so as not to be redundant.
次に、モードレジスタ7に「1」が書込みされた場合
について説明する。Next, a case where "1" is written to the mode register 7 will be described.
この場合は、タイマカウンタは延長計時モードとな
り、第1切替回路4はオン、第2切替回路5は比較値設
定レジスタ2からのオーバフロー出力信号OF2に、第3
切替回路6はカウンタ1からのオーバフロー出力信号OF
1にそれぞれ切替えられる。In this case, the timer counter is set to the extension timekeeping mode, the first switching circuit 4 is turned on, and the second switching circuit 5 outputs the third signal to the overflow output signal OF2 from the comparison value setting register 2.
The switching circuit 6 outputs the overflow output signal OF from the counter 1
Each can be switched to 1.
したがって、比較値設定設定レジスタ2はカウンタと
して動作し、カウンタ1にはクロックパルスの代りに比
較値設定レジスタ2をカウンタとして動作させた場合の
オーバフロー出力信号OF2が印加されるので、比較値設
定レジスタ2とカウンタ1とは、直列に接続されたこと
になる。前述のように、カウンタ1と比較値設定レジス
タ2のビット長は同一であるので、結果として、ビット
長が2倍のカウンタが得られたことになる。Therefore, the comparison value setting register 2 operates as a counter, and the counter 1 receives the overflow output signal OF2 when the comparison value setting register 2 operates as a counter instead of the clock pulse. 2 and the counter 1 are connected in series. As described above, since the bit lengths of the counter 1 and the comparison value setting register 2 are the same, a counter having a double bit length is obtained as a result.
タイマカウンタの出力は、カウンタ1のオーバフロー
出力信号OF1となる。The output of the timer counter becomes the overflow output signal OF1 of the counter 1.
次に、本発明の第二の実施例について説明する。 Next, a second embodiment of the present invention will be described.
第2図は、本発明の第二の実施例を示す回路図であ
る。FIG. 2 is a circuit diagram showing a second embodiment of the present invention.
第1図に示す第一の実施例との相異点は、第1〜第3
切替回路4〜6を制御するレジスタであるモードレジス
タ7の代りに、外部入力端子TSを設け、外部からのモー
ド制御信号で、上記の各切替回路を制御することであ
る。The difference from the first embodiment shown in FIG.
An external input terminal TS is provided instead of the mode register 7 which is a register for controlling the switching circuits 4 to 6, and the above switching circuits are controlled by a mode control signal from the outside.
他の部分については、第一の実施例と同一であり、説
明が重複するので冗長とならないよう省略する。The other parts are the same as those of the first embodiment, and the description will be duplicated.
以上、本発明の実施例を説明したが、本発明は上記実
施例に限られることなく種々の変形が可能である。The embodiments of the present invention have been described above, but the present invention is not limited to the above embodiments, and various modifications can be made.
以上説明したように本発明は、延長計時が必要のとき
は、記憶手段を第二のカウンタとして動作させ、第一の
カウンタと直列に動作させることにより、カウンタの計
時長を従来に比して著しく延長できるという効果があ
る。As described above, the present invention operates the storage means as the second counter when the extension timing is required, and operates the storage means in series with the first counter, so that the time length of the counter is longer than that of the conventional counter. This has the effect that it can be significantly extended.
したがって、従来の標準的なタイマカウンタ動作と、
上記の延長計時動作の2種の動作様態を、目的に応じて
選択することができるという効果がある。Therefore, the conventional standard timer-counter operation,
There is an effect that the two kinds of operation modes of the above-mentioned extended timing operation can be selected according to the purpose.
第1図は本発明の第一の実施例を示す回路図、第2図は
本発明の第二の実施例を示す回路図、第3図は従来のタ
イマカウンタの一例を示す回路図である。 1……カウンタ、2……比較値設定レジスタ、3……比
較回路、4……第1切替回路、5……第2切替回路、6
……第3切替回路、7……モードレジスタ、8……内部
バス、TS……外部入力端子。FIG. 1 is a circuit diagram showing a first embodiment of the present invention, FIG. 2 is a circuit diagram showing a second embodiment of the present invention, and FIG. 3 is a circuit diagram showing an example of a conventional timer counter. . 1 counter, 2 comparison value setting register, 3 comparison circuit, 4 first switching circuit, 5 second switching circuit, 6
... Third switching circuit, 7... Mode register, 8... Internal bus, TS... External input terminal.
Claims (3)
め定められた値を比較値として設定し、且つカウンタと
して動作可能な比較値設定レジスタと、前記カウンタの
計数値と前記比較値設定レジスタに設定された前記比較
値を比較して一致したときに一致信号を出力する比較回
路と、制御信号により前記比較値設定レジスタをカウン
タとして前記クロックパルスをカウントするように設定
するとともに前記比較値設定レジスタを前記カウンタと
直列に動作するよう設定し、且つ前記制御信号がないと
きは前記比較回路からの前記一致信号を、前記制御信号
があるときは前記カウンタの出力信号を、タイマ信号と
してそれぞれ出力するようにすることを特徴とするタイ
マカウンタ。1. A counter for counting clock pulses, a comparison value setting register that sets a predetermined value as a comparison value and operable as a counter, and sets a count value of the counter and the comparison value setting register. A comparison circuit that compares the comparison values and outputs a coincidence signal when they match, and sets the comparison value setting register so as to count the clock pulse by using the comparison value setting register as a counter by a control signal. The counter is set to operate in series with the counter, and when there is no control signal, the coincidence signal from the comparison circuit is output, and when there is the control signal, the output signal of the counter is output as a timer signal. A timer counter.
ウンタと等しいビット長の並列シフトレジスタであるこ
とを特徴とする請求項1記載のタイマカウンタ。2. The timer counter according to claim 1, wherein the comparison value setting register is a parallel shift register having a bit length equal to that of the first counter.
ことを特徴とする請求項1記載のタイマカウンタ。3. The timer counter according to claim 1, wherein said control signal is programmed in advance.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2233071A JP2648003B2 (en) | 1990-09-03 | 1990-09-03 | Timer counter |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2233071A JP2648003B2 (en) | 1990-09-03 | 1990-09-03 | Timer counter |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPH04117718A JPH04117718A (en) | 1992-04-17 |
| JP2648003B2 true JP2648003B2 (en) | 1997-08-27 |
Family
ID=16949350
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2233071A Expired - Fee Related JP2648003B2 (en) | 1990-09-03 | 1990-09-03 | Timer counter |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2648003B2 (en) |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS5513502A (en) * | 1978-06-23 | 1980-01-30 | Fujitsu Ltd | Timer unit |
| JPH01319326A (en) * | 1988-06-21 | 1989-12-25 | Mitsubishi Electric Corp | Timer circuit |
-
1990
- 1990-09-03 JP JP2233071A patent/JP2648003B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JPH04117718A (en) | 1992-04-17 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5233638A (en) | Timer input control circuit and counter control circuit | |
| KR100264925B1 (en) | Micro computer | |
| JP2648003B2 (en) | Timer counter | |
| US5333163A (en) | IC including counter circuit and one chip microcomputer thereof | |
| JP3669750B2 (en) | Microcomputer | |
| JPH0427730B2 (en) | ||
| JPH0642233Y2 (en) | Clock correction mechanism | |
| KR940001828Y1 (en) | Signal generating circuit | |
| JP2509464Y2 (en) | D / A conversion circuit | |
| JPH063457Y2 (en) | Integrated circuit | |
| JPS6128426Y2 (en) | ||
| KR100207481B1 (en) | Detecting time adjustment equipment to detect data during desire period | |
| SU1142822A1 (en) | Timer | |
| JPS6111800Y2 (en) | ||
| JPH01280918A (en) | Interval timer | |
| JPS6343559Y2 (en) | ||
| JPH0444987B2 (en) | ||
| JPH01199395A (en) | Writing and erasing time control circuit | |
| JPS63169813A (en) | Pulse generating circuit | |
| JPS61276002A (en) | System control device | |
| JPH0322896A (en) | Inverter control device | |
| JPS6398213A (en) | Power-on reset circuit | |
| JPH054052U (en) | Waveform control circuit for IC tester | |
| JPS6419454A (en) | Programmable lsi | |
| JPS62151921A (en) | Detection circuit for digital data transition |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| 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: R313113 |
|
| 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: 20090509 Year of fee payment: 12 |
|
| LAPS | Cancellation because of no payment of annual fees |