JPH0863206A - Programmable controller - Google Patents
Programmable controllerInfo
- Publication number
- JPH0863206A JPH0863206A JP6193913A JP19391394A JPH0863206A JP H0863206 A JPH0863206 A JP H0863206A JP 6193913 A JP6193913 A JP 6193913A JP 19391394 A JP19391394 A JP 19391394A JP H0863206 A JPH0863206 A JP H0863206A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- sequence control
- power failure
- program
- executed
- 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
Links
Landscapes
- Power Sources (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
- Programmable Controllers (AREA)
Abstract
(57)【要約】
【目的】命令実行中のいかなる時点に停電が発生して
も、不揮発性記憶手段へのデータの格納を正しく行うプ
ログラマブルコントローラを提供する。
【構成】プログラマブルコントローラ101 において、停
電検出信号ESG が停電を示す値になったことを検出する
と、処理F1において実行中の命令があれば実行を完了
し、続いて処理F2において次に実行すべき命令を読み出
し、処理F3において読みだ出された命令が実行済の命令
が属するシーケンス制御命令群と同一命令群にあるか否
かを判定し、同一命令群に属する場合は読みだ出された
命令を実行した後、処理F2に戻り、同一命令群にない場
合は処理F5において読みだ出された命令が格納されてい
た記憶手段の番地を不揮発性記憶手段の領域に格納する
停電時処理用プログラム314 を備える。
(57) [Abstract] [Purpose] To provide a programmable controller that correctly stores data in a non-volatile storage unit even if a power failure occurs at any point during instruction execution. [Configuration] When the programmable controller 101 detects that the power failure detection signal ESG has reached a value indicating a power failure, the execution is completed if there is an instruction being executed in process F1, and then the next process should be executed in process F2. The instruction is read, and it is determined whether the instruction read out in the process F3 is in the same instruction group as the sequence control instruction group to which the executed instruction belongs. If it belongs to the same instruction group, the instruction read out is read out. After executing, return to process F2, and if they are not in the same command group, store the address of the storage means in which the command read out in process F5 was stored in the area of the non-volatile storage means. Equipped with 314.
Description
【0001】[0001]
【産業上の利用分野】本発明は、自回路に供給する電源
の停電発生時に、制御対象の状態を記録するデータや、
シーケンス制御の途中経過を表すデータの喪失を防止す
るため、これらのデータを不揮発性記憶手段に格納する
手段を有するプログラマブルコントローラ(以下の説明
ではPCと略称する)に関する。BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to data for recording the state of a controlled object when a power failure of a power supply to its own circuit occurs,
The present invention relates to a programmable controller (abbreviated as PC in the following description) having means for storing these data in a non-volatile storage means in order to prevent the loss of data representing the progress of sequence control.
【0002】[0002]
【従来の技術】図4に停電発生時に、制御対象の状態を
記録するデータや、シーケンス制御の途中経過を表すデ
ータの喪失を防止する機能を有するPCの一例を示す。
なお以下の説明においては、 "0" または "1" に対応
される2値信号を単に信号と言う。図4の(a) におい
て、1はPCであり、PC1は制御演算手段2、プログ
ラム記憶手段3、不揮発性記憶手段4、揮発性記憶手段
5、信号入力回路6(以下の説明では単に入力回路6と
称する)、信号出力回路7(以下の説明では単に出力回
路7と称する)、電源回路8、停電検出回路9、表示手
段10とからなる。2. Description of the Related Art FIG. 4 shows an example of a PC having a function of preventing loss of data for recording the state of a controlled object and data for indicating the progress of sequence control when a power failure occurs.
In the following description, a binary signal corresponding to "0" or "1" is simply called a signal. In FIG. 4 (a), 1 is a PC, and PC1 is a control calculation means 2, a program storage means 3, a non-volatile storage means 4, a volatile storage means 5, a signal input circuit 6 (in the following description, simply an input circuit. 6), a signal output circuit 7 (hereinafter simply referred to as output circuit 7), a power supply circuit 8, a power failure detection circuit 9, and a display means 10.
【0003】プログラム記憶手段3はICROMまたは
停電時には電源が電池に切り換えられる不揮発性のRA
Mで造られ、システムプログラム31とシーケンス制御プ
ログラム32とが格納されている。制御演算手段2はプロ
グラム記憶手段3に格納されているシステムプログラム
31とシーケンス制御プログラム32とを実行し、シーケン
ス制御プログラム実行時の演算結果を制御演算手段2の
内部にある演算用レジスタ21(以下の説明ではACC21
と略記する)に残す。システムプログラム31は、入出力
や表示なとを制御する一般的なシステムプログラムと、
シーケンス制御を行うための初期設定をし、シーケンス
制御命令の実行を支援するプログラムを含む基本的なプ
ログラムである。シーケンス制御プログラム32は、PC
1によって制御される制御対象のシーケンス制御用プロ
グラムであり、シーケンス制御命令の二つ以上からなる
単位シーケンス制御命令群の1単位以上によって構成さ
れる。不揮発性記憶手4は、データの格納と読み出しが
自由に行えるRAMであって、停電時には記憶を保持す
るための電源が電池などの電源に切替えられるので、停
電しても記憶が保持される。揮発性記憶手段5はRAM
によって構成されるが、停電時には記憶か失われる。外
部から入力される信号SGは入力回路6を介して制御演算
手段2の制御のもとに入力され、信号SGが表すデータは
揮発性記憶手段5に格納される。外部に出力されるデー
タは、揮発性記憶手段5の中に設けられた出力データ領
域に格納された後、制御演算手段2の制御のもとに出力
回路7を介して出力される。電源回路8は商用の交流電
源11から電力を供給されて、PC1を構成する要素に直
流電力を供給する回路であり、交流電源11からの電力供
給が無くなった後もPC1における停電処理が完了する
のに充分な時間だけ電力を供給する能力を有する。停電
検出回路9は交流電源11の停電を半サイクル以内に検出
する能力を有する回路であり、停電の場合には、停電後
半サイクル以内に停電検出信号ESG を停電検出を表す値
にする。The program storage means 3 is an IC ROM or a non-volatile RA whose power source can be switched to a battery in case of power failure.
It is made of M and stores a system program 31 and a sequence control program 32. The control calculation means 2 is a system program stored in the program storage means 3.
31 and the sequence control program 32 are executed, and the calculation result at the time of execution of the sequence control program is calculated by the calculation register 21 inside the control calculation means 2 (ACC21 in the following description
Abbreviated as). The system program 31 is a general system program that controls input / output and display,
It is a basic program including a program for initializing settings for sequence control and supporting execution of sequence control instructions. Sequence control program 32 is a PC
It is a control target sequence control program controlled by 1, and is constituted by one or more units of a unit sequence control instruction group consisting of two or more sequence control instructions. The non-volatile memory 4 is a RAM that can freely store and read data, and the power source for holding the memory is switched to a power source such as a battery in the event of a power failure, so that the memory is retained even when a power failure occurs. The volatile storage means 5 is a RAM
Although it is composed by, it is lost in memory in case of power failure. The signal SG input from the outside is input via the input circuit 6 under the control of the control calculation means 2, and the data represented by the signal SG is stored in the volatile storage means 5. The data output to the outside is stored in the output data area provided in the volatile storage means 5, and then output via the output circuit 7 under the control of the control calculation means 2. The power supply circuit 8 is a circuit that is supplied with power from a commercial AC power supply 11 and supplies DC power to the elements that make up the PC 1, and the power outage process in the PC 1 is completed even after the power supply from the AC power supply 11 is lost. It has the ability to supply power only for a sufficient period of time. The power failure detection circuit 9 is a circuit capable of detecting a power failure of the AC power supply 11 within a half cycle. In the case of a power failure, the power failure detection signal ESG is set to a value indicating the power failure detection within the latter half cycle of the power failure.
【0004】図4の(b) は揮発性記憶手段4と不揮発性
記憶手段5の内部に格納されるデータの区分を示した図
である。図示のとおり、揮発性記憶手段5には、入力信
号が示すデータを格納する入力データ領域51と、内部リ
レー領域52と、出力リレー領域53と、一般のデータ領域
50とが設けられている。内部リレーはシーケンス制御プ
ログラムにおいて、電磁動作のリレーと同様な機能とし
て使用される、1ビットの記憶容量を有する記憶領域で
あり、出力リレーは外部への信号として出力される1ビ
ットのデータを保持する記憶領域である。不揮発性記憶
手段4には、キープリレー領域41と、一般の停電時にも
保持が必要なデータの領域40が設けられている。キープ
リレーはセット信号によって2値信号の1を記憶し、リ
セット信号によって0を記憶する1ビットの記憶領域で
あって、セットリセット・フリップフロップあるいは電
磁動作のキープリレーと同様な機能を有する。FIG. 4B is a diagram showing the division of data stored in the volatile storage means 4 and the non-volatile storage means 5. As shown in the figure, in the volatile storage means 5, an input data area 51 for storing the data indicated by the input signal, an internal relay area 52, an output relay area 53, and a general data area.
50 and are provided. The internal relay is a storage area with a 1-bit storage capacity that is used in the sequence control program as a function similar to an electromagnetically-operated relay, and the output relay holds 1-bit data output as a signal to the outside. This is the storage area for The non-volatile storage means 4 is provided with a keep relay area 41 and an area 40 of data that needs to be retained even in the case of a general power failure. The keep relay is a 1-bit storage area that stores 1 of a binary signal by a set signal and 0 by a reset signal, and has a function similar to that of a set / reset flip-flop or an electromagnetic operation keep relay.
【0005】上述したPC1による揮発性記憶手5に格
納されたデータを使用するシーケンス制御の一例とし
て、図5によりPC1によるモータMの始動停止制御を
示す。図5の(a) は、図4に示したPC1とPC1に入
出力される外部信号の関係を示す図であり、図におい
て、1はPC、21はACC、5は揮発性記憶手段、51は
入力データ領域、53は出力リレー領域、6は入力回路、
7は出力回路であって、図4に示した同符号のもの、あ
るいは領域と同一である。入力回路6の端子F には押し
ボタンスイッチST(以下の説明では単にスイッチSTと称
する)の常時開路接点からのモータMを始動させる信号
が入力され、端子G には押しボタンスイッチSP(以下の
説明では単にスイッチSPと称する)の常時開路接点から
のモータMを停止させる信号が入力される。As an example of the sequence control using the data stored in the volatile memory 5 by the PC 1 described above, FIG. 5 shows start / stop control of the motor M by the PC 1. FIG. 5A is a diagram showing the relationship between the PC1 shown in FIG. 4 and the external signals input / output to / from the PC1, in which 1 is PC, 21 is ACC, 5 is volatile storage means, and 51. Is an input data area, 53 is an output relay area, 6 is an input circuit,
Reference numeral 7 denotes an output circuit, which has the same reference numeral as shown in FIG. A signal for starting the motor M is input to the terminal F of the input circuit 6 from the normally open contact of the push button switch ST (hereinafter simply referred to as switch ST), and the terminal G is input to the push button switch SP (hereinafter referred to as the push button switch SP). In the description, a signal for stopping the motor M is input from the normally open contact of the switch SP).
【0006】出力回路7の端子Y1からは、モータMを開
閉する電磁接触器Mtの操作信号が出力され、端子F およ
び端子G からの信号は、それぞれ揮発性記憶手段4の入
力データ領域41のビット単位のデータ領域F およびG
(以下の説明では、データ領域F の内容をデータF とい
う様に、データ領域に付けられた符号をデータの符号と
して使用する)に格納され、シーケンス制御用データと
して使用される。また端子Y1から出力される信号は、揮
発性記憶手段4の1ビット単位の出力リレー領域Y1(以
下の説明では、出力リレー領域に付けられた符号を、そ
のリレーが有するデータの符号として使用する)と同一
のデータを表す信号である。An operation signal of the electromagnetic contactor Mt for opening and closing the motor M is output from the terminal Y1 of the output circuit 7, and signals from the terminals F and G are stored in the input data area 41 of the volatile storage means 4, respectively. Bitwise data areas F and G
(In the following description, the contents of the data area F will be referred to as data F, and the code attached to the data area will be used as the code of the data) and used as sequence control data. Further, the signal output from the terminal Y1 is an output relay area Y1 in 1-bit units of the volatile storage means 4 (in the following description, the code attached to the output relay area is used as the code of the data of the relay. ) Is a signal representing the same data.
【0007】図5の(b) はモータMを制御する、PC1
に格納されるシーケンス制御プログラムを表したNEMA(N
ational Electrical Manufactures Association U.S.
A)に準ずる表現による、ラダー図と呼ばれる表現形式
のシーケンス制御図である。図において、符号F や符号
Y1A で示される図記号は、その図記号に付記された符号
が示すデータが処理の対象となることを示し、符号G で
示される図記号はその図記号に付記された符号が示すデ
ータを反転した値のデータが処理の対象となることを表
し、符号Y1で示される図記号は、処理結果を格納する1
ビットのデータ領域を表し、図記号間を結ぶ線図によっ
て処理の内容を表す。並列接続を表す線図はオア演算の
処理を、直列接続を表す線図はアンド演算の処理を表
す。処理の順序は左上端に示される図記号のデータに対
する処理から始まり、右に向かって進行し、処理結果を
格納して一連の処理が終わる。この図で表されるシーケ
ンス制御プログラムはPC1によって次に箇条書きで示
す順序で実行される。 1)データE の内容が入力されACC21(図5の(a) を
参照)に格納される。もしスイッチSTが押されているな
らば、スイッチSTの常時開路接点が閉路し、閉路を示す
信号の1が入力されるので、データE が1になり、AC
C21の内容も1になる。 2)出力データY1と同一のデータY1A とACC21の内容
がオア演算され、演算結果がACC21に格納される。ス
イッチSTが押されているならば、ACC21の内容はやは
り1である。 3)データG を反転したデータとACC21の内容とがア
ンド演算され、結果がACC21に格納される。スイッチ
SPが押されていなければ、常時開路接点は開いたままで
あり、データG が0で、このデータを反転したデータは
1になるから、アンド演算前のACC21の内容1との演
算の結果も1となりACC21の内容は1になる。 4)ACC21の内容が出力リレーY1に格納される。AC
C21の内容が1ならば、出力リレーY1の内容も1にな
る。FIG. 5B shows a PC1 for controlling the motor M.
NEMA (N representing the sequence control program stored in
ational Electrical Manufactures Association US
It is a sequence control diagram of an expression format called a ladder diagram, which is based on the expression according to A). In the figure, code F and code
The graphic symbol indicated by Y1A indicates that the data indicated by the symbol attached to the graphic symbol is to be processed, and the graphic symbol indicated by the symbol G is the inversion of the data indicated by the symbol attached to the graphic symbol. Indicates that the data of the processed value is to be processed, and the graphic symbol indicated by the symbol Y1 stores the processing result 1
It represents a bit data area, and the content of processing is represented by a diagram connecting the graphic symbols. The diagram showing the parallel connection shows the processing of the OR operation, and the diagram showing the series connection shows the processing of the AND operation. The processing sequence starts with the processing of the graphic data shown in the upper left corner, proceeds to the right, stores the processing result, and ends the series of processing. The sequence control program shown in this figure is executed by the PC 1 in the following itemized order. 1) The contents of data E are input and stored in ACC21 (see (a) in FIG. 5). If the switch ST is pressed, the normally open contact of the switch ST is closed, and the signal 1 indicating the closed circuit is input, so the data E becomes 1 and the AC
The content of C21 is also 1. 2) The data Y1A identical to the output data Y1 and the contents of ACC21 are OR-operated, and the operation result is stored in ACC21. If the switch ST is pressed, the contents of ACC21 are still one. 3) The data obtained by inverting the data G and the contents of ACC21 are AND-operated, and the result is stored in ACC21. switch
If SP is not pressed, the normally open contact remains open, the data G is 0, and the inverted data of this data becomes 1, so the result of the operation with the contents 1 of ACC21 before the AND operation is also 1 The content of ACC21 becomes 1. 4) The contents of ACC21 are stored in output relay Y1. AC
If the content of C21 is 1, the content of the output relay Y1 will also be 1.
【0008】PC1は、上述のシーケンス制御プログラ
ム以外のシーケンス制御用プログラムも含めて実行し、
実行の最後に出力リレー領域53(図4を参照)の内容を
外部に出力する。スイッチSTが押されれば、上述のとお
りに出力リレーY1の内容が1になっているので、この内
容を表す信号によって電磁接触器MtがモータMの電源回
路を閉路し、モータMが始動する。PC1は出力リレー
の出力が終わると再び最初に戻り、シーケンス制御プロ
グラムを繰り返し実行する。このシーケンス制御プログ
ラムを一巡するのに要する時間をサイクルタイムと言
い、サイクルタイムは普通数ミリ秒である。2巡目以後
に図5の(b) に示すシーケンス制御図のプログラムが実
行される場合は、出力リレーY1の内容が1になっている
のでデータY1A も1であり、データE とデータY1A との
オア演算の結果はスイッチの常時開路接点が開き、デー
タE が0になっても1であり、以下の演算結果も変化し
ないので、いわゆる自己保持回路が形成され、モータM
は、始動押しボタンスイッチSTを一度押す操作をすれ
ば、始動し、スイッチSTの操作が終わっても回転を続け
る。モータMの回転を停止される場合は、スイッチSPを
押す操作をする。この操作の結果データG が1になり、
図5の(b) に示すACC21とデータG を反転したデータ
とのアンド演算の結果が0になり、この値が出力リレー
Y1に格納されるので、端子Y1から電磁接触器Mtにモータ
Mの電源回路を開く信号が出力され、モータMが停止す
る。The PC 1 also executes a sequence control program other than the above sequence control program, and executes the program.
At the end of execution, the contents of the output relay area 53 (see FIG. 4) are output to the outside. When the switch ST is pressed, the content of the output relay Y1 is 1 as described above, and thus the signal indicating this content causes the electromagnetic contactor Mt to close the power supply circuit of the motor M and the motor M is started. . When the output of the output relay ends, the PC1 returns to the beginning again and repeatedly executes the sequence control program. The time required to complete one cycle of this sequence control program is called cycle time, and the cycle time is usually several milliseconds. When the program of the sequence control diagram shown in Fig. 5 (b) is executed after the second round, the data Y1A is also 1 because the content of the output relay Y1 is 1, and the data E and data Y1A The result of the OR operation is 1 even if the normally open contact of the switch is opened and the data E becomes 0, and the following operation result does not change, so a so-called self-holding circuit is formed and the motor M
Is started by pressing the start push button switch ST once, and continues to rotate even after the operation of the switch ST is completed. When the rotation of the motor M is stopped, the switch SP is pushed. As a result of this operation, the data G becomes 1,
The result of the AND operation between ACC21 shown in Fig. 5 (b) and the data obtained by inverting the data G becomes 0, and this value is the output relay.
Since it is stored in Y1, a signal for opening the power supply circuit of the motor M is output from the terminal Y1 to the electromagnetic contactor Mt, and the motor M stops.
【0009】停電が発生すると、停電検出回路9(図4
の(a) を参照)は、停電検出信号ESG の値を0にする。
PC1はこの信号が入力されると、現在実行中のシーケ
ンス制御命令の実行を完了後、次に実行すべき命令の番
地を不揮発性記憶手4に格納し、命令の実行を停止す
る。電源回復後、命令の実行を再開する場合は、PC1
は揮発性記憶手段5の内容をクリアし(0にする)、不
揮発性記憶手4に格納した停電後最初に実行すべき命令
の番地を参照して、実行再開後の最初の命令を読み出
し、この命令から実行を再開する。再開後のシーケンス
制御プログラムの実行サイクルにおいては、出力リレー
領域は揮発性記憶手段5に設けられているので、出力リ
レーY1の内容も0になっており、データE とACC21と
のオア演算結果は0となり、スイッチSTが操作されない
限りモータMが始動することがなく、停電後のシーケン
ス制御開始時の安全が確保される。When a power failure occurs, the power failure detection circuit 9 (see FIG.
(Refer to (a)), the value of the power failure detection signal ESG is set to 0.
When this signal is input, the PC 1 completes the execution of the sequence control instruction currently being executed, stores the address of the next instruction to be executed in the non-volatile memory 4, and stops the execution of the instruction. After restarting the power supply, the PC1
Clears the content of the volatile storage means 5 (sets it to 0), refers to the address of the instruction to be executed first after the power failure stored in the non-volatile storage 4, reads the first instruction after the execution is restarted, Execution resumes from this instruction. In the execution cycle of the sequence control program after the restart, since the output relay area is provided in the volatile storage means 5, the content of the output relay Y1 is also 0, and the OR operation result of the data E and ACC21 is The value becomes 0, the motor M does not start unless the switch ST is operated, and the safety at the start of sequence control after a power failure is secured.
【0010】図6にPC1による不揮発性記憶手4に格
納されたデータを使用するシーケン制御の一例を示す。
図6の(a) は制御目的と制御手段とを示す図であり、S0
は搬送車TCの始発位置を検出してパルス信号SG0 を発信
するセンサ、Si(i はセンサの番号を表す1〜4の数、
図ではS3までが示されている)は搬送車TCが区間Ai(i
は区間の番号を表す1〜4の数)の走行終了地点を検出
しパルス信号SGi (iはセンサSiが発信する信号の番
号)を発信するセンサである。図6の(b) は制御内容を
表した図であり、上述のパルス信号SGi によって検出さ
れる搬送車TCの残りの走行行程を表示灯LAi(i は表示灯
の番号1〜4であり、区間の番号に対応する)によって
表示する。搬送車TCの発車時には、走行行程は全区間が
残っているので、表示灯LAi の全部がセンサS0が発信す
るパルス信号SG0 の立ち上がりが検出される結果として
点灯し、搬送車TCが区間A2にある場合は、区間A1は走行
済であるからセンサS1が発信するパルス信号SG1 の立ち
上がりが検出される結果とし表示灯A1が消灯し、区間A3
にある場合は、同様にして区間A2までは走行済であるか
ら表示灯A1,A2 が消灯し、区間A4にある場合は、区間A3
までは走行済であるから表示灯A1,A2,A3が消灯する。FIG. 6 shows an example of the sequence control by the PC 1 using the data stored in the nonvolatile memory 4.
FIG. 6A is a diagram showing the control purpose and the control means, and S0
Is a sensor that detects the starting position of the guided vehicle TC and sends a pulse signal SG0, Si (i is a number from 1 to 4 representing the sensor number,
In the figure, up to S3 is shown), the carrier TC is the section Ai (i
Is a sensor that detects a traveling end point of a section number (1 to 4) and transmits a pulse signal SGi (i is a signal number transmitted by the sensor Si). FIG. 6 (b) is a diagram showing the control contents, and indicates the remaining traveling strokes of the guided vehicle TC detected by the above-mentioned pulse signal SGi by the indicator lamp LAi (i are the indicator lamp numbers 1 to 4, It corresponds to the section number). When the guided vehicle TC starts, all the sections remain in the travel process, so all of the indicator lights LAi light up as a result of detection of the rising edge of the pulse signal SG0 sent by the sensor S0, and the guided vehicle TC goes to the section A2. In some cases, since the section A1 has already traveled, it is determined that the rising edge of the pulse signal SG1 transmitted by the sensor S1 is detected, the indicator light A1 is turned off, and the section A3
In the same way, the indicator lights A1 and A2 are turned off in the same way until the section A2 has been driven, and in the case of the section A4, the section A3
Until then, the indicator lights A1, A2, A3 are turned off.
【0011】図6の(c) は上述の表示制御を行うシーケ
ンス制御図である。図において、Siは揮発性記憶手段5
(図4を参照)の入力データ領域51に格納されているセ
ンサSiの信号が表すデータである。〔SET Ki] (Kiはキ
ープリレーであり、i はこのリレーの番号)はこの図記
号で示されるプログラム上の演算で、キープリレーKiの
領域に値の1が書き込まれるとキープリレーKiの内容が
1になることを示しており、〔RST Ki] はこの図記号で
示されるプログラム上の演算で、キープリレーKiの領域
に値の1が書き込まれるとキープリレーKiの内容が0に
なることを示している。キープリレーKiの内容が1にな
ると、この内容が図示外の出力リレーに転送されて出力
され、表示灯LAi が点灯し、0になるとこの内容が同じ
出力リレーに転送され、出力されて表示灯LAi が消灯す
る。FIG. 6C is a sequence control diagram for performing the above-mentioned display control. In the figure, Si is a volatile storage means 5.
It is data represented by the signal of the sensor Si stored in the input data area 51 (see FIG. 4). [SET Ki] (Ki is the keep relay, i is the number of this relay) is the program operation indicated by this symbol. When the value 1 is written in the keep relay Ki area, the contents of the keep relay Ki Indicates that the value becomes 1, and [RST Ki] is the arithmetic operation in the program shown by this symbol. When the value 1 is written in the area of the keep relay Ki, the contents of the keep relay Ki become 0. Is shown. When the content of the keep relay Ki becomes 1, this content is transferred to the output relay (not shown) for output, and the indicator light LAi lights up, and when it becomes 0, this content is transferred to the same output relay and output for output. LAi goes out.
【0012】図6の(c) に示すシーケンス制御図の内容
を実行するプログラムはPC1( 図4を参照)によって
次に箇条書きにして示すとおりに実行される。 1)データSOがACC21( 図4を参照)にロードされ
る。搬送車TCが始発点を発車し信号SGとして、センサS0
からパルス信号SG0 がPC1に入力されているならばデ
ータSOは1であり、ACC21の内容は1になる。 2)ACC21の内容がキープリレーK1に格納される。 3)続けて、ACC21の内容がキープリレーK2に格納さ
れる。 4)さらに続けて、ACC21の内容がキープリレーK3に
格納される。 4)またさらに続けて、ACC21の内容がキープリレー
K4に格納される。 5)データS1がACC21( 図4を参照)にロードされ、
続いてACC21の内容がキープリレーK1のリセット入力
[RST K1] として与えられるが、搬送車TCが区間A1にあ
る間は、データS1は0なので、リレーK1はリセットされ
ず、リレーK1はの内容は引き続き1である。 6)同様にしてキープリレーK2にリセット入力[RST K2]
として0が与えられ、出力リレーK2はの内容は引き続き
1である。 7)同様にしてキープリレーK3にリセット入力[RST K3]
として0が与えられ、出力リレーK3の内容は引き続き1
である。 8)同様にしてキープリレーK4にリセット入力[RST K3]
として0が与えられ、出力リレーK4はの内容は引き続き
1である。 以上に説明のとおり、図6の(c) に示すシーケンス制御
を実行の結果、搬送車TCが区間A1にある間は表示灯LAi
の全てが点灯する。A program for executing the contents of the sequence control diagram shown in FIG. 6C is executed by the PC 1 (see FIG. 4) as shown in the next itemized form. 1) The data SO is loaded into ACC21 (see Figure 4). The carrier vehicle TC departs from the starting point and uses the signal S0 as the signal SG.
Therefore, if the pulse signal SG0 is input to PC1, the data SO is 1, and the content of ACC21 becomes 1. 2) The contents of ACC21 are stored in keep relay K1. 3) Subsequently, the contents of ACC21 are stored in the keep relay K2. 4) Subsequently, the contents of ACC21 are stored in the keep relay K3. 4) Continuing on, the contents of ACC21 are kept relay.
Stored in K4. 5) Data S1 is loaded into ACC21 (see Figure 4),
Then, the contents of ACC21 are reset input of keep relay K1.
Although it is given as [RST K1], since the data S1 is 0 while the transport vehicle TC is in the section A1, the relay K1 is not reset and the content of the relay K1 is still 1. 6) Similarly, reset input to keep relay K2 [RST K2]
Is given as 0, and the content of the output relay K2 is still 1. 7) Similarly, reset input to keep relay K3 [RST K3]
Is given as 0, and the content of the output relay K3 continues to be 1.
Is. 8) Similarly, reset input to keep relay K4 [RST K3]
Is given as 0, and the content of the output relay K4 is still 1. As described above, as a result of executing the sequence control shown in (c) of FIG. 6, while the transport vehicle TC is in the section A1, the indicator light LAi
Lights up.
【0013】センサS1が搬送車TCの区間A1の通過を検出
すると、データS1の内容はセンサS1から信号SGとして入
力されるパルス信号SG1 によって1になる。この信号が
出力リレーK1のリセット入力[RST K1]として与えられる
ので、リレーK1はリセットし、このリレーの内容が0に
なるので、表示灯LA1 が消灯し、搬送車TCが区間A1を通
過したことが分かる。以下同様にして、それぞれの区間
の通過ごとにその区間を表す表示灯が消える。When the sensor S1 detects passage of the transport vehicle TC through the section A1, the content of the data S1 becomes 1 by the pulse signal SG1 input as the signal SG from the sensor S1. Since this signal is given as the reset input [RST K1] of the output relay K1, the relay K1 is reset and the content of this relay becomes 0, so that the indicator light LA1 is turned off and the transport vehicle TC has passed the section A1. I understand. Similarly, after each passage of the section, the indicator light representing the section goes out.
【0014】停電が発生した場合は、データSiは揮発性
記憶手5に格納されているので、電源回復後のシーケン
ス制御の再開時にクリアされて0になるが、キープリレ
ーKiは不揮発性記憶手段4に格納されていて、停電前の
データを保持しているので、このデータが図外の出力リ
レーに転送されて搬送車TCの位置が正しく表示される。When a power failure occurs, since the data Si is stored in the volatile memory 5, it is cleared to 0 when the sequence control is restarted after the power is restored, but the keep relay Ki is a nonvolatile memory means. Since it is stored in No. 4 and holds the data before the power failure, this data is transferred to the output relay (not shown) and the position of the transport vehicle TC is correctly displayed.
【0015】[0015]
【発明が解決しようとする課題】前述のとおりに、従来
のプログラマブルコントローラにおいては、停電時の最
後に実行したシーケンス制御命令の次に実行すべきシー
ケンス制御命令の番地と停電時にも記憶を続けるべきデ
ータとを、不揮発性記憶手段に格納し、停電後再開時に
は、不揮発性記憶手段に格納したデータを参照しつつ停
電時の最後に実行したシーケンス制御命令の次の命令か
ら命令の実行を再開する。ところが、図6の(c) に示し
たシーケンス制御例において、データS0の内容が1即ち
搬送車TCが区間A1にあり、〔SET K2〕に値1を書き込む
処理の実行中に停電が発生する場合には、キープリレー
K1とK2との内容は1であるが、キープリレーK3とK4の内
容は0のまま命令の実行が停止する。電源回復後シーケ
ンス制御が再開されると、この段階では搬送車TCは既に
発車してしまっているので、データSOは0であり、AC
C21の内容も0になっているから、キープリレーK3とK4
には1が書き込まれない。つまり、停電後の電源回復時
には搬送車TCが区間A1にあるにも係わらず、表示灯のLA
3 とLA4 とが点灯せず誤った表示になる。As described above, in the conventional programmable controller, the address of the sequence control instruction to be executed next to the last executed sequence control instruction at the time of power failure and the memory should be continued even at the time of power failure. Data and data are stored in the non-volatile storage means, and at the time of restart after a power failure, the execution of the instruction is restarted from the instruction next to the last sequence control instruction executed at the time of the power failure while referring to the data stored in the non-volatile storage means. . However, in the sequence control example shown in FIG. 6 (c), the content of the data S0 is 1, that is, the transport vehicle TC is in the section A1, and a power failure occurs during the process of writing the value 1 to [SET K2]. In case, keep relay
The contents of K1 and K2 are 1, but the contents of keep relays K3 and K4 remain 0, and the execution of the instruction is stopped. When the sequence control is restarted after the power is restored, the carrier SO has already started at this stage, so the data SO is 0, and the AC
The contents of C21 are also 0, so keep relays K3 and K4
1 is not written in. In other words, when the power is restored after a power failure, the indicator TC LA
3 and LA4 do not light up and display incorrectly.
【0016】以上に述べた事情に鑑み、本発明は、シー
ケンス制御実行中のプログラマブルコントローラの電源
の停電がシーケンス制御のどんな段階で発生しても、電
源回復後のシーケンス制御再開を正しく行うプログラマ
ブルコントローラを提供することを目的とする。In view of the above-mentioned circumstances, the present invention provides a programmable controller that correctly resumes sequence control after the power is restored no matter what stage of sequence control the power failure of the programmable controller during sequence control occurs. The purpose is to provide.
【0017】[0017]
【課題を解決するための手段】前述の目的を達成するた
め、本発明によれば、停電時の処理を行うプログラムを
含むシステムプログラムと、二つ以上のシーケンス制御
命令を単位とするシーケンス制御命令群の1単位以上か
らなるシーケンス制御プログラムとを格納するプログラ
ム記憶手段と、プログラム記憶手段に格納されているプ
ログラムを実行する制御演算手段と、停電時にも格納さ
れているデータを保持する機能を有する不揮発性記憶手
段と、停電時には格納されているデータの保持について
の機能がない揮発性記憶手段と、入力回路と、出力回路
とから成り、停電を検出する回路を備え、この停電検出
回路が発信する停電検出信号を入力されて停電時の処理
を行う機能を有するプログラマブルコントローラにおい
て、シーケンス制御プログラムを実行中に停電が検出さ
れた場合に、シーケンス制御プログラムを構成する、停
電検出時点におけるシーケンス制御命令群の次ぎにくる
命令が読み出されるまで順次命令を読み出して、停電検
出時点におけるシーケンス制御命令群に含まれる全ての
シーケンス制御命令を実行し、続いて電源回復後最初に
実行すべき命令の番地を不揮発性記憶手段に格納して、
実行中のシーケンス制御プログラムの実行を停止するこ
とを特徴とする。In order to achieve the above-mentioned object, according to the present invention, a system program including a program for performing a process at the time of power failure, and a sequence control instruction in units of two or more sequence control instructions. It has a program storage means for storing a sequence control program consisting of one or more units of the group, a control calculation means for executing the program stored in the program storage means, and a function of holding the stored data even in the case of a power failure. A non-volatile memory means, a volatile memory means that does not have a function to retain the stored data in the event of a power failure, an input circuit, an output circuit, and a circuit for detecting a power failure. A programmable controller with the function of receiving a power failure detection signal and performing processing at power failure If a power failure is detected during execution of the program, the sequence control instructions at the time of the power failure detection are sequentially read until the next instruction of the sequence control instruction group at the time of the power failure detection that constitutes the sequence control program is read. Execute all sequence control commands included in the group, then store the address of the command to be executed first after the power is restored in the non-volatile storage means,
It is characterized in that the execution of the sequence control program being executed is stopped.
【0018】また、二つの続けて実行されるシーケンス
制御命令群の境界を、二つの命令群の内、後に実行され
る命令群の先頭の命令が制御演算手段の演算用レジスタ
にデータをロードする命令であることによって判別する
と好適である。さらに、一つの制御命令群の最後の命令
を、この命令に続いて実行される命令がシーケンス制御
命令以外の命令であることを判別することにより、検知
すると好適である。At the boundary between two consecutively executed sequence control instruction groups, the first instruction of the two instruction groups to be executed later loads the data into the arithmetic register of the control arithmetic means. It is preferable to determine by the fact that it is an instruction. Further, it is preferable to detect the last instruction of one control instruction group by determining that the instruction executed subsequently to this instruction is an instruction other than the sequence control instruction.
【0019】またさらに、プログラムを実行中に停電が
検出された場合に、停電検出時点においてプログラムの
実行に係わっている命令がシーケンス制御命令であるか
否かを、この命令が格納されている記憶手段の番地に基
づいて判定し、この命令がシーケンス制御命令に属さな
い命令の場合は、停電検出後最後に実行された命令に続
いて実行されるべき命令の番地を電源回復後に最初に実
行する命令の番地として、不揮発性記憶手段に格納し、
プログラムの実行を停止すると好適である。Further, when a power failure is detected during the execution of the program, it is determined whether or not the instruction related to the execution of the program at the time of the power failure detection is a sequence control instruction. Judging based on the address of the means, if this command is not a sequence control command, the address of the command that should be executed after the last executed command after the detection of power failure is executed first after the power is restored. Stored in the non-volatile storage as the address of the instruction,
It is preferable to stop the execution of the program.
【0020】[0020]
【作用】本発明のプログラマブルコントローラは、シー
ケンス制御プログラムの実行中に停電が検出されると、
停電検出時点が命令の実行中であればこの命令の実行を
完了し、命令の実行が終わった段階で次の命令を読み出
し、この命令が停電検出時点で実行していた命令が属す
るシーケンス制御命令群と同一の命令群に属するか否か
を判定する。このシーケンス制御命令群に属する命令で
あれば読み出された命令を実行し、この様にして停電検
出時のシーケンス制御プログラム群に属さない命令が読
み出されるまで読み出した命令を順次実行する。停電検
出時のシーケンス制御プログラム群に属さない命令が現
れると、この命令が格納されているプログラム記憶手段
の番地を不揮発性記憶手領域に格納し、命令の実行を停
止する。The programmable controller of the present invention, when a power failure is detected during execution of the sequence control program,
If an instruction is being executed at the time of power failure detection, the execution of this instruction is completed, the next instruction is read when the instruction execution is completed, and the sequence control instruction to which the instruction executed at the time of the power failure detection belongs It is determined whether or not the instruction belongs to the same instruction group as the group. If the instruction belongs to this sequence control instruction group, the read instruction is executed, and thus the read instruction is sequentially executed until an instruction not belonging to the sequence control program group at the time of power failure detection is read. When an instruction that does not belong to the sequence control program group at the time of power failure detection appears, the address of the program storage means in which this instruction is stored is stored in the non-volatile memory area and the execution of the instruction is stopped.
【0021】また、停電検出後プログラマブルコントロ
ーラが順次読み出す命令が制御演算手段の演算用レジス
タにデータをロードする命令になったならば、この命令
を停電検出時に実行していたシーケンス制御命令プログ
ラム群に続くシーケンス制御命令プログラム群の先頭の
命令として判定する。さらに、停電検出後プログラマブ
ルコントローラが順次読み出す命令がシーケンス制御命
令に属する命令か否かを判定し、シーケンス制御制御命
令に属さない命令の場合はこの命令の前の命令を停電検
出時に実行していたシーケンス制御命令プログラム群の
最後の命令として判定する。Further, if the instruction sequentially read by the programmable controller after the power failure is detected becomes an instruction to load the data into the arithmetic register of the control operation means, this instruction is added to the sequence control instruction program group which is being executed when the power failure is detected. Judge as the first instruction of the following sequence control instruction program group. Further, after the power failure is detected, it is determined whether or not the instruction sequentially read by the programmable controller belongs to the sequence control instruction. If the instruction does not belong to the sequence control instruction, the instruction before this instruction is executed when the power failure is detected. Judge as the last instruction in the sequence control instruction program group.
【0022】さらにまた、プログラムを実行中に停電が
検出された場合に、停電検出時点においてプログラムの
実行に係わっている命令が格納されている番地が、シー
ケンス制御命令に属する命令の格納番地か否かを判定
し、この命令がシーケンス制御命令に属さない命令の場
合は、停電検出後最後に実行された命令に続いて実行さ
れるべき命令の格納番地を電源回復後に最初に実行する
命令の番地として、不揮発性記憶手段に格納し、プログ
ラムの実行を停止する。Furthermore, if a power failure is detected during execution of the program, the address at which the instruction relating to the execution of the program at the time of the power failure is stored is the address of the instruction belonging to the sequence control instruction. If this instruction is not a sequence control instruction, the storage address of the instruction that should be executed after the last executed instruction after a power failure is detected is the address of the instruction that is executed first after the power is restored. As a result, the program is stored in the non-volatile storage means and the program execution is stopped.
【0023】[0023]
(実施例1)図1は本発明の一実施例のプログラマブル
コントローラ101 (以下の説明ではPC101 と略記す
る)を表した図である。PC101 は図4に示したPC1
とプログラム記憶手段に格納されているシステムプログ
ラムの内容が異なる点を除いて同一であるので、図1の
(a) にはPC101 の内、システムプログラムの種類のみ
を示し、他の部分については図4を参照して説明する。
図において、312 は一般処理用システムプログラムであ
り、313 はシーケンス制御用システムプログラムであっ
て、図4に示したPC1のシテスムプログラム31に格納
されているプログラムと同一仕様のプログラムであり、
停電時処理用プログラム314 は前述のシテスムプログラ
ム31に格納されているプログラムとは異なる。311 は停
電時処理用プログラム314 とシーケンス制御用システム
プログラム313 と一般処理用システムプログラム312 と
を含むプログラムであり、301 はシステムプログラム31
1 と図外のシーケンス制御プログラムとを格納するプロ
グラム記憶手段であって、図4に示したプログラム記憶
手段3と格納されているシステムプログラムが異なる点
を除き同一のものである。(Embodiment 1) FIG. 1 is a diagram showing a programmable controller 101 (abbreviated as PC 101 in the following description) of one embodiment of the present invention. PC101 is PC1 shown in FIG.
1 and FIG. 1 are the same except that the contents of the system program stored in the program storage means are different.
Only the type of system program in the PC 101 is shown in (a), and other parts will be described with reference to FIG.
In the figure, 312 is a general processing system program, 313 is a sequence control system program having the same specifications as the program stored in the system program 31 of the PC 1 shown in FIG.
The power failure processing program 314 is different from the program stored in the above-mentioned system program 31. 311 is a program including a program 314 for processing during power failure, a system program 313 for sequence control, and a system program 312 for general processing, and 301 is a system program 31.
1 is a program storage means for storing a sequence control program (not shown) and is the same except that the program storage means 3 shown in FIG. 4 and the stored system program are different.
【0024】図1の(b) に停電時処理用システムプログ
ラム314 を実行することによるPC101 の停電検出時の
動作を表すフローチャートを示す。この図を参照してP
C101 の動作を説明する。PC101 は、シーケンス制御
プログラムを構成するシーケンス制御命令を実行中に停
電検出回路9(図4の(a) を参照)から入力される信号
ESG が停電を検知した値0になると、処理F1において、
その時点で実行中のシーケンス制御命令があれば、この
命令の実行を完了し、一つの命令の実行が区切りになる
と、処理F2において次に実行すべき命令を読み出し、処
理F3において読みだ出された命令が前の命令と同一のシ
ーケンス制御命令群に属するか否かを判定する。同一プ
ログラム群に属する場合は処理F4において、読みだ出し
た命令を実行し、この命令の実行後、処理F2に戻り次の
命令を読みだ出し、以下前述した処理と同様な処理を行
う。処理F3の結果、読みだ出された命令が同一シーケン
ス制御プログラム群に属さない場合は、この命令が格納
されているプログラム記憶手段301 中の番地を不揮発性
記憶手段4(図4の(b) を参照)の実行再開先頭命令の
番地を格納する領域42(図4の(b) を参照)に格納し、
プログラムの実行を停止する。FIG. 1 (b) is a flow chart showing the operation of the PC 101 when a power failure is detected by executing the power failure processing system program 314. Referring to this figure, P
The operation of C101 will be described. The PC 101 is a signal input from the power failure detection circuit 9 (see (a) in FIG. 4) during execution of the sequence control command that constitutes the sequence control program.
When the ESG detects a power failure and reaches 0, in process F1,
If there is a sequence control command that is being executed at that time, the execution of this command is completed, and when the execution of one command becomes a break, the next command to be executed is read in process F2 and read out in process F3. It is determined whether the specified instruction belongs to the same sequence control instruction group as the previous instruction. If they belong to the same program group, in the process F4, the read command is executed, after execution of this command, the process returns to the process F2 to read the next command, and the same process as the above-mentioned process is performed. If the instruction read out does not belong to the same sequence control program group as a result of the process F3, the address in the program storage means 301 in which this instruction is stored is stored in the nonvolatile storage means 4 ((b) in FIG. 4). (See (4) in Fig. 4), and stores it in the area 42 (see (b) in Fig. 4) that stores the address of the first instruction.
Stop program execution.
【0025】図2は上述の処理3 において、読みだ出さ
れた命令が前に実行されたシーケンス制御命令と同一の
シーケンス制御命令群に属するか否かを判定する方法の
一例を示した図である。図はシーケンス制御の一例を、
前述したラダー図の形式で表現した図である。ラダー図
ではシーケンス制御プログラムを、この例の点線で囲ま
れた枠B1〜B4に示すように、データを演算用レジスタに
ロードし、演算し、演算結果を格納するまでの一つの枠
で示された一連の命令群を一つの単位とする、シーケン
ス制御命令群の集合として表現し、点線で囲まれた枠B1
〜B4の一つで示されるシーケンス制御命令群を一つの回
路と称している。シーケンス制御命令群B1は図5の(b)
によって説明したところと同一の規則により、データA
を先ずACC21(図4を参照)にロードし、ACC21の
内容とデータB1を反転したデータとのアンド演算した結
果をACC21にロードし、ACC21の内容をキープリレ
ーK1に書き込む。以下同様にして、シーケンス制御命令
群B1ではデータA の内容とデータC のデータを反転した
データとのアンド演算結果をACC21を介してキープリ
レーK2に書き込み、データA の内容とデータD のデータ
を反転したデータとのアンド演算結果をACC21を介し
てキープリレーK3に書き込んでこの命令群の命令を完結
する。以下シーケンス制御命令群B2においては、ACC
21にデータEをロードする命令から始まり、シーケンス
制御命令群B3においては、ACC21にデータH をロード
する命令から始まり、シーケンス制御命令群B4において
は、ACC21にデータK をロードする命令から始まる。
この例のとおりに一つのシーケンス制御命令群の最初の
シーケンス制御命令は必ずデータをACC21にロードす
る命令であり、2番目以下のシーケンス制御命令にはデ
ータをACC21にロードする命令が現れない。そこで、
実行した命令に続く命令を読みだ出した場合に、PC21
は読みだ出した命令がデータをACC21にデータをロー
ドする命令であるか否かを判定することによって、実行
中の命令群の最終命令を判定することができる。FIG. 2 is a diagram showing an example of a method of determining whether or not the read-out instruction belongs to the same sequence control instruction group as the previously executed sequence control instruction in the above-mentioned processing 3. is there. The figure shows an example of sequence control,
It is the figure expressed in the format of the ladder diagram mentioned above. In the ladder diagram, the sequence control program is shown in one frame from loading data to the operation register, performing the operation, and storing the operation result, as shown in boxes B1 to B4 surrounded by dotted lines in this example. A frame B1 surrounded by a dotted line is expressed as a set of sequence control instruction groups with the series of instruction groups
A group of sequence control instructions indicated by one of B4 to B4 is called one circuit. Sequence control instruction group B1 is shown in FIG.
By the same rules as described by Data A
Is first loaded into ACC21 (see FIG. 4), the result of the AND operation of the contents of ACC21 and the inverted data of data B1 is loaded into ACC21, and the contents of ACC21 are written into keep relay K1. Similarly, in the sequence control instruction group B1, the AND operation result of the contents of the data A and the inverted data of the data C is written to the keep relay K2 via the ACC21, and the contents of the data A and the data of the data D are written. The AND operation result with the inverted data is written in the keep relay K3 via the ACC21 to complete the instruction of this instruction group. In the sequence control instruction group B2 below, ACC
The sequence control instruction group B3 starts with an instruction to load the data ACC into the ACC21, and the sequence control instruction group B4 starts with an instruction to load the ACC21 with the data K.
As in this example, the first sequence control instruction of one sequence control instruction group is an instruction to load data into ACC21 without fail, and the instruction to load data into ACC21 does not appear in the second and subsequent sequence control instructions. Therefore,
PC21 when the instruction following the executed instruction is read out
Can determine the final instruction of the instruction group being executed by determining whether or not the read instruction is an instruction for loading data into ACC21.
【0026】シーケンス制御命令群の全てを完了すると
前述したとおりに、シーケンス制御命令群の実行結果に
基づいた、出力リレーのデータを出力するなどのシーケ
ンス制御サイクル終端での処理を行う終端処理プログラ
ムBEを実行する。このプログラムの先頭は、外部に出力
するデータをロードする命令、終端処理プログラムBEの
サブルーチンに命令の実行を移す命令などのシーケンス
制御命令以外の命令である。そこで、シーケンス制御命
令群に続いて読みだ出された命令が、シーケンス制御命
令以外の命令例えば、データをロードする命令、命令の
実行順序を命令の格納番地順と異なる順序に変更する命
令などの場合は、シーケンス制御命令群の実行が終了
し、次の命令に入ったと判断する。When all of the sequence control instruction group is completed, as described above, the termination processing program BE for performing processing at the end of the sequence control cycle, such as outputting data of the output relay, based on the execution result of the sequence control instruction group. To execute. The beginning of this program is an instruction other than the sequence control instruction such as an instruction for loading data to be output to the outside and an instruction for shifting the execution of the instruction to the subroutine of the termination processing program BE. Therefore, the instruction read out after the sequence control instruction group is an instruction other than the sequence control instruction, for example, an instruction to load data, an instruction to change the execution order of the instruction to an order different from the storage address order of the instruction, etc. In this case, execution of the sequence control instruction group is completed, and it is determined that the next instruction is entered.
【0027】PC101 がシーケンス制御プログラムを実
行中に停電を検出した場合の動作例として、図6の(c)
に示したシーケンス制御図に表されたプログラムの実行
中に、データS0をACC21に格納し、キープリレーK1に
ACC21の格納を終わり、キープリレーK2にACC21の
内容を格納中に停電を検出したとする。PC101 はキー
プリレーK2にACC21を格納する命令の実行を完了し、
続いて次の命令としてキープリレーK3にACC21の内容
を格納する命令を読み出す。この命令はデータをACC
21にロードする命令ではないので、PC101 はキープリ
レーK3にACC21の内容を格納する命令を実行する。同
様にして、キープリレーK4にもACC21の内容を格納す
る命令を実行し、次の命令としてデータS1をACC21に
ロードする命令を読みだ出す。PC101 は前述のとおり
にデータS1をACC21に読み出す命令は次のシーケンス
制御命令群に属する命令と判定するので、読みだ出した
命令が格納されいたプログラム記憶手段3(図4を参
照)の番地を不揮発性記憶手段4(図4を参照)に格納
し、命令の実行を停止する。従って、このシーケンス制
御命令群の実行途中で停電が発生しても、キープリレー
K1〜K4には同一のデータが格納され、キープリレーK1〜
K4が有するデータに矛盾が生じない。As an operation example when the PC 101 detects a power failure while executing the sequence control program, FIG.
During the execution of the program shown in the sequence control diagram shown in Fig. 4, the data S0 is stored in ACC21, the storage of ACC21 in the keep relay K1 is completed, and the power failure is detected while the contents of ACC21 are stored in the keep relay K2. To do. PC101 completes the execution of the instruction to store ACC21 in keep relay K2,
Then, as the next instruction, an instruction to store the contents of ACC21 in the keep relay K3 is read. This command ACCs data
Since it is not the instruction to load it into PC 21, the PC 101 executes the instruction to store the contents of ACC 21 in the keep relay K3. Similarly, an instruction to store the contents of ACC21 is executed for keep relay K4, and an instruction to load data S1 into ACC21 is read out as the next instruction. As described above, the PC 101 determines that the instruction for reading the data S1 into the ACC21 belongs to the next sequence control instruction group. Therefore, the address of the program storage means 3 (see FIG. 4) in which the read instruction is stored is determined. It is stored in the non-volatile storage means 4 (see FIG. 4), and execution of the instruction is stopped. Therefore, even if a power failure occurs during execution of this sequence control instruction group, the key relay
The same data is stored in K1 to K4, and keep relay K1 to K4
There is no inconsistency in the data of K4.
【0028】シーケンス制御命令群の処理が全て終了す
ると、終端処理プログラムBEに実行が移る。PC101
は、実行完了後のシーケンス制御命令に続く命令がデー
タをロードする命令などの終端処理プログラムBEに属す
る命令の場合には、この命令の一つ前の命令をシーケン
ス制御命令群の最後の命令として判定する。 (実施例2)図3に本発明の他の実施例を示す。図にお
いて、102 は当実施例のPCであり、PC102 は図1の
(a) に示したPC101 と停電時処理用システムプログラ
ム316 を有するシステムプログラム315 を格納したプロ
グラム記憶手段302 を備える点を除き、図1の(a) に示
したPC101 と同一である。When all the processing of the sequence control instruction group is completed, the execution shifts to the termination processing program BE. PC101
If the instruction following the sequence control instruction after completion of execution is an instruction that belongs to the termination processing program BE such as an instruction to load data, the instruction immediately before this instruction is set as the last instruction of the sequence control instruction group. judge. (Embodiment 2) FIG. 3 shows another embodiment of the present invention. In the figure, 102 is the PC of the present embodiment, and PC 102 is shown in FIG.
The PC 101 is the same as the PC 101 shown in FIG. 1A, except that the PC 101 shown in FIG. 1A and a program storage means 302 storing a system program 315 having a system program 316 for processing during power failure are provided.
【0029】図3の(b) に停電時処理用システムプログ
ラム315 を実行することによる、PC102 の停電検出時
の動作を表すフローチャートを示す。この図を参照して
PC102 の動作を説明する。PC102 は、命令を実行中
に停電検出回路9(図4の(a) を参照)から入力される
信号ESG が停電を検知した値0になると、処理F0におい
て、停電検出時に実行中の命令があればこの命令の実行
を完了し、一つの命令の実行が区切りになった時点で、
次に実行すべき命令の番地を格納しているプログラム記
憶手段3(図4の(a) を参照)の番地を参照する。処理
F01 において、参照した命令番地から、次に実行すべき
命令が初期設定に属する命令か否かを判定し、初期設定
に属する命令であれば、この命令が格納れているプログ
ラム記憶手段の番地を、電源回復後最初に実行すべき命
令番地として、不揮発性記憶手段4(図4の(a) を参
照)に格納する。シーケンス制御命令の命令領域にある
場合は、図1の(b) に示した処理F3に命令の実行を移
す。FIG. 3B is a flow chart showing the operation of the PC 102 when a power failure is detected by executing the power failure processing system program 315. The operation of the PC 102 will be described with reference to this figure. When the signal ESG input from the power failure detection circuit 9 (see (a) in FIG. 4) during execution of an instruction reaches the value 0 at which a power failure is detected, the PC 102 determines that the instruction being executed at the time of power failure detection in process F0. If there is, the execution of this instruction is completed, and when the execution of one instruction becomes a break,
Next, the address of the program storage means 3 (see (a) of FIG. 4) which stores the address of the instruction to be executed is referred to. processing
In F01, it is determined from the instruction address referred to whether the next instruction to be executed is an instruction belonging to the initial setting, and if it is an instruction belonging to the initial setting, the address of the program storage means in which this instruction is stored is determined. It is stored in the nonvolatile storage means 4 (see (a) of FIG. 4) as an instruction address to be executed first after the power is restored. If it is in the instruction area of the sequence control instruction, execution of the instruction is shifted to the process F3 shown in FIG. 1 (b).
【0030】[0030]
【発明の効果】以上に説明したとおり、本発明によれ
ば、停電時の処理を行うプログラムを含むシステムプロ
グラムと、二つ以上のシーケンス制御命令を単位とする
シーケンス制御命令群の1単位以上からなるシーケンス
制御プログラムとを格納するプログラム記憶手段と、プ
ログラム記憶手段に格納されているプログラムを実行す
る制御演算手段と、停電時にも格納されているデータを
保持する機能を有する不揮発性記憶手段と、停電時には
格納されているデータの保持についての機能がない揮発
性記憶手段と、入力回路と、出力回路とから成り、停電
を検出する回路を備え、この停電検出回路が発信する停
電検出信号を入力されて停電時の処理を行う機能を有す
るプログラマブルコントローラにおいて、シーケンス制
御プログラムを実行中に停電が検出された場合に、シー
ケンス制御プログラムを構成する、停電検出時点におけ
るシーケンス制御命令群の次ぎにくる命令が読み出され
るまで順次命令を読み出して、停電検出時点におけるシ
ーケンス制御命令群に含まれる全てのシーケンス制御命
令を実行し、続いて電源回復後最初に実行すべき命令の
番地を不揮発性記憶手段に格納して、実行中のシーケン
ス制御プログラムの実行を停止するので、停電発生時に
は実行中のシーケンス制御命令群の実行を全て完了した
後で、命令の実行が停止され、電源回復後は次のシーケ
ンス制御命令群から命令の実行が再開される。従って、
停電がいかなる時点で発生しても、正常な動作時に同一
のデータを格納すべきデータ領域には必ず同一のデータ
を格納する、プログラマブルコントローラが提供され
る。As described above, according to the present invention, a system program including a program for processing a power failure and one or more units of a sequence control instruction group including two or more sequence control instructions as a unit are selected. A program storage means for storing the sequence control program, a control calculation means for executing the program stored in the program storage means, a non-volatile storage means having a function of holding the stored data even in the case of a power failure, In the event of a power failure, it is equipped with a volatile storage means that does not have a function for holding the stored data, an input circuit, and an output circuit, and has a circuit that detects a power failure. Input the power failure detection signal transmitted by this power failure detection circuit. Executes a sequence control program in a programmable controller that has the function of performing processing in the event of a power failure When a power failure is detected in the sequence control program, the sequence control program is configured to sequentially read the instructions until the next instruction after the sequence control instruction group at the time of the power failure detection is included in the sequence control instruction group at the time of the power failure detection. All sequence control commands are executed, then the address of the first command to be executed after power recovery is stored in the non-volatile memory, and the execution of the sequence control program being executed is stopped. After the execution of all the sequence control instruction groups is completed, the instruction execution is stopped, and after the power is restored, the execution of the instruction is restarted from the next sequence control instruction group. Therefore,
Provided is a programmable controller that always stores the same data in a data area in which the same data should be stored during normal operation regardless of a power failure.
【0031】また、本発明の請求項2に記載の発明によ
れば、二つの続けて実行されるシーケンス制御命令群の
境界を、二つの命令群の内、後に実行される命令群の先
頭の命令が制御演算手段の演算用レジスタにデータをロ
ードする命令であることによって判別されるので、ラダ
ー図表現に基づいて作成された既存のプログラムをその
まま実行させても、停電発生時に正しく動作するプログ
ラマブルコントローラが提供される。Further, according to the second aspect of the present invention, the boundary between the two sequence control instruction groups to be executed in succession is set at the beginning of the instruction group to be executed later in the two instruction groups. Since the instruction is determined by the instruction to load the data to the arithmetic register of the control arithmetic means, even if the existing program created based on the ladder diagram representation is executed as it is, the programmable program that operates correctly when a power failure occurs A controller is provided.
【0032】さらに、本発明の請求項3に記載の発明に
よれば、一つの制御命令群の最後の命令を、この命令に
続いて実行される命令がシーケンス制御命令以外の命令
であることを判別することにより検知するので、シーケ
ンス制御命令の実行時以外に停電が発生しても正しく動
作するプログラマブルコントローラが提供される。さら
にまた、本発明の請求項4に記載の発明によれば、プロ
グラムを実行中に停電が検出された場合に、停電検出時
点においてプログラムの実行に係わっている命令がシー
ケンス制御命令であるか否かを、この命令が格納されて
いる記憶手段の番地に基づいて判定し、この命令がシー
ケンス制御命令に属さない命令の場合は、停電検出後最
後に実行された命令に続いて実行されるべき命令の番地
を電源回復後に最初に実行する命令の番地として、不揮
発性記憶手段に格納し、プログラムの実行を停止するの
で、シーケンス制御に先立つ初期設定中に停電が発生し
ても正しく動作するプログラマブルコントローラが提供
される。Further, according to the invention described in claim 3 of the present invention, the last instruction of one control instruction group is an instruction executed subsequent to this instruction is an instruction other than the sequence control instruction. Since the detection is performed by making a determination, a programmable controller is provided that operates correctly even when a power failure occurs other than when the sequence control instruction is executed. Further, according to the invention described in claim 4 of the present invention, when a power failure is detected during execution of the program, whether or not the instruction related to the execution of the program at the time of the power failure detection is a sequence control instruction. Whether or not this command is an instruction that does not belong to the sequence control command, it should be executed following the last executed command after the power failure is detected. The address of the instruction is stored in the non-volatile storage means as the address of the instruction to be executed first after the power is restored, and the execution of the program is stopped, so that it can operate correctly even if a power failure occurs during the initialization prior to sequence control. A controller is provided.
【図1】請求項1に記載した発明によるプログラマブル
コントローラの一実施例を示す図であって、(a) はプロ
グラマブルコントローラのシステムプログラムの内容を
示す図、(b) はプログラマブルコントローラの停電時の
動作を表したフローチャート1A and 1B are diagrams showing an embodiment of a programmable controller according to the invention described in claim 1, wherein FIG. 1A is a diagram showing contents of a system program of the programmable controller, and FIG. Flow chart showing the operation
【図2】図1に示したプログラマブルコントローラにお
いて実行されるシーケンス制御プログラムの構造と、シ
ーケンス制御命令群の区切りを示す図FIG. 2 is a diagram showing a structure of a sequence control program executed in the programmable controller shown in FIG. 1 and a delimiter of a sequence control instruction group.
【図3】請求項3に記載した発明によるプログラマブル
コントローラの一実施例を示す図であって、(a) はプロ
グラマブルコントローラのシステムプログラムの内容を
示す図、(b) はプログラマブルコントローラの停電時の
動作を表したフローチャート3A and 3B are diagrams showing an embodiment of a programmable controller according to the invention described in claim 3, wherein FIG. 3A is a diagram showing contents of a system program of the programmable controller, and FIG. Flow chart showing the operation
【図4】従来の停電時のデータ喪失を防止する機能を有
するプログラマブルコントローラの一例を示す図であ
り、(a) はプログラマブルコントローラのブロック図、
(b) はプログラマブルコントローラのデータ領域の内容
を示した図FIG. 4 is a diagram showing an example of a conventional programmable controller having a function of preventing data loss at the time of power failure, (a) is a block diagram of the programmable controller,
Figure (b) shows the contents of the data area of the programmable controller.
【図5】揮発性記憶手段に格納されたデータを使用した
プログラム例を示した図であり、(a) は図4に示したプ
ログラマブルコントローラの外部接続図、(b) はプログ
ラムの内容を表したシーケンス制御図5A and 5B are diagrams showing an example of a program using data stored in a volatile storage means, FIG. 5A is an external connection diagram of the programmable controller shown in FIG. 4, and FIG. Sequence control diagram
【図6】不揮発性記憶手段に格納されたデータを使用し
たプログラム例を示した図であり、(a) は制御対象を表
した図、(b) はシーケンス制御に使用される信号と、制
御目的の関係を示した図、(c) は(b) に示した制御目的
を達成するためのシーケンス制御図6A and 6B are diagrams showing an example of a program using data stored in a non-volatile storage means, FIG. 6A is a diagram showing a control target, and FIG. 6B is a diagram showing signals used for sequence control and control. Diagram showing the relationship between the objectives, (c) is a sequence control diagram to achieve the control objective shown in (b)
101 プログラマブルコントローラ 301 プログラム記憶手段 311 システムプログラム 314 停電時処理用システムプログラム 312 シーケンス制御用システムプログラム 313 一般処理用システムプログラム 101 Programmable controller 301 Program storage means 311 System program 314 Power failure processing system program 312 Sequence control system program 313 General processing system program
Claims (4)
テムプログラムと、二つ以上のシーケンス制御命令を単
位とするシーケンス制御命令群の1単位以上からなるシ
ーケンス制御プログラムとを格納するプログラム記憶手
段と、前記プログラム記憶手段に格納されているプログ
ラムを実行する制御演算手段と、停電時にも格納されて
いるデータを保持する機能を有する不揮発性記憶手段
と、停電時には格納されているデータの保持についての
機能がない揮発性記憶手段と、入力回路と、出力回路と
から成り、停電を検出する回路を備え、この停電検出回
路が発信する停電検出信号を入力されて停電時の処理を
行う機能を有するプログラマブルコントローラにおい
て、 前記シーケンス制御プログラムを実行中に停電が検出さ
れた場合に、前記シーケンス制御プログラムを構成す
る、停電検出時点におけるシーケンス制御命令群の次ぎ
にくる命令が読み出されるまで順次命令を読み出して、
前記停電検出時点におけるシーケンス制御命令群に含ま
れる全てのシーケンス制御命令を実行し、続いて電源回
復後最初に実行すべき命令の番地を前記不揮発性記憶手
段に格納して、前記実行中のシーケンス制御プログラム
の実行を停止することを特徴とするプログラマブルコン
トローラ。1. A program storage means for storing a system program including a program for processing at the time of power failure, and a sequence control program consisting of one or more units of a sequence control instruction group including two or more sequence control instructions as a unit. A control calculation means for executing a program stored in the program storage means, a non-volatile storage means having a function of retaining stored data even in the case of a power failure, and a retention of data stored in the case of power failure. It is equipped with a volatile memory that does not have a function, an input circuit, and an output circuit, and is equipped with a circuit that detects a power failure. It has the function of receiving a power failure detection signal transmitted from this power failure detection circuit and performing processing during a power failure. In the programmable controller, if a power failure is detected while executing the sequence control program, Sequential instructions are read until the next instruction of the sequence control instruction group at the time of power failure detection, which constitutes the sequence control program, is read,
All sequence control instructions included in the sequence control instruction group at the time of the power failure detection are executed, and subsequently, the address of the instruction to be executed first after power recovery is stored in the non-volatile storage means, and the sequence in execution A programmable controller characterized by stopping the execution of a control program.
ーラにおいて、二つの続けて実行されるシーケンス制御
命令群の境界を、前記二つの命令群の内、後に実行され
る命令群の先頭の命令が制御演算手段の演算用レジスタ
にデータをロードする命令であることによって判別する
ことを特徴とするプログラマブルコントローラ。2. The programmable controller according to claim 1, wherein the boundary between two consecutively executed sequence control instruction groups is controlled by the first instruction of the instruction group to be executed later in the two instruction groups. A programmable controller characterized by being judged by an instruction to load data into an arithmetic register of an arithmetic means.
ーラにおいて、一つの制御命令群の最後の命令を、この
命令に続いて実行される命令がシーケンス制御命令以外
の命令であることを判別することにより、検知すること
を特徴とするプログラマブルコントローラ。3. The programmable controller according to claim 1, wherein the last instruction of one control instruction group is determined to be an instruction other than the sequence control instruction, the instruction executed subsequently to this instruction. , A programmable controller characterized by detecting.
ーラにおいて、プログラムを実行中に停電が検出された
場合に、停電検出時点においてプログラムの実行に係わ
っている命令がシーケンス制御命令であるか否かを、こ
の命令が格納されている記憶手段の番地に基づいて判定
し、この命令がシーケンス制御命令に属さない命令の場
合は、停電検出後最後に実行された命令に続いて実行さ
れるべき命令の番地を電源回復後に最初に実行する命令
の番地として、不揮発性記憶手段に格納し、プログラム
の実行を停止することを特徴とするプログラマブルコン
トローラ。4. The programmable controller according to claim 1, wherein when a power failure is detected during execution of the program, whether or not the instruction involved in executing the program at the time of power failure detection is a sequence control instruction. , This instruction is judged based on the address of the storage means in which it is stored. If this instruction does not belong to the sequence control instruction, the instruction to be executed following the last executed instruction after the power failure is detected. A programmable controller characterized in that an address is stored in a non-volatile storage means as an address of an instruction to be executed first after power is restored, and execution of a program is stopped.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP6193913A JPH0863206A (en) | 1994-08-18 | 1994-08-18 | Programmable controller |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP6193913A JPH0863206A (en) | 1994-08-18 | 1994-08-18 | Programmable controller |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH0863206A true JPH0863206A (en) | 1996-03-08 |
Family
ID=16315831
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP6193913A Pending JPH0863206A (en) | 1994-08-18 | 1994-08-18 | Programmable controller |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH0863206A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2007236980A (en) * | 2007-06-25 | 2007-09-20 | Sanyo Product Co Ltd | Game machine |
| CN114508522A (en) * | 2022-03-03 | 2022-05-17 | 山西百一机械设备制造有限公司 | Control method for car lifting jack of torpedo car for preventing data loss |
-
1994
- 1994-08-18 JP JP6193913A patent/JPH0863206A/en active Pending
Cited By (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2007236980A (en) * | 2007-06-25 | 2007-09-20 | Sanyo Product Co Ltd | Game machine |
| CN114508522A (en) * | 2022-03-03 | 2022-05-17 | 山西百一机械设备制造有限公司 | Control method for car lifting jack of torpedo car for preventing data loss |
| CN114508522B (en) * | 2022-03-03 | 2023-08-29 | 山西百一机械设备制造有限公司 | Control method for car machine of iron mixing car frame for preventing data loss |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP2001123874A (en) | Program rewriting system for electronic control device and memory rewriting device | |
| JP2009265819A (en) | Control unit and program for the same | |
| US20190354086A1 (en) | Control device, control method, and control program | |
| JP3551855B2 (en) | Vehicle control device | |
| JP2539264B2 (en) | Sequence controller | |
| JPH0611038U (en) | Data processing device | |
| JP3310481B2 (en) | Test mode execution device | |
| JPS5860318A (en) | Programmable controller | |
| JPH0440725B2 (en) | ||
| JPH0624884Y2 (en) | Programmable controller | |
| JP2731166B2 (en) | Programmable controller | |
| JP3207333B2 (en) | Programmable controller | |
| JPS603210B2 (en) | sequence controller | |
| JPS5969811A (en) | Programmable controller | |
| KR100284044B1 (en) | Abnormal operation recovery method of functional devices with relation | |
| JPS5948402B2 (en) | sequence controller | |
| JPH05241621A (en) | Method for collating sequence program | |
| JP3384141B2 (en) | Programmable controller and programmable controller maintenance device | |
| JP4429395B2 (en) | Programming device | |
| JPH0717326B2 (en) | Elevator control device | |
| JPS6118206B2 (en) | ||
| JPS6118205B2 (en) | ||
| JPH04344937A (en) | Fuzzy inference device | |
| JPH1124712A (en) | Programmable controller | |
| JPH04108495A (en) | Operation controller of washing machine |