JPH052412A - Control program execution system for programmable controller - Google Patents

Control program execution system for programmable controller

Info

Publication number
JPH052412A
JPH052412A JP3181790A JP18179091A JPH052412A JP H052412 A JPH052412 A JP H052412A JP 3181790 A JP3181790 A JP 3181790A JP 18179091 A JP18179091 A JP 18179091A JP H052412 A JPH052412 A JP H052412A
Authority
JP
Japan
Prior art keywords
scan
execution
cycle
control program
priority
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
JP3181790A
Other languages
Japanese (ja)
Other versions
JP3085318B2 (en
Inventor
Kazumi Kubo
和美 久保
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.)
Yaskawa Electric Corp
Original Assignee
Yaskawa 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 Yaskawa Electric Corp filed Critical Yaskawa Electric Corp
Priority to JP03181790A priority Critical patent/JP3085318B2/en
Publication of JPH052412A publication Critical patent/JPH052412A/en
Application granted granted Critical
Publication of JP3085318B2 publication Critical patent/JP3085318B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PURPOSE:To secure the regularity of the scanning cycle by receiving a program start command from a 2nd start means not from a 1st start command means as long as a control program is not complete yet when a start command is received from a 1st start program. CONSTITUTION:It is checked in a step 2a whether a host scan state flag is scanned to much or not. If the host scan processing exceeds a host scanning period, the procedure proceeds to a step 2b and otherwise to a step 2e. Then a fact whether a follower scan state flag is scanned too much or not is checked. The follower scan processing of the lower priority is kept waiting until a 2nd start means produces a start request signal with the next periodical interruption. The 2nd start means finishes its operation if the excessive scanning cycles are not set for both scan state flags.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、プログラマブル・コン
トローラにおける制御プログラム実行方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a control program execution system in a programmable controller.

【0002】[0002]

【従来の技術】近年、産業用設備の制御システムにおい
て、システムの高速化、高性能化が進み、プログラマブ
ル・コントローラ(以下、PCと呼ぶ)の制御内容も複
雑化してきたため、PCによる制御内容は、それぞれの
制御対象に対する応答時間毎に分割して実行されてい
る。PCによる動作は、外部からの入力データを入力部
を通して取り込み、データ・メモリに記憶し、制御プロ
グラムに従って各種演算処理を行い、演算処理終了後、
データ・メモリに置かれた内容で外部に出力すべきデー
タを出力部を通して外部に出力する。以上の動作シーケ
ンスを1スキャンと呼び、応答時間毎に分割された制御
プログラムは、それぞれ独立に予め定められたスキャン
周期で繰り返し実行される。
2. Description of the Related Art In recent years, in a control system for industrial equipment, the speed and performance of the system have advanced, and the control contents of a programmable controller (hereinafter referred to as PC) have become complicated. , Are divided and executed for each response time for each controlled object. The operation by the PC is to take in input data from the outside through the input section, store it in the data memory, perform various arithmetic processing according to the control program, and after the arithmetic processing is completed,
The data stored in the data memory, which should be output to the outside, is output to the outside through the output unit. The above operation sequence is called one scan, and the control program divided for each response time is repeatedly executed independently at a predetermined scan cycle.

【0003】各スキャンは、PC内部の制御機構によ
り、PC内部の中央処理装置(以下、CPUと呼ぶ)に
対する割り込みによって駆動され、その優先順位は、よ
り高速な応答を必要とするものほど高く設定されてい
る。従って、優先順位が上位のスキャン(以下、上位ス
キャンと呼ぶ)はそれより優先順位が下位のスキャン
(以下、下位スキャンと呼ぶ)に割り込んで実行され
る。当然のことながら下位スキャンは上位スキャンの実
行中には割り込めず待機状態となる。一般的に各スキャ
ンに予め設定されたスキャン周期は、そのスキャン処理
実行時間より長く設定される。しかし、制御対象の一時
的な変動や外部入出力機器の故障などにより、各スキャ
ンの処理実行時間が予め設定されたスキャン周期を超過
してしまうことがある。このような場合、各スキャンは
前述したごとくCPUへの割り込み要求によって起動さ
れることから、同一優先順位をもつスキャンの割り込み
要求が発生しても、当然ながらその優先順位をもつスキ
ャンの処理が終了するまでは受け付けられない。
Each scan is driven by an interrupt to a central processing unit (hereinafter referred to as a CPU) inside the PC by a control mechanism inside the PC, and its priority is set higher for those requiring a faster response. Has been done. Therefore, a scan having a higher priority (hereinafter, referred to as a higher scan) is executed by interrupting a scan having a lower priority (hereinafter, referred to as a lower scan). As a matter of course, the lower scan cannot be interrupted during execution of the upper scan and is in a standby state. Generally, the scan cycle set in advance for each scan is set longer than the scan processing execution time. However, the processing execution time of each scan may exceed the preset scan cycle due to a temporary fluctuation of the control target or a failure of the external input / output device. In such a case, since each scan is activated by an interrupt request to the CPU as described above, even if an interrupt request for a scan having the same priority occurs, the processing for the scan having that priority will naturally end. It will not be accepted until.

【0004】[0004]

【発明が解決しようとする課題】このように同一優先順
位をもつスキャン処理を実行中に発生した割り込み要求
は無視されることになり、次の起動要求の割り込み発生
まで実行が停滞することになる(図4)。そのため、P
Cを用いたモータ制御における直線加速指令やPI制御
など、時間要素を含んだ演算処理においては、安定した
制御性能を得ることができず、さらに、外部入出力機器
に対しての応答周期のバラツキも大きくなるなどの欠点
がある。また、予め定められたスキャン周期を超過した
場合、定周期性を確保するための手段として、各スキャ
ン処理の実行終了時に当該スキャンの起動要求が発生し
ていれば、直ちに当該スキャンを始動する方式を用いて
いるPCもあるが、この場合上位スキャンで連続してス
キャン周期の超過が起こると下位スキャンの実行渋滞が
発生してしまうという欠点がある。そこで本発明の解決
すべき課題は、このような従来技術の欠点を解消し、P
Cのスキャン周期の定周期性を確保する制御プログラム
の実行方式を提供することである。
The interrupt request generated during execution of the scan processing having the same priority in this way is ignored, and execution is delayed until the next interrupt of the activation request is generated. (Fig. 4). Therefore, P
In arithmetic processing including a time element such as linear acceleration command and PI control in motor control using C, stable control performance cannot be obtained, and further, variation in response cycle to external input / output devices. Also has the drawback of becoming larger. When a predetermined scan cycle is exceeded, a method for immediately starting the scan if a scan start request is generated at the end of execution of each scan process as a means for ensuring the periodicity. Although some PCs use the above, in this case, there is a drawback in that if the scan cycle continuously exceeds in the upper scan, the execution congestion of the lower scan occurs. Therefore, the problem to be solved by the present invention is to solve the above drawbacks of the prior art,
An object of the present invention is to provide an execution method of a control program that secures the regularity of the C scan cycle.

【0005】[0005]

【課題を解決するための手段】この課題を解決するため
に、本発明のプログラマブル・コントローラにおける制
御プログラムの実行方式は、外部の信号を取り込むため
の入力部と、外部へ信号を出力するための出力部と、デ
ータ・メモリ部と、制御プログラムを記憶しているプロ
グラム・メモリ部と、各々が予め設定された優先順位を
持ち、前記優先順位毎に予め設定されたスキャン周期を
持つ第一の起動手段により制御される複数の制御プログ
ラムを実行する演算部とを有するプログラマグル・コン
トローラにおいて、前記スキャン周期毎に当該優先順位
の実行状態を保持する手段と、定周期で動作する複数の
制御プログラムに共通の第二の起動手段とを備え、前記
第一の起動手段から起動指令を受けたとき当該制御プロ
グラムの実行が未完のときは、そのプログラムの起動指
令を第一の起動手段から受信せず、第二の起動手段から
受信するようにしたものである。
In order to solve this problem, a control program execution system in a programmable controller according to the present invention has an input section for receiving an external signal and an output section for outputting the signal to the outside. An output unit, a data memory unit, a program memory unit storing a control program, each having a preset priority, and a first scan cycle having a preset scan cycle for each priority. In a programmable controller having an arithmetic unit that executes a plurality of control programs controlled by a starting unit, a unit that holds the execution state of the priority for each scan cycle, and a plurality of control programs that operate in a fixed cycle. And a second starting means common to all the control programs, and when the start command is received from the first starting means, the control program is not executed yet. When the not receive the activation instruction of the program from the first actuation means, in which so as to receive from the second actuation means.

【0006】[0006]

【作用】このような手段を用いることにより、PCのス
キャン処理実行の定周期性が確保され、時間要素を含む
演算処理において安定した制御性能を得ることができ
る。
By using such means, it is possible to secure the regularity of the execution of the scan processing of the PC and to obtain stable control performance in the arithmetic processing including the time element.

【0007】[0007]

【実施例】以下、本発明の実施例について図を参照して
説明する。図1は、優先順位の実行状態を保持する手段
の動作について説明したフローチャートである。予め定
められた各スキャン周期毎に割り込みが発生したときに
処理が行われ、まず、現在実行中のスキャン処理は同一
優先順位か否かを調べる(ステップ1a)。同一優先順位
のスキャン処理で実行していれば各スキャン状態フラグ
にスキャン超過フラグをセットして(ステップ1b)終了
する。同一優先順位のスキャン処理を実行中でなけれ
ば、現在実行中のスキャン処理の優先順位は自分より高
いか否かを調べ(ステップ1c)、高ければスキャン処理
起動要求フラグをセットする(ステップ1d)。低ければ
当該スキャン処理の実行を開始する(ステップ1e)。ス
キャン処理起動要求フラグは、上位スキャン処理終了し
て下位スキャン処理に移行するときに用いられる。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a flow chart for explaining the operation of the means for holding the execution state of the priority order. Processing is performed when an interrupt occurs at each predetermined scan cycle. First, it is checked whether or not the currently executed scan processing has the same priority (step 1a). If the scan processes of the same priority are being executed, the scan excess flag is set in each scan state flag (step 1b), and the process ends. If the scan processing with the same priority is not being executed, it is checked whether or not the priority of the scan processing currently being executed is higher than that of itself (step 1c), and if it is higher, the scan processing start request flag is set (step 1d). .. If it is lower, execution of the scan process is started (step 1e). The scan process activation request flag is used when the upper scan process ends and the process shifts to the lower scan process.

【0008】次に、優先順位実行状態保持手段で当該ス
キャン処理起動要求時にセットされたスキャン状態フラ
グを定周期で起動指令を発生する第二の起動手段の動作
を図2のフローチャートで説明する。定周期の時間設定
は、各優先順位に予め設定されたスキャン周期よりも十
分短い値とすることが、各スキャンの定周期性を確保す
ることから望ましい。また、時間設定はシステム的に固
定とすることも可変とすることも可能である。まず、上
位スキャン状態フラグがスキャン超過であるか調べ(ス
テップ2a)上位スキャン処理が上位スキャン周期を超過
していれば、現在のスキャン処理は上位スキャン処理か
を調べ(ステップ2b)上位スキャン処理を実行中であれ
ば、引続き処理を継続するため第二の起動手段の動作を
終了する。上位スキャン処理が上位スキャン周期を超過
して、かつ、現在実行中の処理が上位スキャン処理でな
ければ、上位スキャン状態フラグをリセットして(ステ
ップ2c)直ちに上位スキャン処理の起動に移る(ステッ
プ2d)。上位スキャン状態フラグを調べ、上位スキャン
処理がそのスキャン周期を超過していなければ、下位ス
キャン状態フラグが、スキャン超過であるか調べる(ス
テップ2e)。下位スキャン処理がそのスキャン周期を超
過していれば、現在実行中の処理は、上位スキャン処理
かを調べ(ステップ2f)上位スキャン処理実行中であれ
ば、第二の起動手段の動作は終了する。すなわち、優先
順位の低い下位スキャン処理は、次の定周期割り込み
で、第二の起動手段が起動要求信号を発生するまで待つ
ことになる。現在実行中の処理が上位スキャンでなけれ
ば、下位スキャン処理実行中であるか調べ(ステップ2
g)、下位スキャン処理を実行中であれば第二の起動手
段の動作は終了する。現在実行中の処理が下位スキャン
処理でなければ、下位スキャン状態フラグをリセットし
(ステップ2h)、直ちに下位スキャン処理の起動に移
る。(ステップ2i)。上位スキャン状態フラグと下位ス
キャン状態フラグが共に、スキャン周期の超過がセット
されていなければ、第二の起動手段の動作は終了する。
Next, the operation of the second activating means for generating the activating command for the scan state flag set at the time of the scan processing activation request by the priority order executability retaining means in a fixed cycle will be described with reference to the flow chart of FIG. It is desirable to set the fixed-cycle time to a value that is sufficiently shorter than the scan cycle preset for each priority in order to ensure the fixed-cycle property of each scan. Further, the time setting can be fixed or variable systematically. First, it is checked whether the upper scan status flag is over scan (step 2a). If the upper scan processing exceeds the upper scan cycle, it is checked whether the current scan processing is the upper scan processing (step 2b). If it is being executed, the operation of the second activating means is ended to continue the processing. If the upper scan process exceeds the upper scan cycle and the process currently being executed is not the upper scan process, the upper scan state flag is reset (step 2c) and immediately the upper scan process is started (step 2d). ). The upper scan status flag is checked, and if the upper scan processing does not exceed the scan cycle, it is checked whether the lower scan status flag is over scan (step 2e). If the lower scan process exceeds the scan cycle, it is checked whether the process currently being executed is the upper scan process (step 2f). If the upper scan process is being executed, the operation of the second activating means ends. .. That is, the lower-order scan process having the lower priority order waits until the second activation means generates the activation request signal at the next fixed-cycle interrupt. If the process currently being executed is not the upper scan, check whether the lower scan is being executed (step 2
g) If the lower scan processing is being executed, the operation of the second activating means ends. If the process currently being executed is not the lower scan process, the lower scan state flag is reset (step 2h) and immediately the lower scan process is started. (Step 2i). If neither the upper scan state flag nor the lower scan state flag is set to exceed the scan cycle, the operation of the second activating means ends.

【0009】図3は、本発明の実施例に基づいたスキャ
ン処理の動作タイム・チャートの1例を示している。予
め定められた実行周期で上位スキャン処理起動要求の割
り込みが発生すると、その時点で発生した要求の受付が
可能かどうか、前述の優先順位の実行状態を保持する動
作フローチャートのステップ1a、ステップ1cで調べ、実
行可能であるため、直ちに上位スキャン処理の実行に移
る(3a)。上位スキャン処理実行中に、再度当該上位ス
キャン処理起動要求の割り込みが発生すると(3b)、前
述ステップ1aのごとく上位スキャン状態フラグにスキャ
ン超過をセットし、そのまま当該上位スキャン処理を継
続する。その後、上位スキャン処理の実行が終了し、下
位スキャン処理に実行が遷移したのち、定周期信号によ
る割り込みが発生し、第二の起動手段が動作すると、前
述の第二の起動手段の動作フローチャートのステップ2
a,で上位スキャン状態フラグにスキャン超過がセット
されているため、以下、ステップ2b,2c,2dと進み、直
ちに下位スキャンの実行を中断し、上位スキャンの実行
に移る(3c)。
FIG. 3 shows an example of an operation time chart of the scanning process according to the embodiment of the present invention. When an interrupt of the upper scan processing start request occurs at a predetermined execution cycle, whether the request that occurred at that time can be accepted, step 1a of the operation flowchart that holds the execution state of the above priority order, step 1c Since it is possible to investigate and execute, immediately move to execution of the upper scan processing (3a). When an interrupt of the upper scan processing activation request occurs again during execution of the upper scan processing (3b), the upper scan state flag is set to scan excess as in step 1a, and the upper scan processing is continued as it is. After that, the execution of the upper scan process is completed, and after the execution transitions to the lower scan process, an interrupt is generated by the fixed-cycle signal and the second activating means operates. Step two
Since the excess scan is set in the upper scan state flag at a, the process proceeds to steps 2b, 2c, and 2d, and the execution of the lower scan is immediately interrupted and the execution of the upper scan is started (3c).

【0010】[0010]

【発明の効果】以上述べたように、本発明によれば、各
スキャン処理実行時間の超過による周期の乱れを最小限
におさえ、PCのスキャン動作において定周期性を確保
することができ、PCのあらゆる応用分野において安定
した制御性能が得られる。
As described above, according to the present invention, the periodicity can be ensured in the scan operation of the PC while minimizing the disturbance of the cycle due to the excess of the execution time of each scan process. Stable control performance can be obtained in all application fields.

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

【図1】本発明の優先順位の実行状態を保持する手段の
動作フローチャート
FIG. 1 is an operation flowchart of a means for holding a priority execution state of the present invention.

【図2】第2の起動手段の動作フローチャートFIG. 2 is an operation flowchart of a second starting means.

【図3】本発明の実施例に基づいたスキャン処理実行の
タイム・チャート
FIG. 3 is a time chart of execution of scan processing according to an embodiment of the present invention.

【図4】従来技術のスキャン処理実行のタイム・チャー
FIG. 4 is a time chart of execution of scan processing according to the related art.

Claims (1)

【特許請求の範囲】 【請求項1】 外部の信号を取り込むための入力部と、
外部へ信号を出力するための出力部と、データ・メモリ
部と、制御プログラムを記憶しているプログラム・メモ
リ部と、各々が予め設定された優先順位を持ち、前記優
先順位毎に予め設定されたスキャン周期を持つ第一の起
動手段により制御される複数の制御プログラムを実行す
る演算部とを有するプログラマグル・コントローラにお
いて、前記スキャン周期毎に当該優先順位の実行状態を
保持する手段と、定周期で動作する複数の制御プログラ
ムに共通の第二の起動手段とを備え、前記第一の起動手
段から起動指令を受けたとき当該制御プログラムの実行
が未完のときは、そのプログラムの起動指令を第一の起
動手段から受信せず、第二の起動手段から受信するよう
にしたことを特徴とするプログラマブル・コントローラ
における制御プログラム実行方式。
Claim: What is claimed is: 1. An input unit for capturing an external signal,
An output unit for outputting a signal to the outside, a data memory unit, and a program memory unit storing a control program, each of which has a preset priority, and each of which is preset for each priority. In a programmable controller having an arithmetic unit that executes a plurality of control programs controlled by a first starting unit having a different scan cycle, a means for holding the execution state of the priority for each scan cycle, A second starting means common to a plurality of control programs operating in a cycle is provided, and when the execution of the control program is not completed when a starting instruction is received from the first starting means, the starting instruction of the program is given. A control program in a programmable controller characterized in that it is received from the second starting means instead of being received from the first starting means. Lamb execution method.
JP03181790A 1991-06-25 1991-06-25 Control program execution method for programmable controller Expired - Fee Related JP3085318B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP03181790A JP3085318B2 (en) 1991-06-25 1991-06-25 Control program execution method for programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP03181790A JP3085318B2 (en) 1991-06-25 1991-06-25 Control program execution method for programmable controller

Publications (2)

Publication Number Publication Date
JPH052412A true JPH052412A (en) 1993-01-08
JP3085318B2 JP3085318B2 (en) 2000-09-04

Family

ID=16106919

Family Applications (1)

Application Number Title Priority Date Filing Date
JP03181790A Expired - Fee Related JP3085318B2 (en) 1991-06-25 1991-06-25 Control program execution method for programmable controller

Country Status (1)

Country Link
JP (1) JP3085318B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018063691A (en) * 2016-10-14 2018-04-19 エルエス産電株式会社Lsis Co., Ltd. Apparatus for recognizing a pulse signal

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018063691A (en) * 2016-10-14 2018-04-19 エルエス産電株式会社Lsis Co., Ltd. Apparatus for recognizing a pulse signal
US10110236B2 (en) 2016-10-14 2018-10-23 Lsis Co., Ltd. Apparatus for recognizing pulse signal

Also Published As

Publication number Publication date
JP3085318B2 (en) 2000-09-04

Similar Documents

Publication Publication Date Title
KR970016979A (en) Queuing system and method of tasks in a multiprocessing system
JP2009163658A (en) Input/output controller and its firmware update method
JP3371349B2 (en) Control processing unit
JPH052412A (en) Control program execution system for programmable controller
US20100180279A1 (en) Field control device and field control method
JP2636722B2 (en) Multitask execution management method
JPH01246602A (en) Special function unit for programmable controller
JP2656325B2 (en) I / O control method
JPH06259115A (en) Programmable controller
JP2901714B2 (en) Programmable controller
JP2673048B2 (en) Timeout monitoring processor
JPH06309180A (en) Interrupt controller for computer system
JP2665520B2 (en) Programmable controller
EP0738969A2 (en) System starter unit and method
JPH0683652A (en) Microcomputer system
JPH1195825A (en) Method for executing numerical control program
JPH0934514A (en) Multitask control system for programmable controller and multitask type programmable controller
JPH0364885B2 (en)
JPH01119804A (en) Scan time fixing system for programmable controller
JPH0553997A (en) Microcomputer
JPH03265958A (en) Input/output priority changing system
JPH03282903A (en) Task control method in communication system for programmable controller
JPH11184711A (en) Interruption processing system and device therefor and interruption processing recording medium
JPH1124944A (en) Process synchronization method
JPH04305755A (en) Batch processing method for computer system

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees