JPH03296103A - Timer device for programmable controller - Google Patents

Timer device for programmable controller

Info

Publication number
JPH03296103A
JPH03296103A JP9807990A JP9807990A JPH03296103A JP H03296103 A JPH03296103 A JP H03296103A JP 9807990 A JP9807990 A JP 9807990A JP 9807990 A JP9807990 A JP 9807990A JP H03296103 A JPH03296103 A JP H03296103A
Authority
JP
Japan
Prior art keywords
timer
output
register
value
current value
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
JP9807990A
Other languages
Japanese (ja)
Inventor
Koji Nakagawa
浩治 中川
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP9807990A priority Critical patent/JPH03296103A/en
Publication of JPH03296103A publication Critical patent/JPH03296103A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To ensure the accurate working of a timer by selecting one of the zero value, the timer set value, and two types of present timer value as the output of the present timer value set under the conditions of a timer set value register and a comparison output register. CONSTITUTION:A counter reset means 7 stores the count value in a DELTAt register 15 and resets a counter 16, and a present timer value register 14 stores the time elapsed up to the present time point after the timer 16 is started. At the same time, an adder 10 adds together the values of both registers 14 and 15. Then a timer set value register 13 stores the time set value, and a storage outputs the timer set value to the adder 10. A comparison output register 8 stores temporarily the output of a comparator 9. Then an output data selector 6 selects the zero value, the timer set value, the present timer value, or the present timer value +DELTAt as the output of the present timer value set under the conditions of the registers 14, 13 and 8. Thus the accurate working of a timer is ensure.

Description

【発明の詳細な説明】 [産業上の利用分野] この発明は共通部を複数のタイマで共有するプログラマ
ブルコントローラのタイマ装置に関するものである。
DETAILED DESCRIPTION OF THE INVENTION [Field of Industrial Application] The present invention relates to a timer device for a programmable controller in which a common part is shared by a plurality of timers.

[従来の技術] 第4図は例えば特開昭52−60389号公報に示され
た従来のプログラマブルコントローラのタイマ装置を示
す図であり、共通部分を多数のタイマで共有するもので
ある。図において、(2)は各アドレスにそのアドレス
に対応するタイマの現在値を記憶するタイマ現在値記憶
領域と、そのアドレスに対応するタイマ出力状態を記憶
するタイマ出力状態記憶領域を設けたRAMである。(
SC)は一定時間毎にタイマ現在値歩進用のパルスを発
生する基準クロックパルス発生器であり、基轄りロック
部(17)とパルス発生器(20)とアンドゲート(1
9)で構成しである。基準クロック部(17)は、プロ
グラマブルコントローラの演算処理部(図示せず)から
送られて(る同期信号(n)を入力し、第5図における
従来例のカウンタ入力タイミング図に示すように、上記
演算処理部がプログラマブルコントローラの記憶部(図
示せず)の0番地の制御プログラムを実行するのに同期
し、一定時間T。
[Prior Art] FIG. 4 is a diagram showing a conventional timer device of a programmable controller disclosed in, for example, Japanese Patent Application Laid-Open No. 52-60389, in which a common part is shared by a large number of timers. In the figure, (2) is a RAM in which each address has a timer current value storage area that stores the current value of the timer corresponding to that address, and a timer output status storage area that stores the timer output status that corresponds to that address. be. (
SC) is a reference clock pulse generator that generates a pulse for incrementing the current value of the timer at regular intervals, and includes a reference lock section (17), a pulse generator (20), and an AND gate (1).
9). The reference clock section (17) inputs the synchronization signal (n) sent from the arithmetic processing section (not shown) of the programmable controller, and as shown in the counter input timing diagram of the conventional example in FIG. The arithmetic processing section executes the control program at address 0 in the storage section (not shown) of the programmable controller for a certain period of time T in synchronization with the execution of the control program.

ごとに全制御プログラムを一回実行する時間T1の幅を
有する基準クロック信号(0)を発生する。パルス発生
器(20)は、タイマ現在値を歩進するパルス信号を発
生する。アンドゲート(19)は、基準クロック部(1
7)からの基準クロック信号(0)と、上記演算処理部
からのタイマ動作指令信号(e)とが共に”l”の時、
パルス発生器(20)からのパルス信号(p)を1個通
す。この通された信号、即ちアンドゲート(19)の出
力信号をkとする。(16)は上記演算処理部からのタ
イマ番号指定信号(1)によりRA M (21から読
み出した前回までのタイマ現在値をセットするプリセッ
タブルカウンタである。
A reference clock signal (0) having a width of time T1 for executing the entire control program once every time is generated. A pulse generator (20) generates a pulse signal that increments the current timer value. The AND gate (19) is connected to the reference clock section (1
When the reference clock signal (0) from 7) and the timer operation command signal (e) from the arithmetic processing section are both "L",
One pulse signal (p) from the pulse generator (20) is passed through. This passed signal, ie, the output signal of the AND gate (19), is assumed to be k. (16) is a presettable counter that sets the previous timer current value read from RAM (21) in response to the timer number designation signal (1) from the arithmetic processing section.

このプリセッタブルカウンタ(16)はタイマ動作指令
信号(e)が”0”の場合はリセット信号(c)により
リセットされ、タイマ動作指令信号(e)が”1”の場
合はアンドゲート(19)からカウントアツプパルス信
号(k)が送られてくると、セットしたタイマ現在値を
1つ増す。タイマ動作指令信号(e)が”l”で基準ク
ロック信号(0)が”0”の時は、プリセッタブルカウ
ンタ(16)の内容はそのまま保持される。(9)は上
記演算処理部から送られてきた該当タイマの設定値(g
)とプリセッタブルカウンタ(16)の出力、すなわち
タイマ現在値とを比較し、プリセッタブルカウンタ(1
6)のカウンタ出力(h)の方が大きい時のみ出力を発
生する比較器である。
This presettable counter (16) is reset by the reset signal (c) when the timer operation command signal (e) is "0", and is reset by the AND gate (19) when the timer operation command signal (e) is "1". When a count up pulse signal (k) is sent from the timer, the current value of the set timer is incremented by one. When the timer operation command signal (e) is "1" and the reference clock signal (0) is "0", the contents of the presettable counter (16) are held as they are. (9) is the setting value of the corresponding timer (g
) and the output of the presettable counter (16), that is, the current value of the timer, and the output of the presettable counter (16) is compared.
6) is a comparator that generates an output only when the counter output (h) is larger.

(12)はタイマ番号指定信号(i)によりRA M 
(21から読み出した前回までのタイマ出力状態を、時
記憶すると共に、この内容を出力するタイマ出力レジで
ある。(12)は比較器(9)の比較出力信号(j)と
タイマ出力信号(f)とから該当タイマの新しい出力状
態を決定する論理部であり、アンド素子(4)とオア素
子(5)で構成される。
(12) is RAM by the timer number designation signal (i).
(This is a timer output register that stores the timer output state up to the previous time read from 21 and outputs this content. This is a logic unit that determines a new output state of the corresponding timer from f) and is composed of an AND element (4) and an OR element (5).

次に動作について説明する。プログラマブルコントロー
ラはタイマ命令を含んだ制御プログラムを絶えず繰り返
し実行する。プログラマブルコントローラがタイマ命令
実行のところに来ると、該当タイマのタイマ番号指定信
号(i)と該当タイマのタイマ動作指令信号(e)と該
当タイマのタイマ設定値(g)が本装置に送られて(る
。まずタイマ番号指定信号(i)によりRA M (2
)から前回までのタイマ現在値と前回までのタイマ出力
状態が読み出され、それぞれプリセッタブルカウンタ(
16)とタイマ出力レジ(12)にセットされる。タイ
マ動作指令信号(e)が”0”の場合、プリセッタブル
カウンタ(16)は反転器(18)により反転されたリ
セット信号(c)によりリセットされる。タイマ動作指
令信号(e)が”l”の場合は、基準クロック部(17
)の出力(0)が”1”であるとアンドゲート(19)
を通してパルスが1つプリセッタブルカウンタ(16)
に送られ、タイマ現在値を1増す。タイマ動作指令信号
(e)が”l”で基準クロック信号(0)が”0”の時
は、プリセッタブルカウンタ(16)の中の現在値はそ
のまま保持される。次にプリセッタブルカウンタ(16
)の中の現在値と送られてきたタイマ設定値(g)を比
較器(9)で比較し、カウンタ出力(h)がタイマ設定
値(g)を越えていたら比較出力信号(j)を”l”と
する。アンド素子(4)とオア素子(5)では、タイマ
動作指令信号(e)が”l”で比較出力信号(j)が”
l”になると新しいタイマ出力(a)は”1”になる。
Next, the operation will be explained. A programmable controller constantly and repeatedly executes a control program containing timer instructions. When the programmable controller reaches the point where the timer command is executed, the timer number designation signal (i) of the relevant timer, the timer operation command signal (e) of the relevant timer, and the timer setting value (g) of the relevant timer are sent to this device. (First, RAM (2
), the current value of the timer up to the previous time and the timer output state up to the previous time are read out, and the respective presettable counters (
16) and is set in the timer output register (12). When the timer operation command signal (e) is "0", the presettable counter (16) is reset by the reset signal (c) inverted by the inverter (18). When the timer operation command signal (e) is "l", the reference clock section (17
) is “1”, the AND gate (19)
One pulse through the presettable counter (16)
The current value of the timer is incremented by 1. When the timer operation command signal (e) is "1" and the reference clock signal (0) is "0", the current value in the presettable counter (16) is held as is. Next, the presettable counter (16
) is compared with the sent timer setting value (g) using the comparator (9), and if the counter output (h) exceeds the timer setting value (g), the comparison output signal (j) is Let it be "l". In the AND element (4) and the OR element (5), the timer operation command signal (e) is "l" and the comparison output signal (j) is "
When the timer output (a) becomes "1", the new timer output (a) becomes "1".

以上の動作をタイマ命令が実行される毎に行う。タイマ
出力信号(f)をオア素子(5)に入れたのは、プリセ
ッタブルカウンタ(16)がオーバーフローして再びタ
イマ設定値(g)以下にカウンタ出力(h)がなっても
、新しいタイマ出力(a)を”0”にしないためである
。以上の操作が終ると新しいタイマ出力(a)とカウン
タ出力(現在値)(h)をRA M (2)に書き込む
The above operation is performed every time the timer instruction is executed. The reason why the timer output signal (f) is input to the OR element (5) is that even if the presettable counter (16) overflows and the counter output (h) becomes below the timer setting value (g) again, a new timer output is generated. This is to prevent (a) from becoming "0". When the above operations are completed, new timer output (a) and counter output (current value) (h) are written to RAM (2).

なお基準クロック信号(0)のパルス中が、プログラマ
ブルコントローラの全プログラムを一回実行する時間巾
T1にセットされているので、基準クロック信号(0)
の周期T0の間には、一つのタイマ命令が実行される機
会が何度かある。しかし、そのうち基準クロック信号(
0)が”l”であるのは度だけである。その結果、タイ
マ動作指令信号(e)が”1”であるすべてのタイマは
、基準クロックの周期T。ごとに1つづつその現在値を
歩進し、タイマ動作を行う。
Note that the pulse of the reference clock signal (0) is set to the time width T1 for executing the entire program of the programmable controller once, so the reference clock signal (0)
During the period T0, there are several opportunities for one timer instruction to be executed. However, the reference clock signal (
0) is "l" only in degrees. As a result, all the timers whose timer operation command signal (e) is "1" have the period T of the reference clock. The current value is incremented by one for each time, and a timer operation is performed.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

従来のプログラマブルコントローラのタイマ装置は、以
上の様に構成されており、基準クロックパルスの巾がプ
ログラマブルコントローラの全プログラムを1回実行す
る時間巾T、にセットされている。また本装置ではタイ
マ命令実行時にタイマのプリセッタブルカウンタのカウ
ントUP条件が成立すると1回だけプリセッタブルカウ
ンタを歩進するようになっているので、タイマの基準ク
ロック(To)がシーケンスプログラムを1回実行する
時間(T1)より短かい場合で(To<TI)、シかも
プリセッタブルカウンタの歩進を行うタイマ命令の位置
が基準クロックがオフしてしまった所にある場合は、カ
ウントアツプ条件がONL、ていても、プリセッタブル
カウンタは歩進されず、正確なタイマ動作かで−きない
という課題があった。
The conventional timer device for a programmable controller is configured as described above, and the width of the reference clock pulse is set to the time width T for executing the entire program of the programmable controller once. In addition, in this device, when the count UP condition of the timer presettable counter is satisfied when the timer instruction is executed, the presettable counter is incremented only once, so the timer reference clock (To) runs the sequence program once. If it is shorter than the execution time (T1) (To<TI), and the timer instruction that increments the presettable counter is located at a location where the reference clock has turned off, the count up condition is Even if ONL is used, the presettable counter is not incremented, and there is a problem that accurate timer operation cannot be performed.

又、カウンタの人力をタイマの条件により変化させるた
め、カウンタ入力部の回路が複雑になり、その制御が難
しいという課題があった。
Furthermore, since the counter's manual power is changed depending on the timer conditions, the circuit of the counter input section becomes complicated, making it difficult to control it.

この発明は上記のような課題を解決するためになされた
もので、タイマの基準クロックがどのような時間に設定
されても正常に動作し、しかもカウンタ入力部の制御回
路を簡単にしたプログラマブルコントローラのタイマ処
理装置を得ることを目的とする。
This invention was made to solve the above problems, and provides a programmable controller that operates normally no matter what time the reference clock of the timer is set, and that has a simple control circuit for the counter input section. The purpose of this invention is to obtain a timer processing device.

〔課題を解決するための手段〕[Means to solve the problem]

この発明に係わるプログラマブルコントローラのタイマ
装置は、一定周期で発生するクロック信号を計数するカ
ウンタと、シーケンスプログラムの命令処理サイクルご
とに上記カウンタの計数値Δtを記憶するΔtレジスタ
と、上記Δtレジスタに計数値を記憶後に上記カウンタ
をリセットするカウンタリセット手段と、タイマ起動後
、現在までの経過時間を記憶するタイマ現在値レジスタ
と、上記Δtレジスタとタイマ現在値レジスタとの値を
加算する加算器と、タイマ設定値を記憶するタイマ設定
値レジスタと、上記タイマ設定値と上記加算器出力を比
較する比較器と、上記比較器の出力を一時記憶する比較
出力レジスタと、上記タイマ現在値レジスタ、タイマ設
定値レジスタおよび比較出力レジスタのレジスタ条件に
よるタイマ現在値の出力を零値、タイマ設定値、タイマ
現在値およびタイマ現在値+Δtのいずれかを選択する
出力データ選択器を備え、上記カウンタ、加算器、比較
器および出力データ選択器はハードウェア構成されたも
のである。
A timer device for a programmable controller according to the present invention includes a counter that counts clock signals generated at a constant cycle, a Δt register that stores a count value Δt of the counter for each instruction processing cycle of a sequence program, and a Δt register that stores a count value Δt of the counter for each instruction processing cycle of a sequence program. a counter reset means for resetting the counter after storing a numerical value; a timer current value register for storing the elapsed time from the start of the timer to the present; an adder for adding the values of the Δt register and the timer current value register; A timer setting value register that stores the timer setting value, a comparator that compares the above-mentioned timer setting value and the above-mentioned adder output, a comparison output register that temporarily stores the output of the above-mentioned comparator, the above-mentioned timer current value register, and timer setting. The counter, the adder, The comparator and output data selector are constructed in hardware.

[作用] この発明におけるカウンタは一定周期で発生するクロッ
ク信号を計数し、Δtレジスタはシーケンスプログラム
の命令処理サイクルごとに上記カウンタの計数値Δtを
記憶し、カウンタリセット手段は上記Δtレジスタに計
数値を記憶後に上記カウンタをリセットし、タイマ現在
値レジスタはタイマ起動後、現在までの経過時間を記憶
し、加算器は上記Δtレジスタとタイマ現在値レジスタ
との値を加算し、タイマ設定値レジスタはタイマ設定値
を記憶し、記憶器は上記タイマ設定値と上記加算器出力
し、比較出力レジスタは上記比較器の出力を一時記憶し
、出力データ選択器は上記タイマ現在値レジスタ、タイ
マ設定値レジスタおよび比較出力レジスタのレジスタ条
件によるタイマ現在値の出力として零値、タイマ設定値
、タイマ現在値およびタイマ現在値子Δtのいずれかを
選択する。
[Operation] The counter in the present invention counts clock signals generated at a constant period, the Δt register stores the counted value Δt of the counter for each instruction processing cycle of the sequence program, and the counter reset means stores the counted value in the Δt register. After storing, the above counter is reset, the timer current value register stores the elapsed time from the timer activation to the present, the adder adds the values of the above Δt register and the timer current value register, and the timer setting value register The timer setting value is stored, the storage unit outputs the above timer setting value and the above adder, the comparison output register temporarily stores the output of the above comparator, and the output data selector outputs the above timer current value register and timer setting value register. Then, one of the zero value, timer set value, timer current value, and timer current value Δt is selected as the output of the timer current value according to the register conditions of the comparison output register.

〔発明の実施例〕[Embodiments of the invention]

以下、この発明の一実施例を図について説明する。なお
、従来例と同一符号で示されたものは従来例のそれと同
一、もしくは同様なものを示す。
An embodiment of the present invention will be described below with reference to the drawings. It should be noted that the same reference numerals as those in the conventional example indicate the same or similar elements.

第1図において、(1)はプログラマブルコントローラ
の演算処理部であり、(2)は各アドレスに対応するタ
イマの現在値を記憶するタイマ現在値記憶領域と、その
アドレスに対応するタイマ出力状態を記憶するタイマ出
力状態記憶領域を設けたRAMである。(11)は演算
処理部fl)から送られて(るタイマ動作指令信号を一
時記憶するタイマ動作指令レジ、(12)は演算処理部
(1)がタイマ番号指定信号(i)によりRA M (
21から読み出した前回のタイマ出力状態を一時記憶す
るタイマ出力レジ、(13)は演算処理部(1)から送
られてきた該当タイマ設定値を一時記憶するタイマ設定
値レジ、(14)は演算処理部(1)がタイマ番号指定
信号(i)によりRA M (2)から読み出した前回
のタイマ現在値を一時記憶するタイマ現在値レジである
In Figure 1, (1) is the arithmetic processing unit of the programmable controller, and (2) is the timer current value storage area that stores the current value of the timer corresponding to each address and the timer output state corresponding to that address. This is a RAM provided with a timer output state storage area for storing. (11) is a timer operation command register that temporarily stores the timer operation command signal sent from the arithmetic processing unit (fl), and (12) is a timer operation command register in which the arithmetic processing unit (1) uses the timer number designation signal (i) to read the RAM (
21 is a timer output register that temporarily stores the previous timer output state read out, (13) is a timer setting value register that temporarily stores the corresponding timer setting value sent from the calculation processing section (1), and (14) is a calculation This is a timer current value register that temporarily stores the previous timer current value read out from RAM (2) by the processing unit (1) in response to the timer number designation signal (i).

(15)は後述するカウンタ(16)がシーケンスプロ
グラムを一回実行するのにカウントしたクロック信号(
k)の値を一時記憶するΔtレジであり、タイマ現在値
レジ(14)のタイマ現在値(ql と加算器(10)
により加算され、加算出力値(h)として出力される。
(15) is a clock signal (
k) is a Δt register that temporarily stores the value of the timer current value (ql) of the timer current value register (14) and the adder (10).
are added and output as an added output value (h).

この加算出力値(h)は、タイマ設定値レジ(13)の
タイマ設定値(g)と比較器(9)により比較されその
結果は2値信号として比較出力レジ(8)に−時記憶さ
れる。(16)は基準クロック部(17)が出力するク
ロック信号(k)をカラン1−するカウンタである。こ
のカウンタ(16)は制御回路(7)より出力されるリ
セット信号(C)にてシーケンスプロ(11) ダラムのENDごとにリセットされる。
This addition output value (h) is compared with the timer setting value (g) of the timer setting value register (13) by the comparator (9), and the result is stored as a binary signal in the comparison output register (8). Ru. (16) is a counter that clocks the clock signal (k) output from the reference clock section (17). This counter (16) is reset by a reset signal (C) outputted from the control circuit (7) every time the sequence program (11) Durham ends.

これらのレジスタ(11)〜(工5)の出力であるタイ
マ動作指令信号(e)、タイマ出力信号(f)、比較出
力信号(j)をオア素子(5)とアンド素子(4)より
構成される論理回路に人力し、その出力を新しいタイマ
出力(a)としている。さらに、これらのタイマ動作指
令信号(e)、タイマ出力信号(fl 、比較出力信号
(j)は出力データ選択器(6)に入力され、これらの
条件により、0、タイマ設定置(gl、タイマ現在値(
q)、加算出力値(h)のどれかが選択され、新しいタ
イマ現在値出力(r)として出力される。
The timer operation command signal (e), timer output signal (f), and comparison output signal (j), which are the outputs of these registers (11) to (5), are composed of an OR element (5) and an AND element (4). The output is used as the new timer output (a). Furthermore, these timer operation command signal (e), timer output signal (fl), and comparison output signal (j) are input to the output data selector (6), and depending on these conditions, 0, timer setting position (gl, timer Present value(
q), the added output value (h) is selected and output as a new timer current value output (r).

なお、出力選択回路としての出力データ選択器(6)の
詳細は第3図の出力データ選択器(6)の構成図に示す
。第3図において、nコというのは、タイマ設定値レジ
(13)やタイマ現在値レジ(14)がnビットのレジ
スタであることを示し、nビットに対応してゲート素子
(61)〜(67)からなる論理回路(LL)がnコ必
要であることを示す。
The details of the output data selector (6) as an output selection circuit are shown in the configuration diagram of the output data selector (6) in FIG. In FIG. 3, n indicates that the timer setting value register (13) and the timer current value register (14) are n-bit registers, and corresponding to the n bits, the gate elements (61) to ( This shows that n logic circuits (LL) consisting of (67) are required.

また、(3)は演算処理部(1)やRA M (2)と
、(12) アクセスするデータを仲介する入出力ゲートで、入出力
タイミングは制御回路(7)から出力されるゲート信号
(b)により制御される。また、制御回路(7)は、ラ
ッチ信号(d)により、各レジスタに一時記憶するタイ
ミングも制御する。
In addition, (3) is an input/output gate that mediates data to be accessed between the arithmetic processing unit (1), RAM (2), and (12), and the input/output timing is determined by the gate signal ( b). The control circuit (7) also controls the timing of temporary storage in each register using the latch signal (d).

以下、動作について説明する。プログラマブルコントロ
ーラはタイマ命令を含んだシーケンスプログラムを絶え
ず繰り返し実行する。プログラマブルコンI・ローラが
タイマ命令実行のところに来ると、上記プログラマブル
コントローラの演算処理部(1)が該当タイマのタイマ
番号指定信号(i)を出力し、RAM(2)から上記該
当タイマ現在値とタイマ出力状態を読み出し7、上記シ
ーケンスプログラムからタイマ動作指令信号とタイマ設
定値を読み出し、これらの信号(blは入出力ゲート(
3)を通り、制御回路(7)が出力するラッチ信号(d
)により対応するレジスタ(ll)〜(14)に−時記
憶される。また、基準クロック部(17)から出力され
たクロック信号Fk)はカウンタ(16)によりカウン
トされる。その際、シーケンスプログラムの実行前に、
このカウンタ(16)は、制御回路(7)から出力され
るリセット信号(C)にてリセットされ、シケンスプロ
グラムのEND時に、制御回路(7)が出力するラッチ
信号(dl でΔtレジ(I5)に−時記憶する。この
様にして、Δtレジ(15)には、シーケンスプログラ
ム1口実行分の時間Δtが格納されることになる。
The operation will be explained below. The programmable controller constantly and repeatedly executes a sequence program containing timer instructions. When the programmable controller I/roller comes to the point where the timer instruction is executed, the arithmetic processing section (1) of the programmable controller outputs the timer number designation signal (i) of the relevant timer, and the current value of the relevant timer is stored from the RAM (2). Read out the timer output status 7, read out the timer operation command signal and timer setting value from the above sequence program, and read out these signals (bl is the input/output gate (
3), and the latch signal (d) output from the control circuit (7).
) is stored in the corresponding registers (ll) to (14). Further, the clock signal Fk) output from the reference clock section (17) is counted by the counter (16). At that time, before executing the sequence program,
This counter (16) is reset by the reset signal (C) output from the control circuit (7), and at the end of the sequence program, the Δt register (I5) is reset by the latch signal (dl) output from the control circuit (7). ).In this way, the time Δt for one execution of the sequence program is stored in the Δt register (15).

次にタイマ現在値レジ(14)とΔtレジ(15)の内
容が加算器(10)により加算される。加算器+101
の加算出力値(h)は比較器(9)にてタイマ設定値(
g)と比較され、タイマ設定値(glが加算出力値(h
lより小さい場合には”1”、、大きい場合は”0”が
比較出力レジ(8)に−時記憶される。新しいタイマ出
力(a)は、タイマ動作指令信号(e)が”1”(タイ
マON)で、かつ前回のタイマ出力信号(f)が”】”
〔タイマカウントIIP済)または、比較出力信号(j
)が”l”(タイマカウントUP)の時にl”となる。
Next, the contents of the timer current value register (14) and the Δt register (15) are added by an adder (10). Adder +101
The addition output value (h) of is determined by the timer setting value (h) by the comparator (9).
g) and the timer setting value (gl is the addition output value (h
If it is smaller than l, "1" is stored in the comparison output register (8), and if it is larger, "0" is stored in the comparison output register (8). The new timer output (a) is when the timer operation command signal (e) is "1" (timer ON) and the previous timer output signal (f) is "]"
[Timer count IIP completed] or comparison output signal (j
) becomes "l" when it is "l" (timer count UP).

それ以外は”0“を出力する。以上の論理はアンド素子
(4)とオア素子(5)により実現される。
Otherwise, "0" is output. The above logic is realized by an AND element (4) and an OR element (5).

また、新しいタイマの現在値出力(r)は、タイマ動作
指令信号(e)、前回のタイマ出力信号(f)、比較出
力信号(j)の条件により、出力データ選択器〔6)で
、タイマ設定置(g)、前回のタイマ現在値(q)、加
算出力値(h)(前回のタイマ現在値(q)+△L)又
は0のどれかが選択される。
In addition, the current value output (r) of the new timer is determined by the output data selector [6] according to the conditions of the timer operation command signal (e), the previous timer output signal (f), and the comparison output signal (j). Either the setting position (g), the previous timer current value (q), the addition output value (h) (previous timer current value (q) + ΔL), or 0 is selected.

詳細を説明すると、第2図の出力データ選択器(6)に
おける入力条件と出力データの関係図に示すように条件
と出力が対応する。すなわち、タイマ動作指令信号(e
)が”0”(タイマ0FF)ならば現在値出力(1−1
は“0”となり、タイマ動作指令信号(e)が”1”(
タイマONI で、前回のタイマ出力信号(f)が”1
“(タイマカウントUP済)ならば現在値出力(r)は
前回のタイマ現在値(q)となる。また、タイマ動作指
令信号(e)が”l”(タイマON)で前回のタイマ現
在値(q)が”0”(タイマ未カウントUP・動作中)
で、比較出力信号(j)が”0”(タイマ未カウントU
P)なら現在値出力(r)は加算出力値(h)(前回の
現在値十へL)、比較出力が”1”(タイマカウントU
P)ならタイマ設定値(glがそれぞれ出力される。第
3図は以上の内容をH/Wで実現した回路を示したも(
15) のである。
To explain the details, the conditions and outputs correspond as shown in the relationship diagram of the input conditions and output data in the output data selector (6) in FIG. In other words, the timer operation command signal (e
) is “0” (timer 0FF), the current value is output (1-1
becomes “0”, and the timer operation command signal (e) becomes “1” (
In timer ONI, the previous timer output signal (f) is “1”.
“If (timer count has been UP), the current value output (r) will be the previous timer current value (q). Also, if the timer operation command signal (e) is “l” (timer ON), the previous timer current value (q) is “0” (timer not counted UP/operating)
Then, the comparison output signal (j) is "0" (timer not counted)
P), the current value output (r) is the addition output value (h) (L to the previous current value 10), and the comparison output is "1" (timer count U
P), the timer setting value (gl) is output respectively. Figure 3 shows a circuit that realizes the above contents with H/W (
15) It is.

そして最後に演算処理部(1)がタイマ番号指定信号(
it を出力し、新しいタイマの現在値出力(r)と新
しいタイマ出力(a)を入出力ゲート(3)を通して、
RA M (2)の上記タイマ番号指定信号(i)に対
応するアドレスの領域に書き込む。
Finally, the arithmetic processing unit (1) sends a timer number designation signal (
It outputs the current value of the new timer (r) and the new timer output (a) through the input/output gate (3).
It is written in the address area of RAM (2) corresponding to the timer number designation signal (i).

なお、上記実施例では、新しいタイマ出力(a)を出力
するための論理回路をアンド素子(4)とオア素子(b
)で構成したが、これをナンド素子やノア素子等の負論
理回路を使って構成しても良い。
In the above embodiment, the logic circuit for outputting the new timer output (a) is composed of an AND element (4) and an OR element (b).
), but this may also be constructed using a negative logic circuit such as a NAND element or a NOR element.

また、上記実施例では、タイマの現在値を求めるのに加
算器(10)を使用したが、代わりに減算器を使用して
、タイマの現在値(qlからΔtを引いてやり、この減
算器出力を比較器(9)で“0”と比較して、比較出力
信号(j)を出力する構成としても良い。
Further, in the above embodiment, the adder (10) was used to obtain the current value of the timer, but instead, a subtracter was used to subtract Δt from the current value (ql) of the timer. The output may be compared with "0" by a comparator (9) and a comparison output signal (j) may be output.

[発明の効果] 以−Hのように、この発明によれば一定周期で発生する
クロック信号を計数するカウンタと、シケンスプログラ
ムの命令処理サイクルごとに上記(16) カウンタの計数値Δtとタイマ起動後、現在までの経過
時間を示すタイマ現在値との値を加算する加算器と、タ
イマ設定値と上記加算器出力を比較する比較器と、上記
比較器の出力、上記タイマ現在値およびタイマ設定値に
基づき、新たなタイマ現在値としての出力を零値、上記
タイマ設定値、タイマ現在値およびタイマ現在値+Δt
のいずれかから選択する出力データ選択器とを備え、か
つ上記カウンタ、加算器、比較器および出力データ選択
器をハードウェア構成としたので、正確なタイマ動作が
可能であると共に、タイマの入力制御回路部の構成が簡
単になり、基準タロツクを自由に選べるものが得られる
効果がある。
[Effects of the Invention] As shown in H-H above, according to the present invention, a counter that counts clock signals generated at a constant cycle, and a count value Δt of the counter (16) and a timer are calculated for each instruction processing cycle of a sequence program. After startup, an adder that adds the value to the timer current value indicating the elapsed time up to the present time, a comparator that compares the timer setting value and the output of the above adder, the output of the above comparator, the above timer current value, and the timer Based on the set value, output as the new timer current value to zero value, the above timer setting value, timer current value, and timer current value + Δt
Since the counter, adder, comparator, and output data selector are configured in hardware, accurate timer operation is possible, as well as timer input control. This has the effect of simplifying the configuration of the circuit section and allowing the user to freely select the reference tarok.

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

第1図は本発明の一実施例によるプログラマブルコント
ローラのタイマ装置の構成図、第2図は第1図に示した
タイマ装置における出力データ選択器の人力条件と出力
データの関係を示す図、第3図は出力データ選択器のH
/■構成図、第4図は従来のプログラマブルコントロー
ラのタイマ処理装置の構成図、第5図は従来例のカウン
タ入力タイミング図である。 図において、(1)は演算処理部、(2)はRAM、(
3)は入出力ゲート、(6)は出力データ選択器、(7
)は制御回路、(8)は比較出力レジ、(9)は比較器
、(lO)は加算器、(11)はタイマ動作指令レジ、
(12)はタイマ出力レジ、(13)はタイマ設定値レ
ジ、(14)はタイマ現在値レジ、(15)はΔtレジ
、(16)はカウンタ、(17)は基準クロック部、(
a)は新しいタイマ出力信号、fb)はゲート信号、(
c)はリセット信号、fd)はラッチ信号、(e)はタ
イマ動作指令信号、[f)はタイマ出力信号、(g)は
タイマ設定値、(h)は加算出力値、(i)はタイマ番
号指定信号、(jlは比較出力信号、fk)はクロック
信号、(q)はタイマ現在値、(r)は現在値出力信号
を示す。 なお、図中、同一符号は同一、又は相当部分を示す。
FIG. 1 is a block diagram of a timer device of a programmable controller according to an embodiment of the present invention, FIG. Figure 3 shows H of the output data selector.
/■ Block diagram, FIG. 4 is a block diagram of a timer processing device of a conventional programmable controller, and FIG. 5 is a counter input timing diagram of a conventional example. In the figure, (1) is an arithmetic processing unit, (2) is a RAM, (
3) is an input/output gate, (6) is an output data selector, (7
) is a control circuit, (8) is a comparison output register, (9) is a comparator, (lO) is an adder, (11) is a timer operation command register,
(12) is the timer output register, (13) is the timer setting value register, (14) is the timer current value register, (15) is the Δt register, (16) is the counter, (17) is the reference clock section, (
a) is the new timer output signal, fb) is the gate signal, (
c) is a reset signal, fd) is a latch signal, (e) is a timer operation command signal, [f] is a timer output signal, (g) is a timer setting value, (h) is an addition output value, (i) is a timer A number designation signal, (jl is a comparison output signal, fk) is a clock signal, (q) is a timer current value, and (r) is a current value output signal. In addition, in the figures, the same reference numerals indicate the same or equivalent parts.

Claims (1)

【特許請求の範囲】[Claims]  一定周期で発生するクロック信号を計数するカウンタ
と、シーケンスプログラムの命令処理サイクルごとに上
記カウンタの計数値Δtを記憶するΔtレジスタと、上
記Δtレジスタに計数値を記憶後に上記カウンタをリセ
ットするカウンタリセット手段と、タイマ起動後、現在
までの経過時間を記憶するタイマ現在値レジスタと、上
記Δtレジスタとタイマ現在値レジスタとの値を加算す
る加算器と、タイマ設定値を記憶するタイマ設定値レジ
スタと、上記タイマ設定値と上記加算器出力を比較する
比較器と、上記比較器の出力を一時記憶する比較出力レ
ジスタと、上記タイマ現在値レジスタ、タイマ設定値レ
ジスタおよび比較出力レジスタのレジスタ条件によるタ
イマ現在値の出力を零値、タイマ設定値、タイマ現在値
およびタイマ現在値+Δtのいずれかを選択する出力デ
ータ選択器を備え、上記カウンタ、加算器、比較器およ
び出力データ選択器はハードウェア構成であることを特
徴とするプログラマブルコントローラのタイマ装置。
A counter that counts clock signals generated at regular intervals, a Δt register that stores the counted value Δt of the counter for each instruction processing cycle of the sequence program, and a counter reset that resets the counter after storing the counted value in the Δt register. a timer current value register for storing the elapsed time from the start of the timer to the present; an adder for adding the values of the Δt register and the timer current value register; and a timer setting value register for storing the timer setting value. , a comparator that compares the timer setting value and the output of the adder, a comparison output register that temporarily stores the output of the comparator, and a timer according to the register conditions of the timer current value register, timer setting value register, and comparison output register. Equipped with an output data selector that selects the output of the current value from zero value, timer setting value, timer current value, and timer current value + Δt, and the counter, adder, comparator, and output data selector are configured in hardware. A timer device for a programmable controller, characterized in that:
JP9807990A 1990-04-13 1990-04-13 Timer device for programmable controller Pending JPH03296103A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9807990A JPH03296103A (en) 1990-04-13 1990-04-13 Timer device for programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9807990A JPH03296103A (en) 1990-04-13 1990-04-13 Timer device for programmable controller

Publications (1)

Publication Number Publication Date
JPH03296103A true JPH03296103A (en) 1991-12-26

Family

ID=14210343

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9807990A Pending JPH03296103A (en) 1990-04-13 1990-04-13 Timer device for programmable controller

Country Status (1)

Country Link
JP (1) JPH03296103A (en)

Similar Documents

Publication Publication Date Title
US5367550A (en) Break address detecting circuit
JPS5936857A (en) Processor unit
JPS63148346A (en) Information processor
JPH02165721A (en) Pulse output device
JP3322893B2 (en) Microcomputer
JP2006303863A (en) Pulse signal generating device
JPS6240886B2 (en)
US5535376A (en) Data processor having a timer circuit for performing a buffered pulse width modulation function and method therefor
JPH03296103A (en) Timer device for programmable controller
US5377347A (en) Data processor for generating pulse signal in response to external clock including flipflop
KR100316419B1 (en) Timer device having timer counter and method of controlling output of output terminal thereof
JP2009075875A (en) Counter circuit, dynamic reconfigurable circuit, and loop processing control method
JP2718402B2 (en) Time measurement circuit for built-in in-circuit emulator
JPS596084B2 (en) Timer setting value setting device
KR0152224B1 (en) Ready state generating apparatus capable of varying state number
JP2692444B2 (en) Timer device
JP3225613B2 (en) Microcomputer
JPH0199132A (en) Multi-task executing device
JPH08125501A (en) Control signal generation device
JPS62271022A (en) Microprogram controller
KR0162462B1 (en) Device and method for driving microprocessor
JPH04143833A (en) Timer circuit for microcomputer
JPH01280918A (en) Interval timer
JPH0728662A (en) Microcomputer
JPH0427730B2 (en)