JP2803389B2 - Timer device - Google Patents

Timer device

Info

Publication number
JP2803389B2
JP2803389B2 JP3110038A JP11003891A JP2803389B2 JP 2803389 B2 JP2803389 B2 JP 2803389B2 JP 3110038 A JP3110038 A JP 3110038A JP 11003891 A JP11003891 A JP 11003891A JP 2803389 B2 JP2803389 B2 JP 2803389B2
Authority
JP
Japan
Prior art keywords
timer
output
counting
comparison
input
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
Application number
JP3110038A
Other languages
Japanese (ja)
Other versions
JPH04337920A (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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP3110038A priority Critical patent/JP2803389B2/en
Publication of JPH04337920A publication Critical patent/JPH04337920A/en
Application granted granted Critical
Publication of JP2803389B2 publication Critical patent/JP2803389B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Electronic Switches (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明は、外部イベントあるいは
内部のクロックを計数し、所定の設定値との一致に基づ
いて信号を出力するタイマ装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a timer device for counting an external event or an internal clock and outputting a signal based on a coincidence with a predetermined set value.

【0002】[0002]

【従来の技術】従来例について、図4を参照して説明す
る。
2. Description of the Related Art A conventional example will be described with reference to FIG.

【0003】タイマ装置400は、外部からのイベント
入力をカウントするイベント・カウンタ401と、内部
のクロックをカウントするタイマ402と、イベント・
カウンタ401及びタイマ402との一致タイミングを
設定する比較レジスタ102,103と、イベント・カ
ウンタ401及びタイマ402の値と比較レジスタ10
2,103との内容の一致を検出する比較器104,1
05と、比較器104,105からの一致出力によりセ
ット,リセットされるタイマ出力レジスタ106から、
構成されている。
The timer device 400 includes an event counter 401 for counting an external event input, a timer 402 for counting an internal clock, and an event counter 401.
Comparison registers 102 and 103 for setting the coincidence timing between the counter 401 and the timer 402;
Comparator 104,1 which detects the coincidence of the contents with 2,103
05 and a timer output register 106 set and reset by the coincidence output from the comparators 104 and 105,
It is configured.

【0004】比較器104,105からは、タイマ出力
レジスタ106に対するセット信号104−1とリセッ
ト信号105−1が出力される。
The comparators 104 and 105 output a set signal 104-1 and a reset signal 105-1 for the timer output register 106.

【0005】以下に、所定数の外部イベントカウント入
力後セットされ、所定数の内部クロックカウント入力後
リセットされる波形を、タイマ出力レジスタ106から
出力する場合について述べる。
Hereinafter, a case will be described in which a timer output register 106 outputs a waveform that is set after a predetermined number of external event counts are input and reset after a predetermined number of internal clock counts are input.

【0006】セットされる迄の外部イベントカウント数
を比較レジスタ102に、セットされてからリセットさ
れる迄の内部クロックカウント数を比較レジスタ103
に設定して、イベント・カウンタ401をスタートさせ
る。
The external event count until set is stored in a comparison register 102, and the internal clock count from set to reset is stored in a comparison register 103.
And the event counter 401 is started.

【0007】イベント・カウンタ401と比較レジスタ
102の内容が一致すると、比較器104からセット信
号104−1が出力され、タイマ出力レジスタ106の
出力がセットされると共に、タイマ402の内容を
“0”にクリアし、カウントをスタートする。タイマ4
02の内容と比較レジスタ103の内容が一致すると、
比較器105からリセット信号105−1が出力され、
タイマ出力レジスタ106の出力がリセットされる。
When the contents of the event counter 401 and the contents of the comparison register 102 match, a set signal 104-1 is output from the comparator 104, the output of the timer output register 106 is set, and the contents of the timer 402 are set to "0". And start counting. Timer 4
02 and the contents of the comparison register 103 match,
A reset signal 105-1 is output from the comparator 105,
The output of the timer output register 106 is reset.

【0008】上記動作を繰り返す事により、異なるクロ
ックソースで波形のハイ幅,ロウ幅を指定したタイマ出
力を実現する。
By repeating the above operation, a timer output in which a high width and a low width of a waveform are designated by different clock sources is realized.

【0009】[0009]

【発明が解決しようとする課題】上述した従来のタイマ
装置では、異なる計数ソースでカウントした計数結果に
より、出力波形のセット,リセットタイミングを制御す
る場合には、2本のタイマ/カウンタを用いてタイマ/
カウンタ間の同期をとることにより実現しており、ハー
ドウェア上の負担が大きく、タイマ構成に汎用性がな
い、という欠点を有している。
In the above-described conventional timer device, when the output waveform set / reset timing is controlled based on the counting results counted by different counting sources, two timers / counters are used. Timer /
This is realized by synchronizing the counters, and has a drawback that the burden on hardware is large and the timer configuration is not versatile.

【0010】[0010]

【課題を解決するための手段】本発明によるタイマ装置
は、外部のイベントあるいは内部のクロックを計数する
計数手段と、計数手段の計数結果との一致タイミングを
指定する記憶手段と、計数手段と記憶手段との内容を比
較する比較手段と、比較手段からの比較結果に基づいて
出力レベルを変化する出力手段と、比較手段からの比較
結果に基づいて計数手段の計数入力信号を制御する制御
手段を有している。
SUMMARY OF THE INVENTION A timer device according to the present invention comprises a counting means for counting an external event or an internal clock, a storage means for designating a coincidence timing with the counting result of the counting means, and a storage means for storing the counting means. Comparing means for comparing the contents with the means, output means for changing the output level based on the comparison result from the comparing means, and control means for controlling the count input signal of the counting means based on the comparison result from the comparing means. Have.

【0011】[0011]

【実施例】次に、本発明の実施例について図面を参照し
て説明する。
Next, embodiments of the present invention will be described with reference to the drawings.

【0012】図1に本発明によるタイマ装置の一実施例
を示す。タイマ装置100は、内部のクロックあるいは
外部からのイベント入力をカウントするタイマ/イベン
ト・カウンタ101と、タイマ/イベント・カウンタ1
01との一致タイミングを設定する比較レジスタ10
2,103と、タイマ/イベント・カウンタ101の値
と比較レジスタ102,103との内容の一致を検出す
る比較器104,105と、比較器104,105から
の一致出力によりセット,リセットされるタイマ出力レ
ジスタ106と、比較器104,105からの一致出力
によりタイマ/イベント・カウンタ101のカウント入
力ソースを制御するタイマ入力制御部107から、構成
されている。
FIG. 1 shows an embodiment of a timer device according to the present invention. The timer device 100 includes a timer / event counter 101 for counting an internal clock or an event input from the outside, and a timer / event counter 1
Comparison register 10 for setting the coincidence timing with 01
2 and 103, comparators 104 and 105 for detecting a match between the value of the timer / event counter 101 and the contents of the comparison registers 102 and 103, and a timer set and reset by the match output from the comparators 104 and 105 It comprises an output register 106 and a timer input control unit 107 for controlling the count input source of the timer / event counter 101 based on coincidence outputs from the comparators 104 and 105.

【0013】比較器104,105からは、タイマ出力
レジスタ106に対するセット信号104−1とリセッ
ト信号105−1が出力される。
The comparators 104 and 105 output a set signal 104-1 and a reset signal 105-1 for the timer output register 106.

【0014】タイマ入力制御部107には、セット信号
104−1,リセット信号105−1が入力されると共
に、内部クロック入力107−1と外部イベント入力1
07−2が、タイマ/イベント・カウンタ101へのカ
ウント入力ソースとして入力されており、タイマ入力制
御部107からは、タイマ/イベント・カウンタ101
へのカウントクロック107−3とクリア信号107−
4が出力されている。
The set signal 104-1 and the reset signal 105-1 are input to the timer input control unit 107, and the internal clock input 107-1 and the external event input 1 are input to the timer input control unit 107.
07-2 is input as a count input source to the timer / event counter 101, and the timer / event counter 101
Clock 107-3 and clear signal 107-
4 is output.

【0015】以下に、所定数の外部イベントカウント入
力後セットされ、所定数の内部クロックカウント入力後
リセットされる波形を、タイマ出力レジスタ106から
出力する場合について述べる。
Hereinafter, a case will be described in which a timer output register 106 outputs a waveform that is set after a predetermined number of external event counts are input and reset after a predetermined number of internal clock counts are input.

【0016】セットされる迄の外部イベントカウント数
を比較レジスタ102に、セットされてからリセットさ
れる迄の内部クロックカウント数を比較レジスタ103
に設定して、タイマ/イベント・カウンタ101をイベ
ントカウント動作でスタートさせる。
The number of external event counts before being set is stored in a comparison register 102, and the number of internal clock counts from being set until reset is stored in a comparison register 103.
And the timer / event counter 101 is started by the event counting operation.

【0017】タイマ/イベント・カウンタ101と比較
レジスタ102の内容が一致すると、比較器104から
セット信号104−1が出力され、タイマ出力レジスタ
106の出力がセットされると共に、タイマ入力制御部
107は、タイマ/イベント・カウンタ101の内容を
“0”にクリアし、入力クロックソースを内部クロック
に切り替える。これにより、タイマ/イベント・カウン
タ101は、内部クロックのカウントを開始し、比較レ
ジスタ103の内容と一致すると、比較器105からリ
セット信号105−1が出力され、タイマ出力レジスタ
106の出力がリセットされると共に、タイマ入力制御
部107は、タイマ/イベント・カウンタ101の内容
を“0”にクリアし、入力クロックソースをイベント入
力に切り替える。
When the contents of the timer / event counter 101 and the comparison register 102 match, a set signal 104-1 is output from the comparator 104, the output of the timer output register 106 is set, and the timer input control unit 107 Then, the contents of the timer / event counter 101 are cleared to "0" and the input clock source is switched to the internal clock. As a result, the timer / event counter 101 starts counting the internal clock, and when the count matches the content of the comparison register 103, the comparator 105 outputs the reset signal 105-1 and the output of the timer output register 106 is reset. At the same time, the timer input control unit 107 clears the content of the timer / event counter 101 to “0” and switches the input clock source to the event input.

【0018】上記動作を繰り返す事により、異なるクロ
ックソースで波形のハイ幅,ロウ幅を指定したタイマ出
力を実現する。
By repeating the above operation, a timer output in which the high width and the low width of the waveform are designated by different clock sources is realized.

【0019】第2図に本発明によるタイマ装置の他の実
施例を示す。
FIG. 2 shows another embodiment of the timer device according to the present invention.

【0020】タイマ装置200は、内部のクロックある
いは外部からのイベント入力をカウントするタイマ/イ
ベント・カウンタ101と、タイマ/イベント・カウン
タ101との一致タイミングを設定する比較レジスタ1
02,103と、タイマ/イベント・カウンタ101の
値と比較レジスタ102,103との内容の一致を検出
する比較器104,105と、比較器104,105か
らの一致出力によりセット,リセットされるタイマ出力
レジスタ106と、比較器104,105からの一致出
力によりタイマ/イベント・カウンタ101のカウント
入力ソースを制御するタイマ入力制御部201から、構
成されている。
The timer device 200 includes a timer / event counter 101 for counting an internal clock or an event input from the outside, and a comparison register 1 for setting coincidence timing between the timer / event counter 101 and the timer / event counter 101.
02, 103, comparators 104, 105 for detecting a match between the value of the timer / event counter 101 and the contents of the comparison registers 102, 103, and a timer set and reset by the match output from the comparators 104, 105 It comprises an output register 106 and a timer input control unit 201 for controlling the count input source of the timer / event counter 101 based on coincidence outputs from the comparators 104 and 105.

【0021】比較器104,105からは、タイマ出力
レジスタ106に対するセット信号104−1とリセッ
ト信号105−1が出力される。
The comparators 104 and 105 output a set signal 104-1 and a reset signal 105-1 for the timer output register 106.

【0022】タイマ入力制御部201には、セット信号
104−1,リセット信号105−1が入力されると共
に、内部クロック入力201−1と外部イベント入力2
01−2が、タイマ/イベント・カウンタ101へのカ
ウント入力ソースとして入力されており、タイマ入力制
御部201からは、タイマ/イベント・カウンタ101
へのカウントクロック201−3とクリア信号201−
4が出力されている。
The set signal 104-1 and the reset signal 105-1 are input to the timer input control unit 201, and the internal clock input 201-1 and the external event input 2 are input to the timer input control unit 201.
0-1 is input as a count input source to the timer / event counter 101, and the timer / event counter 101
Clock 201-3 and clear signal 201-
4 is output.

【0023】タイマ入力制御部201は、セットタイミ
ング・クロックソース指定レジスタ201−5と、リセ
ットタイミング・クロックソース指定レジスタ201−
6を有している。
The timer input control unit 201 comprises a set timing / clock source designation register 201-5 and a reset timing / clock source designation register 201-
6.

【0024】セットタイミング・クロックソース指定レ
ジスタ201−5にイベント入力を設定し、リセットタ
イミング・クロックソース指定レジスタ201−6に内
部クロックを設定する事により、タイマ出力レジスタ1
06は、実施例1で述べた、所定数の外部イベントカウ
ント入力後セットされ、所定数の内部クロックカウント
入力後リセットされる波形を出力する。
By setting an event input in the set timing / clock source designation register 201-5 and setting an internal clock in the reset timing / clock source designation register 201-6, the timer output register 1 is set.
Reference numeral 06 denotes a waveform which is set after the input of the predetermined number of external event counts and reset after the input of the predetermined number of internal clocks described in the first embodiment.

【0025】以下に、セットタイミング・クロックソー
ス指定レジスタ201−5とリセットタイミング・クロ
ックソース指定レジスタ201−6に同一のクロックソ
ース、例えば内部クロックを設定した場合の動作を示
す。
The operation when the same clock source, for example, an internal clock is set in the set timing / clock source designation register 201-5 and the reset timing / clock source designation register 201-6 will be described below.

【0026】セットされる迄の内部クロックカウント数
を比較レジスタ102に、出力波形の周期に相当するリ
セットされる迄の内部クロックカウント数を比較レジス
タ103に設定して、タイマ/イベント・カウンタ10
1をタイマ動作でスタートさせる。
The internal clock count until set is set in the comparison register 102, and the internal clock count until reset corresponding to the cycle of the output waveform is set in the comparison register 103.
1 is started by a timer operation.

【0027】タイマ/イベント・カウンタ101と比較
レジスタ102の内容が一致すると、比較器104から
セット信号104−1が出力されて、タイマ出力レジス
タ106の出力がセットされる。この場合、タイマ/イ
ベント・カウンタ101の値はクリアしない。タイマ/
イベント・カウンタ101が比較レジスタ103の内容
と一致すると、比較器105からリセット信号105−
1が出力されて、タイマ出力レジスタ106の出力がリ
セットされると共に、タイマ入力制御部201は、タイ
マ/イベント・カウンタ101の内容を“0”にクリア
する。
When the contents of the timer / event counter 101 and the comparison register 102 match, the set signal 104-1 is output from the comparator 104, and the output of the timer output register 106 is set. In this case, the value of the timer / event counter 101 is not cleared. Timer /
When the event counter 101 matches the content of the comparison register 103, the comparator 105 outputs a reset signal 105-
1 is output, the output of the timer output register 106 is reset, and the timer input control unit 201 clears the content of the timer / event counter 101 to “0”.

【0028】上記動作を繰り返す事により、同一のクロ
ックソースでPWM波形を実現する。
By repeating the above operation, a PWM waveform is realized with the same clock source.

【0029】図3に、比較レジスタ102に“A”を、
比較レジスタ103に“B”を設定したときの実施例1
と実施例2で述べた波形を示す。
FIG. 3 shows "A" in the comparison register 102,
Embodiment 1 when “B” is set in the comparison register 103
And the waveforms described in the second embodiment.

【0030】[0030]

【発明の効果】以上説明した様に本発明は、比較レジス
タとの一致により出力を制御するタイマ装置において、
異なる計数ソースでカウントした計数結果により、セッ
トタイミング及びリセットタイミングが制御された波形
を出力する場合に、1本のタイマ/イベント・カウンタ
のクロック入力ソースを、タイマ出力のセット,リセッ
トタイミングに同期して切り替える事により実現してお
り、従来に比べてハードウェア量の削減が図れると共
に、通常のPWM出力にも対応できる汎用性の高いタイ
マ装置を提供している。
As described above, the present invention relates to a timer device for controlling an output based on a match with a comparison register.
When outputting a waveform in which the set timing and the reset timing are controlled by the counting results counted by different counting sources, the clock input source of one timer / event counter is synchronized with the set and reset timing of the timer output. The present invention provides a highly versatile timer device that can reduce the amount of hardware compared to the related art and can also handle ordinary PWM output.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の第1の実施例のブロック図である。FIG. 1 is a block diagram of a first embodiment of the present invention.

【図2】本発明の第2の実施例のブロック図である。FIG. 2 is a block diagram of a second embodiment of the present invention.

【図3】本発明の第1の実施例及び第2の実施例の波形
出力図である。
FIG. 3 is a waveform output diagram of the first embodiment and the second embodiment of the present invention.

【図4】従来例のブロック図である。FIG. 4 is a block diagram of a conventional example.

【符号の説明】[Explanation of symbols]

201−6 リセットタイミング・クロックソース指
定レジスタ 400 タイマ装置 401 イベントカウンタ 402 タイマ
201-6 Reset timing / clock source specification register 400 Timer device 401 Event counter 402 Timer

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 外部のイベントあるいは内部のクロック
を計数する計数手段と、前記計数手段の計数結果との一
致タイミングを指定する記憶手段と、前記計数手段と前
記記憶手段との内容を比較する比較手段と、前記比較手
段からの比較結果に基づいて出力レベルを変化する出力
手段とを有するタイマ装置において、前記比較手段から
の比較結果に基づいて前記計数手段の計数入力信号を制
御する制御手段をさらに有し、前記制御手段が、前記比
較手段からの比較結果に基づいて前記計数手段の計数入
力信号を切り替える事により、異なる計数入力の計数結
果によって前記出力手段の出力波形を制御する事を特徴
とするタイマ装置。
1. A counting means for counting an external event or an internal clock, a storage means for designating a coincidence timing with a counting result of the counting means, and a comparison for comparing the contents of the counting means and the storage means. Means, and a timer device having an output means for changing an output level based on a comparison result from the comparison means, wherein the control means controls a count input signal of the counting means based on the comparison result from the comparison means. The control means switches the count input signal of the counting means based on the comparison result from the comparison means, thereby controlling the output waveform of the output means according to the counting results of different count inputs. And a timer device.
JP3110038A 1991-05-15 1991-05-15 Timer device Expired - Fee Related JP2803389B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3110038A JP2803389B2 (en) 1991-05-15 1991-05-15 Timer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3110038A JP2803389B2 (en) 1991-05-15 1991-05-15 Timer device

Publications (2)

Publication Number Publication Date
JPH04337920A JPH04337920A (en) 1992-11-25
JP2803389B2 true JP2803389B2 (en) 1998-09-24

Family

ID=14525539

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3110038A Expired - Fee Related JP2803389B2 (en) 1991-05-15 1991-05-15 Timer device

Country Status (1)

Country Link
JP (1) JP2803389B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2695546B2 (en) * 1991-07-24 1997-12-24 三菱電機株式会社 Microcomputer built-in count source automatic change timer

Also Published As

Publication number Publication date
JPH04337920A (en) 1992-11-25

Similar Documents

Publication Publication Date Title
JP2803389B2 (en) Timer device
JP2773546B2 (en) Pulse generation circuit
US4462031A (en) Traffic synchronization device
JPS6316711A (en) Timing device
JPH02170088A (en) Timepiece circuit
JPH0246208Y2 (en)
JP2898774B2 (en) Pulse generator
JPH041515Y2 (en)
JP2754654B2 (en) Microcomputer output control circuit
JPH03263995A (en) Pilot burst gate pulse generating device
JPH02310628A (en) Interruption circuit for micro computer
JPH0514186A (en) Pulse width modulation circuit
JPS6057736B2 (en) A-D converter
JPS597819Y2 (en) Burst signal processing circuit
JPH02250674A (en) On delay circuit for inverter
SU1499439A1 (en) Programmable shaper of time intervals
JPS58137325A (en) Pulse delay device
JP2658126B2 (en) Input frequency generator
KR19980020699A (en) Interrupt generation circuit
JPS6240825A (en) Programmable delaying/frequency-dividing circuit
JPS63153911A (en) Pulse output device
JPH02284386A (en) Stroboscope controlling device
JPH0476530B2 (en)
JPH05316738A (en) Circuit for controlling inverter
JPH0429894U (en)

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19980616

LAPS Cancellation because of no payment of annual fees