JPH0392904A - Programmable controller - Google Patents

Programmable controller

Info

Publication number
JPH0392904A
JPH0392904A JP23109589A JP23109589A JPH0392904A JP H0392904 A JPH0392904 A JP H0392904A JP 23109589 A JP23109589 A JP 23109589A JP 23109589 A JP23109589 A JP 23109589A JP H0392904 A JPH0392904 A JP H0392904A
Authority
JP
Japan
Prior art keywords
reference clock
time
timer
user program
processing
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.)
Granted
Application number
JP23109589A
Other languages
Japanese (ja)
Other versions
JP2906254B2 (en
Inventor
Shunji Kuwa
桑 俊司
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.)
Omron Corp
Original Assignee
Omron Corp
Omron Tateisi Electronics Co
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 Omron Corp, Omron Tateisi Electronics Co filed Critical Omron Corp
Priority to JP23109589A priority Critical patent/JP2906254B2/en
Priority to DE69016718T priority patent/DE69016718T2/en
Priority to AT90115524T priority patent/ATE118283T1/en
Priority to EP90115524A priority patent/EP0416330B1/en
Priority to US07/566,096 priority patent/US5325514A/en
Priority to ES90115524T priority patent/ES2067605T3/en
Publication of JPH0392904A publication Critical patent/JPH0392904A/en
Application granted granted Critical
Publication of JP2906254B2 publication Critical patent/JP2906254B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Programmable Controllers (AREA)

Abstract

PURPOSE:To improve precision for executing a timer instruction by measuring the execution time of a user program for each cycle time, generating an interruption signal when the program execution time exceeds the minimum measuring time of a reference clock, and executing an updata processing to the current value of a timer element while referring the reference clock. CONSTITUTION:A programmable controller is composed of a CPU 2, system memory 3, work memory 4, user program memory 5, I/O memory 6, clock generating means 8, interface circuit 9 and cycle time measuring means 7. A common processing, the execution processing of the user program and an I/O refresh processing are cyclically executed and for each cycle time when these processings are once turned around, the execution time of the user program is measured. When the program execution time exceeds the minimum measuring time of the reference clock, the interruption signal is generated. When the interruption signal is generated, the update processing is executed to the current value of the timer element is executed by referring the reference clock. Thus, the delay of the update processing based on the reference clock is prevented and the precision can be made exact for executing the timer instruction.

Description

【発明の詳細な説明】 《産業上の利用分野〉 この発明は、内蔵した基準クロックにもとづいて作動す
るタイマ命令機能を有するプログラマフル・コントロー
ラ(以下PCと言う)に関する。
DETAILED DESCRIPTION OF THE INVENTION <<Industrial Application Field>> The present invention relates to a programmable controller (hereinafter referred to as PC) having a timer instruction function that operates based on a built-in reference clock.

《従来の技術〉 タイマ命令機能を有するPCにおいてタイマ要素の現在
値をデクリメント、またはインクリメントする更新処理
は、内蔵する基準クロックにもとづいておこなわれてい
る.基準クロックは一定周期で状態値が反転するように
構成されており、この基準クロックの状態値を、あらか
じめ定められたタイ果ングでチェックし、基準クロック
の状態値が、前回にチェックしたときと異なっていれば
、更新必要と判断しタイマ要素の現在値を更新する.前
回にチェックしたときと同じであれば、更新不要と判断
しタイマ要素の現在値を更新しない。
<<Prior Art>> In a PC having a timer instruction function, update processing for decrementing or incrementing the current value of a timer element is performed based on a built-in reference clock. The reference clock is configured so that its state value is inverted at regular intervals, and the state value of this reference clock is checked at a predetermined tie interval to ensure that the state value of the reference clock is the same as the last time it was checked. If they are different, it is determined that updating is necessary and the current value of the timer element is updated. If it is the same as the last time it was checked, it is determined that no update is necessary and the current value of the timer element is not updated.

ここでタイマ更新を判断するタイミングには、ユーザプ
ログラム実行中のタイマ要素命令実行時である場合と、
ユーザプログラムの実行が一巡した後の共通処理中であ
る場合とがある.《発明が解決しようとする課題〉 しかしながら、タイマ更新タイジングが前者の場合、第
6図に示すように、タイマ命令の実行間隔が基準クロッ
クの最小計測時間であるカウント単位(図では100m
s)以上に延びてしまうと、前回と今回の基準クロック
の値がともにオンであるため、100ms以上経過した
にもかかわらず、タイマ更新がおこなわれないことがあ
る.同様に後者の場合も、第7図に示すように、プログ
ラム実行に要するスキャンタイムが基準クロックのカウ
ント単位(図では100μs)以上に延びてしまうと、
■のタイミングに示すように100ms以上経過したに
もかかわらず、前回と今回の基準クロンクの値が同じ値
であるため、更新値が0、すなわちタイマ更新がおこな
われないことがある。
Here, the timing to determine the timer update is when the timer element instruction is executed while the user program is running;
There are cases where common processing is in progress after the user program has completed one cycle of execution. <<Problems to be Solved by the Invention>> However, in the case of the former timer update timing, as shown in FIG.
If it extends beyond s), the timer may not be updated even though more than 100 ms has passed since the previous and current reference clock values are both on. Similarly, in the latter case, as shown in Figure 7, if the scan time required for program execution extends beyond the reference clock count unit (100 μs in the figure),
As shown in the timing (2), even though 100 ms or more has elapsed, since the previous and current reference clock values are the same, the updated value may be 0, that is, the timer may not be updated.

これらの現象はユーザプログラム処理量が多くなるに従
い発生頻度が多くなり、タイマ命令の実行タイミングを
遅らせてしまうという問題になっていた。
These phenomena occur more frequently as the amount of user program processing increases, resulting in a problem of delaying the execution timing of timer instructions.

そこでこの発明は上記の問題を解消するためになされた
もので、その目的とするところは、ユーザプログラム処
理時間が長くなった場合でも、基準クロックにもとづく
更新処理の遅れを防止してタイマ命令の実行精度を正確
にしたPCを提供することにある。
Therefore, the present invention was made to solve the above problem, and its purpose is to prevent delays in update processing based on the reference clock even when the user program processing time becomes long, and to prevent the timer instruction from being delayed. The purpose is to provide a PC with accurate execution accuracy.

《課題を解決するための手段》 この発明は上記目的を達威するために、内蔵する基準ク
ロックによりタイマ命令に設定されたタイマ要素の現在
値を更新処理するプログラマブル・コントローラにおい
て、サイクルタイムごとにユーザプログラムの実行時間
を計測する手段と、計測されたプログラム実行時間と基
準クロックの最小計測時間とを比較しプログラム実行時
間が基準クロックの最小計測時間を越えた場合に割込み
信号を発生する手段と、割込み信号が発生したことによ
り基準クロックを参照してタイマ要素の現在値を更新処
理する手段を備えたことを特徴とする。
<Means for Solving the Problems> In order to achieve the above object, the present invention provides a programmable controller that updates the current value of a timer element set in a timer instruction using a built-in reference clock. means for measuring the execution time of the user program; and means for comparing the measured program execution time with a minimum measurement time of a reference clock and generating an interrupt signal when the program execution time exceeds the minimum measurement time of the reference clock. The present invention is characterized by comprising means for updating the current value of a timer element by referring to a reference clock when an interrupt signal is generated.

《作 用〉 この発明においては、サイクルタイムごとにユーザプロ
グラムの実行時間を計測し、プログラム実行時間が基準
クロックの最小計測時間を越えた場合に割込み信号を発
生する.割込み信号が発生すると、基準クロックを参照
して、タイマ要素の現在値を更新処理し、プログラム実
行時間が長引いた場合にもタイマ要素の更新処理を省く
ことがなくなる. (実施例〉 次に、この発明の実施例を図面にもとづいて説明する. 第1図は、この発明が適用されるPCのハードウェア構
戒を示すブロック図である. このPCは周知のように、バスlにより接続されたCP
U2、システムメモリ3、ワークメモリ4、ユーザプロ
グラムメモリ5、I/Oメモリ6、クロック発生手段8
、インターフェース回路9と、この発明の特徴であるサ
イクルタイム計測手段7とから構威されている.またイ
ンターフェース回路9には、外部の入出力機器11.1
2等が接続されている. このPCはシステムメモリ3に記憶されているシステム
プログラムを、CPU2が実行することでPCとしての
各種機能が実現される。
<Operation> In this invention, the execution time of the user program is measured for each cycle time, and an interrupt signal is generated when the program execution time exceeds the minimum measurement time of the reference clock. When an interrupt signal is generated, the current value of the timer element is updated by referring to the reference clock, so that the update process of the timer element is not omitted even if the program execution time is prolonged. (Example) Next, an example of the present invention will be described based on the drawings. Fig. 1 is a block diagram showing the hardware configuration of a PC to which this invention is applied. CP connected by bus l to
U2, system memory 3, work memory 4, user program memory 5, I/O memory 6, clock generation means 8
, an interface circuit 9, and a cycle time measuring means 7, which is a feature of the present invention. The interface circuit 9 also includes external input/output devices 11.1.
2nd class is connected. This PC realizes various functions as a PC by having a CPU 2 execute a system program stored in a system memory 3.

第2図は、上述したPCの動作の概略をあらわすゼネラ
ルフローチャートである。
FIG. 2 is a general flowchart showing an outline of the operation of the PC described above.

図に示すように、共通処理、ユーザプログラムの実行処
理、I/Oリフレッシュ処理がサイクリックに実行され
ることを示し、これらの処理が一巡する時間をサイクル
タイムという. 次にこの発明の具体的な動作を、第3図のフローチャー
トにもとづいて説明する. 先ず、ユーザプログラム実行開始とともに、実行時間の
計測を開始する(ステップ301).ユーザプログラム
を所定量、実行したとことろで(ステップ302)、実
行時間の計測値がクロック発生手段8から発生する基準
クロックの最小単位時間である100++s以上である
か否かをチェックする(ステンプ304)。実行時間の
計測値が最小単位時間100IIIsをオーバしない場
合は(ステップ304否定)、オーバするまでステンプ
302〜304を繰返す. 実行時間の計測値が最小単位時間100msをオーバし
た場合は(ステップ304肯定)、割り込み処理により
ユーザプログラムに設定されているタイマの現在値を更
新し(ステップ305)、実行時間の計測値をリセット
して(ステップ306)、再度ユーザプログラムの実行
処理および実行時間の監視を続ける(ステップ302〜
306).これらの処理をサイクルタイムが終了し共通
処理に移行するまで繰り返す。
As shown in the figure, common processing, user program execution processing, and I/O refresh processing are executed cyclically, and the time it takes for these processing to complete one cycle is called cycle time. Next, the specific operation of this invention will be explained based on the flowchart shown in FIG. First, when the user program starts executing, measurement of execution time is started (step 301). After the user program has been executed for a predetermined amount (step 302), it is checked whether the measured value of the execution time is 100++ seconds or more, which is the minimum unit time of the reference clock generated from the clock generation means 8 (step 302). 304). If the measured value of the execution time does not exceed the minimum unit time 100IIIs (No in step 304), steps 302 to 304 are repeated until the execution time exceeds the minimum unit time 100IIIs. If the measured value of the execution time exceeds the minimum unit time of 100 ms (Yes at step 304), update the current value of the timer set in the user program by interrupt processing (step 305), and reset the measured value of the execution time. (step 306), and continues to monitor the execution process and execution time of the user program (steps 302 to 306).
306). These processes are repeated until the cycle time ends and the process shifts to common processing.

なお、ステップ302に設定されるユーザプログラムの
実行量は、基準クロンクの最小単位時間にくらべて充分
に小さい量である。
Note that the amount of execution of the user program set in step 302 is a sufficiently smaller amount than the minimum unit time of the reference clock.

また、上記のユーザプログラム実行処理後の共通処理に
おいても、従来と同様に基準クロックを監視してタイマ
を更新する処理がおこなわれる.第4図は、他の実施例
を示すフローチャートである. この実施例では、ユーザプログラムの実行開始に先立ち
、割り込みタイマをリセットし、(ステップ401)、
さらに割り込みマスクを解除しておく(ステップ402
). 次いで、ユーザプログラムの実行を開始しする(ステッ
プ403).この間、ユーザプログラムの実行時間を割
り込みタイマにより監視し、所定時間が経過したら割り
込みによりタイマの現在値を更新する(ステップ404
).さらに、割り込みタイマをリセットしてから(ステ
ップ405)、ユーザプログラム実行にリターンする(
ステップ406). 以後これらの処理を繰り返すことにより、ユーザプログ
ラムの実行時間が長くなった場合でもタイマの更新が省
かれなくなる。
Also, in the common processing after the user program execution processing described above, the processing of monitoring the reference clock and updating the timer is performed as in the past. FIG. 4 is a flowchart showing another embodiment. In this embodiment, before starting execution of the user program, an interrupt timer is reset (step 401),
Furthermore, the interrupt mask is canceled (step 402).
). Next, execution of the user program is started (step 403). During this time, the execution time of the user program is monitored by an interrupt timer, and when a predetermined time has elapsed, the current value of the timer is updated by an interrupt (step 404).
). Furthermore, after resetting the interrupt timer (step 405), the process returns to user program execution (
Step 406). By repeating these processes thereafter, updating of the timer will not be omitted even if the execution time of the user program becomes long.

第5図は、上記実施例の処理経過を示したタイミングチ
ャートである. 図に示すように、命令実行処理の先頭から時間を計測し
、Loomsを経過した時点の割り込みでクロックの反
転をおこなう前に、記憶していたTIMNI1について
現在値の更新処理をおこなう。経過時間の計測はリセッ
トしたうえで継続する.上記実施例は以上のように構威
したことにより、次のような利点が得られる. (】)タイマ要素の現在値を更新するタイミング間隔の
変動にかかわらず、タイマ要素の現在値が狂わなくなる
. (2)基準クロックの最小計測時間をタイマ要素の最小
計測単位時間より小さくしなくても、現在値の誤差を少
な《することができる. (3)ユーザプログラムの実行処理時間が基準クロツク
の最小計測単位時間より大きくなったとき以外は、通常
の実行手順で更新処理されるため、通常時でのオーバヘ
ッド時間はほとんどない。
FIG. 5 is a timing chart showing the processing progress of the above embodiment. As shown in the figure, time is measured from the beginning of the instruction execution process, and before the clock is inverted at the interrupt when Looms has passed, the current value of the stored TIMNI1 is updated. Measurement of elapsed time will continue after being reset. By constructing the above embodiment as described above, the following advantages can be obtained. (]) The current value of the timer element will no longer be incorrect, regardless of changes in the timing interval for updating the current value of the timer element. (2) The error in the current value can be reduced without making the minimum measurement time of the reference clock smaller than the minimum measurement unit time of the timer element. (3) Except when the execution processing time of the user program becomes longer than the minimum measurement unit time of the reference clock, update processing is performed according to the normal execution procedure, so there is almost no overhead time in normal times.

《発明の効果} 以上のようにこの発明は、サイクルタイムごとにユーザ
プログラムの実行時間を計測し、プログラム実行時間が
基準クロックの最小計測時間を越えた場合に割込み信号
を発生する.割込み信号が発生すると、基準クロックを
参照して、タイマ要素の現在値を更新処理するように構
威したことにより、ユーザプログラム処理時間が長くな
った場合でも、基準クロツクにもとづく更新処理の遅れ
を防止してタイマ命令の実行精度を正確にすることがで
きる.
<<Effects of the Invention>> As described above, the present invention measures the execution time of a user program at each cycle time, and generates an interrupt signal when the program execution time exceeds the minimum measurement time of the reference clock. When an interrupt signal is generated, the current value of the timer element is updated by referring to the reference clock, so even if the user program processing time becomes longer, the delay in update processing based on the reference clock can be avoided. It is possible to prevent this and improve the accuracy of timer instruction execution.

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

第1図はこの発明が適用されるPCのハードウェア構威
を示すブロック図、第2図は動作の概略をあらわすゼネ
ラルフローチャート、第3図は動作を示すフローチャー
ト、第4図は同しく他の実施例を示すフローチャート、
第5図は処理経過を示したタイξングチャート、第6図
および第7図は従来例を示すタイミングチャートである
.l・・・バス 2・・・CPU 3・・・システムメモリ 4・・・ワークメモリ 5・・・ユーザプログラムメモリ 6・・・■/○メモリ 7・・・サイクルタイム計測手段 8・・・クロック発生手段 9・・・インターフェース回路 1 1・・・入出力機器 12・・・入出力機器
Fig. 1 is a block diagram showing the hardware configuration of a PC to which this invention is applied, Fig. 2 is a general flowchart showing an outline of the operation, Fig. 3 is a flowchart showing the operation, and Fig. 4 is a general flowchart showing the outline of the operation. A flowchart showing an example,
FIG. 5 is a timing chart showing the processing progress, and FIGS. 6 and 7 are timing charts showing conventional examples. l...Bus 2...CPU 3...System memory 4...Work memory 5...User program memory 6...■/○ Memory 7...Cycle time measuring means 8...Clock Generating means 9... Interface circuit 1 1... Input/output device 12... Input/output device

Claims (1)

【特許請求の範囲】 1、内蔵する基準クロックにより、タイマ命令に設定さ
れたタイマ要素の現在値を更新処理するプログラマブル
・コントローラにおいて、 サイクルタイムごとにユーザプログラムの実行時間を計
測する手段と、 計測されたプログラム実行時間と基準クロックの最小計
測時間とを比較し、プログラム実行時間が基準クロック
の最小計測時間を越えた場合に割込み信号を発生する手
段と、 割込み信号が発生したことにより基準クロックを参照し
てタイマ要素の現在値を更新処理する手段と、 を備えたことを特徴とするプログラマブル・コントロー
ラ。
[Claims] 1. In a programmable controller that updates the current value of a timer element set in a timer instruction using a built-in reference clock, means for measuring the execution time of a user program for each cycle time; A means for comparing the specified program execution time with the minimum measurement time of the reference clock and generating an interrupt signal when the program execution time exceeds the minimum measurement time of the reference clock; A programmable controller comprising: means for referencing and updating the current value of a timer element;
JP23109589A 1989-09-06 1989-09-06 Programmable controller Expired - Lifetime JP2906254B2 (en)

Priority Applications (6)

Application Number Priority Date Filing Date Title
JP23109589A JP2906254B2 (en) 1989-09-06 1989-09-06 Programmable controller
DE69016718T DE69016718T2 (en) 1989-09-06 1990-08-13 Programmable control device.
AT90115524T ATE118283T1 (en) 1989-09-06 1990-08-13 PROGRAMMABLE CONTROL DEVICE.
EP90115524A EP0416330B1 (en) 1989-09-06 1990-08-13 Programmable controller
US07/566,096 US5325514A (en) 1989-09-06 1990-08-13 Program executive timing apparatus for ensuring that state changes of a reference clock signal used to time the execution of the program are not missed
ES90115524T ES2067605T3 (en) 1989-09-06 1990-08-13 PROGRAMMABLE CONTROLLER.

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP23109589A JP2906254B2 (en) 1989-09-06 1989-09-06 Programmable controller

Publications (2)

Publication Number Publication Date
JPH0392904A true JPH0392904A (en) 1991-04-18
JP2906254B2 JP2906254B2 (en) 1999-06-14

Family

ID=16918216

Family Applications (1)

Application Number Title Priority Date Filing Date
JP23109589A Expired - Lifetime JP2906254B2 (en) 1989-09-06 1989-09-06 Programmable controller

Country Status (1)

Country Link
JP (1) JP2906254B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1996021180A1 (en) * 1994-12-29 1996-07-11 Siemens Energy & Automation, Inc. Dynamic user interrupt scheme in a programmable logic controller

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1996021180A1 (en) * 1994-12-29 1996-07-11 Siemens Energy & Automation, Inc. Dynamic user interrupt scheme in a programmable logic controller

Also Published As

Publication number Publication date
JP2906254B2 (en) 1999-06-14

Similar Documents

Publication Publication Date Title
US5367550A (en) Break address detecting circuit
JPH0392904A (en) Programmable controller
JP2924154B2 (en) Time measurement method
JP2527809B2 (en) Programmable controller and its timing processing method
JP3538358B2 (en) Programmable controller
US5325514A (en) Program executive timing apparatus for ensuring that state changes of a reference clock signal used to time the execution of the program are not missed
JPH05233277A (en) Microprocessor
JP2000074962A (en) Cycle-measuring device and method therefor, and storage medium
JPH0366847B2 (en)
KR950013602B1 (en) Frequency measuring device
JP2631541B2 (en) Programmable controller
JPH0573296A (en) Microcomputer
JPH06259115A (en) Programmable controller
JPH0769728B2 (en) Programmable controller
JPH0683652A (en) Microcomputer system
JPS63269239A (en) Processor load measuring system
JPH0392905A (en) Programmable controller
JP2001092692A (en) Circuit and method for measuring time
JPH0782370B2 (en) Sequencer timer processor
JPH0380304A (en) Timer/counter processing method for sequence process
JPH02267642A (en) Measuring device for time exclusive for cpu
JPH01119804A (en) Scan time fixing system for programmable controller
JP2675226B2 (en) Timing adjustment method
JPH0450616B2 (en)
JPH0584547B2 (en)

Legal Events

Date Code Title Description
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090402

Year of fee payment: 10

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100402

Year of fee payment: 11

EXPY Cancellation because of completion of term
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100402

Year of fee payment: 11