JPS62224112A - Multi-function timer - Google Patents

Multi-function timer

Info

Publication number
JPS62224112A
JPS62224112A JP6566586A JP6566586A JPS62224112A JP S62224112 A JPS62224112 A JP S62224112A JP 6566586 A JP6566586 A JP 6566586A JP 6566586 A JP6566586 A JP 6566586A JP S62224112 A JPS62224112 A JP S62224112A
Authority
JP
Japan
Prior art keywords
prescaler
circuit
counter
output
control
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.)
Pending
Application number
JP6566586A
Other languages
Japanese (ja)
Inventor
Hiroyasu Tominaga
富永 浩安
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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP6566586A priority Critical patent/JPS62224112A/en
Publication of JPS62224112A publication Critical patent/JPS62224112A/en
Pending legal-status Critical Current

Links

Landscapes

  • Electronic Switches (AREA)

Abstract

PURPOSE:To expand the function of a timer and to select the function as required by providing a load circuit setting a desired initial value to a prescaler and a counter circuit. CONSTITUTION:Load registers 3, 4 to set an initial value to each of the prescaler 1 and the counter circuit 2 coupled therewith are provided and the initial value data is set to the load register 3, 4 and the initial value data in the load registers is set to the prescaler 1 and the counter circuit 2 by using a program of a microcomputer. The initial value is set to the prescaler 1 by the software and the prescaler 1 is controlled to function as the counter and the software selects a path through which a signal outputted from the prescaler 1 and a path through which the signal outputted not through the counter 2. Thus, the existing timer is expanded without a counter newly.

Description

【発明の詳細な説明】 [産業上の利用分野] この発明は、信号制御技術さらにはタイマの機能の制御
に適用して特に有効な技術に関するもので、例えば、マ
イクロコンピュータに内蔵されたタイマの機能の拡張及
びその機能の制御に利用して有効な技術に関する。
[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to a signal control technology and a technology that is particularly effective when applied to control the function of a timer. This invention relates to effective technology that can be used to expand and control functions.

[従来の技術] マイクロコンピュータに内蔵されるタイマは。[Conventional technology] A timer built into a microcomputer.

例えば第3図に示すように入力信号に対しそれを受け、
これを何段階かに分周した信号をつくるプリスケーラ1
.プリスケーラ1で分周された複数の信号のうち1つを
選択するマルチプレクサ5、マルチプレクサ5の出力を
受けるカウンタ回路2及びマルチプレクサ5の動作制御
のための信号を出力するコントロールレジスタ9等から
構成され、例えば周期的に所望の処理を実行させるため
のタイマ割込み信号を発生するために使用される(タイ
マー付きのマイクロコンピュータは1例えば[株]日立
製作所、1982年9月発行rS EMICONDUC
TORDATA  BOOK  8/16ビツトマイク
ロコンピユータ」第219頁参照)。
For example, as shown in Figure 3, when receiving an input signal,
Prescaler 1 creates a signal by dividing this frequency into several stages
.. It is composed of a multiplexer 5 that selects one of the plurality of signals frequency-divided by the prescaler 1, a counter circuit 2 that receives the output of the multiplexer 5, a control register 9 that outputs a signal for controlling the operation of the multiplexer 5, etc. For example, it is used to generate a timer interrupt signal to periodically execute a desired process.
(See page 219 of ``TORDATA BOOK 8/16-bit Microcomputer'').

ここで、所望の周期が設定できるような16ビツトのり
ロードタイマとしての機能も必要な場合、既存の8ビツ
トのカウンタ回路とは別個に8ビツトのカウンタを設け
て、あわせて16ビツトのりロードタイマとする方法が
考えられる。
If a function as a 16-bit load timer with a desired cycle setting is also required, an 8-bit counter is provided separately from the existing 8-bit counter circuit, and a 16-bit load timer is also required. One possible method is to do this.

[発明が解決しようとする問題点] 上記したように、新しい機能を得るために、別個のカウ
ンタ回路を設けると、半導体チップ内に占めるカウンタ
回路の割合が大きくなり、さらには、半導体チップの面
積を大きくしなければならないという不都合が生じる。
[Problems to be Solved by the Invention] As described above, if a separate counter circuit is provided in order to obtain a new function, the proportion of the counter circuit in the semiconductor chip increases, and furthermore, the area of the semiconductor chip increases. This causes the inconvenience of having to increase the size.

この発明の目的は、新たにカウンタを付加することなく
、既存のタイマの機能を拡張し、必要に応じてその機能
を選択可能にすることにある。
An object of the present invention is to extend the functions of an existing timer without adding a new counter, and to make the functions selectable as necessary.

この発明の前記ならびにそのほかの目的と新規な特徴に
ついては、本明細書の記述および添附図面から明らかに
なるであろう。
The above and other objects and novel features of the present invention will become apparent from the description of this specification and the accompanying drawings.

[問題点を解決するための手段] 本願において開示される発明のうち代表的なものの概要
を説明すれば、下記のとおりである。
[Means for Solving the Problems] Representative inventions disclosed in this application will be summarized as follows.

すなわち7プリスケーラ及びそれに結合可能にされたカ
ウンタ回路のそれぞれに初期値を設定するためのロード
レジスタを設け、上記ロードレジスタへの初期値データ
のセット及び上記ロードレジスタにおける初期値データ
の上記プリスケーラ及びカウンタ回路へのセットをマイ
クロコンピュータのプログラムによって、言い替えると
ソフトウェアによって行なうものである。
That is, a load register for setting an initial value is provided for each of the 7 prescalers and the counter circuits that can be coupled thereto, and the initial value data is set in the load register and the initial value data is transferred to the prescaler and the counter in the load register. Setting to the circuit is performed by a microcomputer program, in other words, by software.

[作用] 上記した手段によれば、ソフトウェアによってプリスケ
ーラに初期値が設定され、プリスケーラがカウンタとし
て機能するように制御されることにより、また、ソフト
ウェアによってプリスケーラから出力される信号がカウ
ンタを介して出力される経路とカウンタを介さないで出
力される経路を選択できることにより、新たにカウンタ
を付加することなく、既存のタイマを拡張するという上
記目的を達成することができる。
[Operation] According to the above-mentioned means, an initial value is set in the prescaler by the software, and the prescaler is controlled to function as a counter, and the signal output from the prescaler is outputted via the counter by the software. By being able to select a route that is output without going through a counter and a route that is output without going through a counter, it is possible to achieve the above objective of extending an existing timer without adding a new counter.

[実施例コ 第1図は、本発明をマイクロコンピュータシステムに適
用した場合の一実施例を示すブロック図である。同図に
おいて、回路符号1で示されているのは、クロック出力
回路8を介して外部もしくは内部から送出されるクロッ
クを受け、そのクロックを分周するプリスケーラである
。プリスケーラ1は、特に制限されないが8ビツトの容
量を持つようにされる。プリスケーラは、例えば、パル
スの発生回数を計数するような、カウンタとしての動作
を行なう。
[Embodiment] FIG. 1 is a block diagram showing an embodiment in which the present invention is applied to a microcomputer system. In the figure, a circuit designated by numeral 1 is a prescaler that receives a clock sent from the outside or inside via the clock output circuit 8 and divides the frequency of the clock. The prescaler 1 has a capacity of 8 bits, although this is not particularly limited. The prescaler operates as a counter, for example, counting the number of pulse occurrences.

回路符号2で示されているのは、例えば58ビツトから
なるようなカウンタ回路である。
The circuit designated by numeral 2 is a counter circuit consisting of, for example, 58 bits.

回路符号3,4で示されているのは、それぞれ。The circuits indicated by circuit symbols 3 and 4 are respectively.

プリスケーラ1、カウンタ回路2に与えられるべき初期
値がセットそれるロードレジスタである。
This is a load register in which initial values to be given to the prescaler 1 and the counter circuit 2 are set.

回路符号5で示されているのはプリスケーラ1が分周器
として機能する場合のその出力を選択するマルチプレク
サである。
Reference numeral 5 designates a multiplexer for selecting the output of prescaler 1 when it functions as a frequency divider.

回路符号6で示されているのは、プリスケーラ1、カウ
ンタ回路2のうちいずれか一方を出力する出力制御回路
である。
A circuit designated by the reference numeral 6 is an output control circuit that outputs either the prescaler 1 or the counter circuit 2.

回路符号7で示されているのは、プリスケーラ1もしく
はマルチプレクサ5の出力を制御する出力制御回路であ
る。
A circuit designated by the reference numeral 7 is an output control circuit that controls the output of the prescaler 1 or the multiplexer 5.

回路符号8で示されているのは、内部クロックもしくは
外部端子EXを介して供給される基準信号に応じてプリ
スケーラ1に供給されるべき基準クロックを出力するク
ロック出力回路である。
A circuit designated by the reference numeral 8 is a clock output circuit that outputs a reference clock to be supplied to the prescaler 1 in accordance with an internal clock or a reference signal supplied via an external terminal EX.

回路符号9で示されているのは、ロードレジスタ3,4
、マルチプレクサ5、マルチプレクサ出力回路6、出力
回路7、クロック出力回路を制御するためのコントロー
ルレジスタである。このコントロールレジスタ9は、例
えば、第2図に図示したように定義される16ビツトの
容量を持つようにされる。
The circuit code 9 indicates load registers 3 and 4.
, multiplexer 5, multiplexer output circuit 6, output circuit 7, and clock output circuit. The control register 9 has, for example, a 16-bit capacity defined as shown in FIG.

図示の回路の動作は、図示しないマイクロコンピユーの
プログラムによって制御される。コントロールレジスタ
9のための制御データやロードレジスタ3,4のための
データは、バスDBを介して供給される。
The operation of the illustrated circuit is controlled by a program of a microcomputer (not illustrated). Control data for the control register 9 and data for the load registers 3 and 4 are supplied via the bus DB.

例えば、プリスケーラ1と、カウンタ回路2とによって
16ビツトのりロードタイマとして使用する場合につい
て以下に記す。
For example, a case where the prescaler 1 and the counter circuit 2 are used as a 16-bit load timer will be described below.

まず、コントロールレジスタ9の動作制御ビットB、及
びB4にそれらのビットをII I IIのようなセッ
トレベルにセットするためのセットデータが書き込まれ
、またバスDBにロードレジスタ3及びロードレジスタ
4のための初期値データが供給される。これによって、
CPU (マイクロプロセッサ)により送出された初期
値データがバスDBを介してロードレジスタ3及びロー
ドレジスタ4に書き込まれる。
First, set data for setting these bits to a set level such as II II II is written to the operation control bits B and B4 of the control register 9, and the set data for the load registers 3 and 4 is written to the bus DB. initial value data is supplied. by this,
Initial value data sent by the CPU (microprocessor) is written to the load register 3 and the load register 4 via the bus DB.

上記動作と同時もしくはその後に、コントロールレジス
タ9のプリスケーラ動作制御ビットB。
At the same time as or after the above operation, the prescaler operation control bit B of the control register 9 is set.

及びカウンタ回路動作制御ビットB、に例えば、“O1
1レベルのようなイニシャライズ動作を意味するレベル
のデータが書き込まれることによって。
and counter circuit operation control bit B, for example, “O1
By writing level data which means an initialization operation such as level 1.

ロードレジスタ3,4の初期値データが、それぞれ、プ
リスケーラ1、カウンタ回路2に書き込まれる。
Initial value data of load registers 3 and 4 are written to prescaler 1 and counter circuit 2, respectively.

次に、コントロールレジスタ9のプリスケーラ動作制御
ビットB、及びカウンタ回路動作制御ビットB6のビッ
トがそれぞれ、1(17ルベルのようなカウント動作指
示レベルにされる。これによって、プリスケーラ1及び
カウンタ回路2は、カウント可能状態に置かれる。
Next, the prescaler operation control bit B and the counter circuit operation control bit B6 of the control register 9 are respectively set to a count operation instruction level of 1 (17 levels). , placed in a countable state.

コントロールレジスタ9のマルチプレクサ出力回路制御
ビットB、は、ビットB、ないしB、のようなビットの
予めのセットと同時もしくはその後に適当な制御レベル
にセットされる。これによって、プリスケーラ1から出
力される信号は、経路(b)を介しカウンタ回路に入力
されるように制御される。
The multiplexer output circuit control bit B of control register 9 is set to the appropriate control level simultaneously with or after the presetting of bits such as bits B, B, and so on. Thereby, the signal output from the prescaler 1 is controlled so as to be input to the counter circuit via the path (b).

プリスケーラ1及びカウンタ回路2のためのビットB5
及びB、のカウント動作指示レベルへのセットと同時も
しくはその後において動作開始指示ビットB、、B、に
セットデータが書き込まれると。
Bit B5 for prescaler 1 and counter circuit 2
When set data is written to the operation start instruction bits B, , B, at the same time as or after setting the count operation instruction bits B and B to the count operation instruction level.

それに応じてクロック出力回路8よりプリスケーラ1に
対してクロックが出力さる。これに応じてプリスケーラ
1はその信号のカウントを開始し。
In response, the clock output circuit 8 outputs a clock to the prescaler 1. In response to this, prescaler 1 starts counting the signal.

またカウンタ回路2はマルチプレクサ6を介して供給さ
れるプリスケーラ31の出力のカウントを開始する6 以上のようなマイクロコンピュータのプログラムに従っ
た制御によって第1図のタイマを16ビツトのりロード
タイマとして使用することができる。
Further, the counter circuit 2 starts counting the output of the prescaler 31 supplied via the multiplexer 6.6 The timer shown in FIG. 1 is used as a 16-bit glue load timer under control according to the microcomputer program as described above. be able to.

また、上記の場合において、出力制御回路制御ビットB
1゜に経路(a)の選択を意味するレベルにされたセッ
トデータの書き込みを行なっておけば、プリスケーラ1
の出力をカウンタ回路2を介さないで直接出力制御回路
7を介して外部に出力するように制御できる。すなわち
、カウンタ回路2の動作にかかわらずに、プリスケーラ
1によって8ビツトのりロードタイマとしての機能を実
現できる。
Furthermore, in the above case, the output control circuit control bit B
If set data at a level indicating selection of path (a) is written in prescaler 1°, prescaler 1
It is possible to directly output the output to the outside via the output control circuit 7 without going through the counter circuit 2. That is, regardless of the operation of the counter circuit 2, the prescaler 1 can realize the function as an 8-bit load timer.

一方、カウンタ回路2とともにに、クロック出力回路8
より出力される基準クロックを適当な周期まで変更する
分周器としてプリスケーラ1を用いることも可能である
。その場合の動作を以下に記す。
On the other hand, along with the counter circuit 2, a clock output circuit 8
It is also possible to use the prescaler 1 as a frequency divider that changes the reference clock output from the reference clock to an appropriate period. The operation in that case is described below.

この場合、ロードレジスタ3及び4のセットデータは、
それぞれプリスケーラ1及びカウンタ回路2のカウント
数を変更しないように、例えばOにされる。この場合は
、また、マルチプレクサ制御ビットB。−82にプリス
ケーラ1より出力される各分周信号のうちの、どれを選
択するかを指定するためのデータが書き込まれ、また、
マルチプレクサ出力制御回路制御ビットB、及び出力制
御回路制御ビットB工。にセットデータが書き込まれる
。この状態で、動作制御ビットB、もしくはB。
In this case, the set data of load registers 3 and 4 are:
For example, they are set to O so that the counts of the prescaler 1 and the counter circuit 2 are not changed. In this case also multiplexer control bit B. -82 is written with data for specifying which of the divided signals output from prescaler 1 to select, and
Multiplexer output control circuit control bit B and output control circuit control bit B engineering. The set data is written to. In this state, the operation control bit B or B.

にセットデータが書き込まれると、クロック出力回路8
よりプリスケーラ1に対して基準クロックが出力される
。この基準クロックは、プリスケーラ1によって分周さ
れる。制御ビット80〜B2によって指定された分周比
の信号がマルチプレクサ5及び出力制御回路6を介して
カウンタ回路2に入力され、これによって、カウンタ回
路2がカウント動作される。このときの図示の回路は、
例えば所定の時間ごとに出力制御回路7を介してタイマ
割込み信号を出力するタイマ割込み発生回路として利用
される。
When the set data is written to the clock output circuit 8,
A reference clock is output to the prescaler 1. This reference clock is frequency-divided by a prescaler 1. A signal with a frequency division ratio designated by control bits 80 to B2 is input to counter circuit 2 via multiplexer 5 and output control circuit 6, whereby counter circuit 2 performs a counting operation. The illustrated circuit at this time is
For example, it is used as a timer interrupt generation circuit that outputs a timer interrupt signal via the output control circuit 7 at predetermined intervals.

上記した実施例では、ロードレジスタ3,4を設け、そ
れをソフトウェアによって制御してプリスケーラに初期
値を設定し、プリスケーラを適当なカウント値をもつカ
ウンタ回路として動作させることにより、また、プリス
ケーラから出力される信号がカウンタを介して出力され
るか、カウンタを介さないで出力されるかを制御するこ
とにより、既存のタイマの機能が拡張されるという効果
が得られる。
In the embodiment described above, the load registers 3 and 4 are provided, and they are controlled by software to set the initial value to the prescaler, and the prescaler is operated as a counter circuit with an appropriate count value. By controlling whether the signal is output via the counter or not via the counter, the function of the existing timer can be expanded.

以上本発明者によってなされた発明を実施例に基づき具
体的に説明したが、本発明は上記実施例に限定されるも
のではなく、その要旨を逸脱しない範囲で種々変更可能
であることはいうまでもない。1例えば、コントロール
レジスタ9の制御ビットにデータ書き込みを行なうこと
によってタイマの機能を制御しているが、コントロール
レジスタのかわりに制御回路を設け、それによってタイ
マの機能を制御することも可能である。
Although the invention made by the present inventor has been specifically explained above based on Examples, it goes without saying that the present invention is not limited to the above Examples and can be modified in various ways without departing from the gist thereof. Nor. 1. For example, although the timer function is controlled by writing data to the control bit of the control register 9, it is also possible to provide a control circuit in place of the control register and control the timer function thereby.

以上の説明では主として本発明者によってなされた発明
をその背景となった利用分野であるマイクロコンピュー
タに内蔵されるタイマに適用した場合について説明した
が、それに限定されるものではなく、タイマが内蔵され
るようなシステム一般に適用できる。
In the above explanation, the invention made by the present inventor was mainly applied to a timer built in a microcomputer, which is the field of application in which the invention was made, but the invention is not limited to this. It can be applied to general systems such as

[発明の効果] 本願において開示される発明のうち代表的なものによっ
て得られる効果を簡単に説明すれば下記のとおりである
[Effects of the Invention] The effects obtained by typical inventions disclosed in this application are briefly explained below.

すなねち、新たにカウンタを付加することなく、既存の
タイマの機能が拡張されるという効果が得られる。
In other words, the effect of expanding the functionality of an existing timer can be obtained without adding a new counter.

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

第1図は、本発明をマイクロコンピュータのタイマ回路
に適用した場合の一実施例を示すブロック図、 第2図は、そのタイマ回路を構成するコントロールレジ
スタに内蔵されたタイマ回路の構成例を4・・・・ロー
ドレジスタ、5・・・・マルチプレクサ、6・・・・マ
ルチプレクサ出力制御回路、7・・・・出力制御回路、
8・・・・クロック出力回路、9・・・・コントロール
レジスタ、B、−82・・・・マルチプレクサ制御ビッ
ト、B□・・・・ロードレジスタ3動作制御ビット、B
、・・・・ロードレジスタ4動作制御ビット、B、・・
・・プリスケーラ動作制御ビット、B6・・・・カウン
タ回路動作制御ビット、B、、 B、・・・・動作開始
指示ビット、B9・・・・マルチプレクサ出力制御回路
制御ビット、f3to・・・・出力制御回路制御ビット
。 第  2  図
FIG. 1 is a block diagram showing an embodiment of the present invention applied to a timer circuit of a microcomputer. FIG. ... Load register, 5... Multiplexer, 6... Multiplexer output control circuit, 7... Output control circuit,
8...Clock output circuit, 9...Control register, B, -82...Multiplexer control bit, B□...Load register 3 operation control bit, B
,...Load register 4 operation control bit, B,...
...Prescaler operation control bit, B6...Counter circuit operation control bit, B,, B,...Operation start instruction bit, B9...Multiplexer output control circuit control bit, f3to...Output Control circuit control bit. Figure 2

Claims (1)

【特許請求の範囲】 1、入力クロックを分周するプリスケーラと、上記プリ
スケーラの出力を入力可能にされたカウンタ回路と、上
記プリスケーラ及び上記カウンタ回路に所望の初期値を
設定するロード回路とを備えてなることを特徴とする多
機能タイマ。 2、上記ロード回路の動作制御がソフトウェアによって
実現されることを特徴とする特許請求の範囲第1項記載
の多機能タイマ。
[Claims] 1. A prescaler that divides an input clock, a counter circuit that can input the output of the prescaler, and a load circuit that sets desired initial values to the prescaler and the counter circuit. A multi-functional timer that is characterized by: 2. The multi-function timer according to claim 1, wherein the operation control of the load circuit is realized by software.
JP6566586A 1986-03-26 1986-03-26 Multi-function timer Pending JPS62224112A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP6566586A JPS62224112A (en) 1986-03-26 1986-03-26 Multi-function timer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP6566586A JPS62224112A (en) 1986-03-26 1986-03-26 Multi-function timer

Publications (1)

Publication Number Publication Date
JPS62224112A true JPS62224112A (en) 1987-10-02

Family

ID=13293516

Family Applications (1)

Application Number Title Priority Date Filing Date
JP6566586A Pending JPS62224112A (en) 1986-03-26 1986-03-26 Multi-function timer

Country Status (1)

Country Link
JP (1) JPS62224112A (en)

Similar Documents

Publication Publication Date Title
JP2745869B2 (en) Variable clock divider
US4435757A (en) Clock control for digital computer
JP2725205B2 (en) Microcontroller counter / timer circuit
US3992635A (en) N scale counter
JPS62224112A (en) Multi-function timer
JP3486718B2 (en) Single chip microcomputer
JPS6339939B2 (en)
JP2738141B2 (en) Single chip microcomputer
JP2692444B2 (en) Timer device
JP2730287B2 (en) Microcomputer
JP3789448B2 (en) Microcontroller with system resource prescaler
JPH0555883A (en) Timer circuit
JP2509464Y2 (en) D / A conversion circuit
JP2898774B2 (en) Pulse generator
JPH0572359A (en) Clock circuit
KR100239446B1 (en) Test circuit of frequency composition unit having autoloachaing function
JPH03246603A (en) Rapid counter
JPH0191528A (en) High speed prescaler circuit
JPS613223A (en) Data processor
JPH01128152A (en) Serial i/o circuit
JPH0427730B2 (en)
JPH05100767A (en) Clock signal circuit
JPS59190767A (en) General-purpose circuit for generating ringing interval signal of electronic exchange
JPS6271331A (en) Clock generating circuit
JPH075279A (en) Timer circuit