JPH0764469A - Programmable controller - Google Patents

Programmable controller

Info

Publication number
JPH0764469A
JPH0764469A JP21274393A JP21274393A JPH0764469A JP H0764469 A JPH0764469 A JP H0764469A JP 21274393 A JP21274393 A JP 21274393A JP 21274393 A JP21274393 A JP 21274393A JP H0764469 A JPH0764469 A JP H0764469A
Authority
JP
Japan
Prior art keywords
instruction
contact input
save
value
stack
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.)
Withdrawn
Application number
JP21274393A
Other languages
Japanese (ja)
Inventor
Masato Yoshioka
誠人 吉岡
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 JP21274393A priority Critical patent/JPH0764469A/en
Publication of JPH0764469A publication Critical patent/JPH0764469A/en
Withdrawn legal-status Critical Current

Links

Landscapes

  • Programmable Controllers (AREA)

Abstract

PURPOSE:To cause a PLC to run a sequence program at high speed that includes contact input commands such as LD commands. CONSTITUTION:In the case of a contact input command of 'LD 000000', '0' is set in the command as save information, and since this indicates that a PF value need not be saved, when the command is executed 'X' stored in the PF value by the previous command is not saved in a stack S1. In the case of a contact input command of 'LD 000002', '1' is set as save information in the command, and since this indicates that the PF value need be saved, when the command is executed 'A+B' stored in the PF value by the previous command of 'OR 000001' is saved in the stack S1.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、接点入力命令等の命令
を含むシーケンスプログラムを実行するプログラマブル
コントローラに関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a programmable controller that executes a sequence program including instructions such as contact input instructions.

【0002】[0002]

【従来の技術】汎用マイクロプロセッサでシーケンスプ
ログラムを実行するプログラマブルコントローラ(以
下、PLCという)としては、シーケンスプログラムを
順次解読実行するインタプリタ方式のものと、シーケン
スプログラムを予めMPUインストラクションに展開し
て実行するコンパイル方式のものとがある。
2. Description of the Related Art As a programmable controller (hereinafter referred to as PLC) for executing a sequence program with a general-purpose microprocessor, an interpreter system for sequentially decoding and executing the sequence program, and a sequence program which is expanded into MPU instructions in advance and executed. Some are compiled.

【0003】このようなPLCでは、通常、図12に示
すように、ビット演算レジスタPF(パワーフローとも
いう)と、ビット演算レジスタPFの値(以下、PF値
という)を退避するためのスタックSn(n=1,2,…)
とを汎用レジスタで構成している。そして、シーケンス
プログラム中のロード命令(以下、LD命令という)等
の接点入力命令を処理する際は、常に、図13に示すよ
うにまずはPF値をスタックに退避し(ステップ1
0)、その後ビット演算レジスタPFにI/Oメモリか
ら読出した接点情報をセットする(ステップ20)、と
いう手順で処理している。
In such a PLC, normally, as shown in FIG. 12, a bit operation register PF (also referred to as a power flow) and a stack Sn for saving a value of the bit operation register PF (hereinafter referred to as a PF value). (N = 1,2, ...)
And are composed of general-purpose registers. When processing a contact input instruction such as a load instruction (hereinafter referred to as an LD instruction) in a sequence program, the PF value is always saved in the stack first as shown in FIG.
0), and then the contact information read from the I / O memory is set in the bit operation register PF (step 20).

【0004】[0004]

【発明が解決しようとする課題】しかし、このような従
来のプログラマブルコントローラでは、シーケンスプロ
グラム中の接点入力命令を実行する際に、毎回それまで
に実行していたビット論理演算の途中結果を常にスタッ
クS1 に退避するようにしていたため、後で使用しない
演算途中結果までも退避する場合があり、高速性を要求
されるシーケンス制御において処理速度を落とす要因と
なる、という問題がある。
However, in such a conventional programmable controller, when executing the contact input instruction in the sequence program, the intermediate result of the bit logical operation which has been executed every time is always stacked. Since the data is saved in S1, even intermediate results that are not used later may be saved, which causes a problem of reducing the processing speed in sequence control that requires high speed.

【0005】より具体的に説明すると、例えば、図14
に示すようなラダ−チャート表現によるシーケンスプロ
グラムSPを実行する際に、図15に示すようにI/O
メモリ内の入力接点情報A〜Dがセットされていた場
合、ビット演算レジスタPFによるビット演算動作は図
16に示すようになる。
More specifically, for example, referring to FIG.
When executing the sequence program SP represented by the ladder chart as shown in FIG.
When the input contact information A to D in the memory is set, the bit operation operation by the bit operation register PF is as shown in FIG.

【0006】つまり、図16では、図14に示すシーケ
ンスプログラムSPをニーモニック表現で示し、このシ
ーケンスプログラムSPを実行する際のビット演算レジ
スタPFによるビット演算動作を示しているが、“LD
000002”の接点入力命令の実行によってスタッ
クに退避される“A+B”は、“AND LD”命令の
実行の際に使用される。これに対し、“LD 0000
00”の接点入力命令の実行によりスタックに退避され
る前の命令の実行結果である“X”は、スタックS1 に
残ったままである。
That is, in FIG. 16, the sequence program SP shown in FIG. 14 is shown in mnemonic form, and the bit operation operation by the bit operation register PF when executing this sequence program SP is shown.
"A + B" saved in the stack by the execution of the contact input instruction of "000002" is used when the "AND LD" instruction is executed. On the other hand, "LD 0000"
The execution result "X" of the instruction before being saved in the stack by the execution of the contact input instruction "00" remains in the stack S1.

【0007】従って、“LD 000000”等の接点
入力命令の場合には、PF値をスタックへ退避する必要
がなく、無駄な処理を行っていることになる。実際にサ
ンプルのシーケンスプログラムを解析したところ、約8
0%ほどの接点入力命令についてPF値の退避が必要な
いという結果が得られており、この無駄な処理がシーケ
ンスプログラムの高速処理を妨げる原因の一つとなって
いる。
Therefore, in the case of a contact input command such as "LD 000000", it is not necessary to save the PF value in the stack, and wasteful processing is performed. When we actually analyzed the sample sequence program, about 8
The result is that the saving of the PF value is not necessary for about 0% of the contact input commands, and this useless processing is one of the causes that hinder the high-speed processing of the sequence program.

【0008】そこで、本発明はこのような問題に着目し
てなされたもので、LD命令等の接点入力命令を含むシ
ーケンスプログラムを高速に実行できるプログラマブル
コントローラを提供することを目的とする。
Therefore, the present invention has been made in view of such a problem, and an object thereof is to provide a programmable controller capable of executing a sequence program including a contact input instruction such as an LD instruction at high speed.

【0009】[0009]

【課題を解決するための手段】上記目的を達成するた
め、請求項1記載の発明では、接点入力命令等の命令を
含むシーケンスプログラムを実行するプログラマブルコ
ントローラにおいて、シーケンスプログラム中の各命令
の実行による演算結果を保持する演算レジスタと、接点
入力命令を実行する際、その前に実行された命令の演算
結果が退避されるスタックと、シーケンスプログラム中
の各接点入力命令について、命令実行の際に上記演算レ
ジスタに保持された演算結果をスタックへ退避する必要
があるか否かを判断して、各接点入力命令に当該退避を
行うか否かを示す退避情報を付加する退避情報付加手段
と、上記退避情報付加手段によって接点入力命令に付加
された退避情報を参照して、演算結果の退避が必要でな
い接点入力命令の場合には、上記演算レジスタに保持さ
れた演算結果を上記スタックへ退避せずにその演算レジ
スタに接点入力情報をセットする命令実行手段と、を具
備することを特徴とする。
In order to achieve the above object, in the invention according to claim 1, a programmable controller for executing a sequence program including an instruction such as a contact input instruction is executed by executing each instruction in the sequence program. Regarding the operation register that holds the operation result, the stack that saves the operation result of the instruction executed before the contact input instruction is executed, and the contact input instruction in the sequence program Save information adding means for determining whether or not it is necessary to save the operation result held in the operation register to the stack and adding save information to each contact input instruction indicating whether or not to perform the save; In the case of a contact input instruction that does not need to save the calculation result, refer to the save information added to the contact input instruction by the save information adding means. In is characterized by comprising an instruction execution means for setting the contact input information to the calculation register operation result held in the arithmetic register without retracting into the stack.

【0010】請求項2記載の発明では、請求項1記載の
プログラマブルコントローラにおいて、命令実行手段
が、シーケンスプログラム中の各命令をインタプリタ方
式で順次実行し、接点入力命令を実行する場合には、退
避情報付加手段によって接点入力命令に付加された退避
情報を参照して、演算結果の退避が必要でない接点入力
命令の場合のみ、演算レジスタに保持された演算結果を
スタックへ退避せずにその演算レジスタに接点入力情報
をセットする、ことを特徴とする。
According to a second aspect of the present invention, in the programmable controller according to the first aspect, when the instruction executing means sequentially executes each instruction in the sequence program by an interpreter method and executes the contact input instruction, the save is executed. By referring to the save information added to the contact input instruction by the information adding means, only in the case of the contact input instruction that does not need to save the operation result, the operation result held in the operation register is not saved in the stack and the operation register is saved. The contact input information is set to.

【0011】請求項3記載の発明では、請求項1記載の
プログラマブルコントローラにおいて、命令実行手段
が、シーケンスプログラムをコンパイル方式でインスト
ラクションに展開してから実行し、接点入力命令を実行
する場合には、退避情報付加手段によって接点入力命令
に付加された退避情報を参照して、演算結果の退避が必
要でない接点入力命令の場合のみ、演算レジスタに保持
された演算結果をスタックへ退避せずにその演算レジス
タに接点入力情報をセットするインストラクションに展
開してから実行する、ことを特徴とする。
According to a third aspect of the present invention, in the programmable controller according to the first aspect, when the instruction executing means expands the sequence program into instructions by a compile method and then executes the instruction to execute the contact input instruction, By referring to the save information added to the contact input instruction by the save information adding means, only in the case of the contact input instruction that does not need to save the operation result, the operation result held in the operation register is not saved in the stack and the operation is performed. It is characterized in that it is executed after being expanded into an instruction for setting contact input information in a register.

【0012】請求項4記載の発明では、請求項1記載の
プログラマブルコントローラにおいて、退避情報付加手
段が、シーケンスプログラムの最後から先頭にさかのぼ
って解析して、スタックに退避された演算結果を参照す
るスタック参照命令の場合にはカウンタの値をインクリ
メントする一方、接点入力命令の場合にはさらに上記カ
ウンタの値がその初期値より増加しているか否かを判断
して、増加している場合には当該接点入力命令に演算結
果の退避を示す退避情報を付加すると共に上記カウンタ
の値をデクリメントする一方、増加してない場合には当
該接点入力命令に演算結果の退避しないことを示す退避
情報を付加する、ことを特徴とする。
According to a fourth aspect of the present invention, in the programmable controller according to the first aspect, the save information adding means analyzes the sequence program from the end to the beginning and refers to the operation result saved in the stack. In the case of a reference instruction, the counter value is incremented, while in the case of a contact input instruction, it is further judged whether or not the counter value has increased from its initial value. While saving information indicating the saving of the operation result is added to the contact input instruction and decrementing the value of the counter, when not increasing, save information indicating that the operation result is not saved is added to the contact input instruction. , Is characterized.

【0013】[0013]

【作用】本発明では、シーケンスプログラム中の各接点
入力命令について、当該命令実行の際に演算レジスタに
保持された演算結果をスタックへ退避する必要があるも
のであるか否かを判断して、各接点入力命令に当該退避
を行うか否かを示す退避情報を付加し、演算結果の退避
が必要でない接点入力命令を実行する場合のみ、演算レ
ジスタに保持された演算結果をスタックへ退避せずにそ
の演算レジスタに接点入力情報をセットすることによ
り、シーケンスプログラムの高速処理化を図る。
According to the present invention, for each contact input instruction in the sequence program, it is judged whether or not it is necessary to save the operation result held in the operation register to the stack when the instruction is executed, Save the operation result held in the operation register to the stack only when executing the contact input instruction that does not need to save the operation result by adding save information indicating whether or not to perform the save to each contact input instruction By setting contact input information in the operation register, the sequence program can be processed at high speed.

【0014】[0014]

【実施例】以下、本発明に係るPLCの実施例を説明す
る。
Embodiments of the PLC according to the present invention will be described below.

【0015】図1に、本発明に係るPLCの第1実施例
の構成を示す。
FIG. 1 shows the configuration of a first embodiment of a PLC according to the present invention.

【0016】このPLCは、シーケンスプログラム中の
命令をインタプリタプログラムによって順次解読実行す
るインタプリタ方式のもので、MPU11と、退避情報
付加プログラムメモリ12と、インタプリタプログラム
メモリ13と、I/Oメモリ14と、シーケンスプログ
ラムメモリ15と、ワークメモリ16と、プログラミン
グツールI/F17とを有する。
This PLC is of an interpreter type in which the instructions in the sequence program are sequentially decoded and executed by an interpreter program, and includes an MPU 11, a save information addition program memory 12, an interpreter program memory 13, an I / O memory 14. It has a sequence program memory 15, a work memory 16, and a programming tool I / F 17.

【0017】退避情報付加プログラムメモリ12にはM
PU11が退避情報付加手段として動作するための退避
情報付加プログラムが格納されており、インタプリタプ
ログラムメモリ13にはMPU11が命令実行手段とし
てインタプリタ方式でシーケンスプログラムを実行する
ためのインタプリタプログラムが格納されている。ま
た、I/Oメモリ14には演算すべき接点入力情報が格
納され、シーケンスプログラムメモリ15にはシーケン
スプログラムが格納され、ワークメモリ16には後述す
るスタックカウンタが設けられる。
The save information addition program memory 12 has M
A save information addition program for the PU 11 to operate as a save information addition means is stored, and an interpreter program memory 13 stores an interpreter program for the MPU 11 to execute a sequence program in an interpreter system as an instruction execution means. . The I / O memory 14 stores contact input information to be calculated, the sequence program memory 15 stores a sequence program, and the work memory 16 is provided with a stack counter described later.

【0018】図2に、LD命令の命令コードフォーマッ
トの一例を示す。
FIG. 2 shows an example of the instruction code format of the LD instruction.

【0019】このLD命令は、最初(1st)のワード
のNo9〜12の4ビットでLD命令を示し、かつ、N
o4の1ビットにPUSHフィールドを設けており、退
避情報がセットされる構成になっている。そして、2番
目(2nd)のワードでロードすべきデータのチャネル
番号と接点番号とがセットされる構成になっている。な
お、プログラミングツールI/F17を介して読み込ま
れた直後のLD命令では、このPUSHフィールドの値
は不定で、後述する退避情報付加処理によりPF値の退
避が必要か否かが判断されて退避情報がセットされる。
This LD instruction indicates the LD instruction with 4 bits of Nos. 9 to 12 of the first (1st) word, and N
A PUSH field is provided in 1 bit of o4, and save information is set. Then, the channel number and contact number of the data to be loaded are set in the second (2nd) word. In the LD instruction immediately after being read via the programming tool I / F 17, the value of this PUSH field is indefinite, and it is judged whether or not the PF value needs to be saved by the save information addition process described later, and the save information is saved. Is set.

【0020】図3に、本発明におけるMPU11内のP
F値とスタックの構成を示す。本発明では、MPU11
内の別の汎用レジスタR1,R2に、各々演算レジスタ
PFと、スタックSnとを設けている。
FIG. 3 shows P in the MPU 11 according to the present invention.
The F value and the stack configuration are shown. In the present invention, the MPU 11
In the other general-purpose registers R1 and R2, an arithmetic register PF and a stack Sn are provided.

【0021】次に、本実施例の動作を図面を参照して説
明する。
Next, the operation of this embodiment will be described with reference to the drawings.

【0022】図4に、本実施例に係るPLCによる命令
実行処理を示す。
FIG. 4 shows instruction execution processing by the PLC according to this embodiment.

【0023】このPLCでは、電源ON後に、まず所定
のイニシャライズ処理を行い(ステップ100)、続い
てプログラミングツールI/F17を介してプログラミ
ングツール等によりシーケンスプログラムの読み込みを
行い(ステップ110)、続いて退避情報付加プログラ
ムメモリ12に格納された退避情報付加プログラムに基
づいて命令の退避情報付加処理、すなわちシーケンスプ
ログラムを構成する各命令の命令コードを解析して、各
接点入力命令についてのみPF値を退避する必要がある
か否かを判断して、各接点入力命令に退避情報を付加す
る(ステップ120)。この退避情報付加処理について
は後述する。
In this PLC, after the power is turned on, first, a predetermined initialization process is performed (step 100), then a sequence program is read by a programming tool or the like via the programming tool I / F 17 (step 110), and then, Saving information addition program Based on the saving information addition program stored in the memory 12, the saving information addition processing of the instruction, that is, the instruction code of each instruction constituting the sequence program is analyzed, and the PF value is saved only for each contact input instruction. It is determined whether or not it is necessary to add the save information to each contact input command (step 120). This save information addition processing will be described later.

【0024】このような退避情報付加処理が終了する
と、MPU11がインタプリタプログラムメモリ13に
格納されたインタプリタプログラムによって命令を実行
する(ステップ130)。この実行の際、LD命令等の
接点入力命令の場合には、図2に示すように接点入力命
令の命令コードフォーマットのPUSHフィールドの値
を参照して、PUSHフィールドの値が“1”である場
合には、PF値の退避を行う一方、PUSHフィールド
の値が“0”である場合には、PF値の退避を行わない
ようにする。
When the save information adding process is completed, the MPU 11 executes an instruction by the interpreter program stored in the interpreter program memory 13 (step 130). At the time of this execution, in the case of a contact input instruction such as an LD instruction, the value of the PUSH field is "1" by referring to the value of the PUSH field of the instruction code format of the contact input instruction as shown in FIG. In this case, the PF value is saved, while when the value of the PUSH field is "0", the PF value is not saved.

【0025】そして、このような命令の実行処理をエン
ド(END)命令を実行するまで繰り返し、エンド命令
を実行した場合には(ステップ140“Yes”)、入出
力リフレッシュ処理を行い(ステップ150)、さらに
そのシーケンスプログラムを実行する場合には、再度イ
ンタプリタによる命令の実行処理(ステップ130)を
行うようにする。
Then, the execution processing of such an instruction is repeated until the end (END) instruction is executed, and when the end instruction is executed (step 140 "Yes"), the input / output refresh processing is executed (step 150). When the sequence program is further executed, the interpreter executes the instruction execution process (step 130) again.

【0026】次に、前述したシーケンスプログラム中の
命令についての退避情報付加処理を説明する。
Next, the save information adding process for the instructions in the above sequence program will be described.

【0027】図5は、この退避情報付加処理の手順を示
している。
FIG. 5 shows the procedure of this save information addition processing.

【0028】この退避情報付加処理は、“AND L
D”や“OR LD”命令等のスタック参照命令が、必
ず“LD”や“LD NOT”命令等の接点入力命令の
後に現れるということに着目して、ワークメモリ16中
に設けたスタックカウンタを利用して、シーケンスプロ
グラムの最後からその先頭方向にさかのぼってPF値退
避回数とスタック参照回数との差を求めることによって
行う。
This save information addition processing is performed by "AND L
Paying attention to the fact that stack reference instructions such as "D" and "OR LD" instructions always appear after contact input instructions such as "LD" and "LD NOT" instructions, the stack counter provided in the work memory 16 is It is performed by tracing back from the end of the sequence program in the direction of the beginning of the sequence program to find the difference between the PF value save count and the stack reference count.

【0029】つまり、まず最初にスタックカウンタの初
期値として“0”をセットして、シーケンスプログラム
中の命令を最後から先頭方向へ見ていき(ステップ21
0)、“AND LD”命令等のスタック参照命令の場
合には(ステップ220“Yes”)、スタックカウンタ
の値を1インクリメントする一方(ステップ230)、
スタック参照命令でなく(ステップ220“No”)、
“LD”命令等の接点入力命令の場合には(ステップ2
40“Yes”)、続いてスタックカウンタの値が“0”
より大きいか否かを判断する(ステップ250)。
That is, first, "0" is set as the initial value of the stack counter, and the instructions in the sequence program are viewed from the end toward the beginning (step 21).
0), and a stack reference instruction such as an "AND LD" instruction (step 220 "Yes"), the value of the stack counter is incremented by 1 (step 230),
Not a stack reference instruction (step 220 “No”),
In the case of contact input command such as "LD" command (step 2
40 "Yes"), then the stack counter value is "0"
It is determined whether or not it is larger (step 250).

【0030】ここで、スタックカウンタの値が“0”よ
り大きい場合には(ステップ250“Yes”)、PF値
退避回数がスタック参照回数より小さいことを示してい
るため、当該命令のPUSHフィールド(図2参照)に
PF値の退避を示す“1”をセットして(ステップ26
0)、スタックカウンタの値を1デクリメントする(ス
テップ270)。
Here, if the value of the stack counter is larger than "0" (step 250 "Yes"), it means that the PF value save count is smaller than the stack reference count. Therefore, the PUSH field ( 2 (see FIG. 2) is set to "1" indicating that the PF value is saved (step 26).
0), the value of the stack counter is decremented by 1 (step 270).

【0031】これに対し、スタックカウンタの値が
“0”の場合には(ステップ250“No”)、PF値
退避回数がスタック参照回数と同じで、この接点入力命
令の実行の際はPF値の退避は不要であることを示して
いるため、当該命令のPUSHフィールドにPF値の退
避を行わないことを示す“0”をセットする(ステップ
280)。
On the other hand, when the value of the stack counter is "0" (step 250 "No"), the PF value save count is the same as the stack reference count and the PF value is executed when this contact input instruction is executed. Since it indicates that the saving of the PF value is unnecessary, "0" indicating that the PF value is not saved is set in the PUSH field of the instruction (step 280).

【0032】そしてこのようなステップ220〜280
までの処理をシーケンスプログラムの先頭まで繰り返し
て(ステップ290“No”)、シーケンスプログラム
の先頭まできた場合には(ステップ290“Yes”)、
この命令の退避情報付加処理を終了する。このような処
理により、シーケンスプログラム中のすべての接点入力
命令についてPF値の退避を行うか否かを設定できる。
Then, such steps 220 to 280
The above process is repeated until the beginning of the sequence program (step 290 “No”), and when the beginning of the sequence program is reached (step 290 “Yes”),
The evacuation information addition processing of this instruction is ended. By such processing, it is possible to set whether or not to save the PF value for all contact input instructions in the sequence program.

【0033】従って、例えば、従来例のところで説明し
た図16に示すニーモニック表現のシーケンスプログラ
ムSPを前述の図5に示す退避情報付加処理により解析
した場合、“LD 000002”の接点入力命令が現
れた場合には、その命令の前に“AND LD”命令が
現れており、ステップ230でスタックカウンタの値
“1”がセットされているため、ステップ250の判断
処理で“0”より大きいと判断されて、ステップ260
でPUSHフィールドに“1”、すなわちPF値の退避
必要有りと設定されることになる。
Therefore, for example, when the sequence program SP of the mnemonic expression shown in FIG. 16 described in the conventional example is analyzed by the save information adding process shown in FIG. 5, the contact input command of "LD 000002" appears. In this case, since the “AND LD” instruction appears before that instruction and the stack counter value “1” is set in step 230, it is determined in step 250 that the value is greater than “0”. Step 260
Then, the PUSH field is set to "1", that is, the PF value needs to be saved.

【0034】これに対し、“LD 000000”の接
点入力命令の場合には、“LD 000002”の解析
のときステップ270でスタックカウンタの値が1デク
リメントされ“0”にセットされているため、ステップ
250の判断処理でスタックカウンタの値が“0”と判
断されて、ステップ260でPUSHフィールドに退避
情報として“1”、すなわちPF値の退避必要なしと設
定されることになる。
On the other hand, in the case of the contact input command of "LD 000000", the value of the stack counter is decremented by 1 and set to "0" at step 270 when "LD 000002" is analyzed. The value of the stack counter is determined to be "0" in the determination processing of 250, and "1" is set as the save information in the PUSH field in step 260, that is, the PF value need not be saved.

【0035】次に、図4のステップ130におけるイン
タプリタによる命令の実行処理において、接点入力命令
の実行処理を説明する。
Next, in the instruction execution processing by the interpreter in step 130 of FIG. 4, the contact input instruction execution processing will be described.

【0036】図6に、接点入力命令の処理手順を示す。FIG. 6 shows the processing procedure of the contact input command.

【0037】この実施例では、PF値を退避する命令と
退避しない命令とで別ルーチンで命令を実行しており、
PF値を退避する接点入力命令の実行の場合には、同図
(a)に示すように、図7に示すPF値のスタック退避
処理を行い(ステップ310)、その後図8に示す演算
レジスタPFへの接点情報のセット処理を行う(ステッ
プ320)。
In this embodiment, the instruction for saving the PF value and the instruction for not saving the PF value are executed in different routines.
In the case of executing the contact input instruction for saving the PF value, as shown in FIG. 7A, the stack saving process of the PF value shown in FIG. 7 is performed (step 310), and then the arithmetic register PF shown in FIG. A contact information setting process is performed (step 320).

【0038】これに対し、PF値を退避しない接点入力
命令の実行の場合には、同図(b)に示すように、図7
に示すPF値の値のスタック退避処理は行わず、図8に
示す演算レジスタPFへの接点情報のセット処理を行う
ようにする(ステップ330)。
On the other hand, in the case of executing a contact input command which does not save the PF value, as shown in FIG.
The stack saving process of the value of the PF value shown in is not performed, but the process of setting the contact information in the arithmetic register PF shown in FIG. 8 is performed (step 330).

【0039】図7に、前述したPF値の退避処理の手順
を示す。
FIG. 7 shows the procedure of the above-mentioned PF value saving processing.

【0040】この退避処理は、図3に示すように、まず
スタックSnが設けられたレジスタR2を1ビット左へ
シフトして(ステップ410)、続いて演算レジスタP
Fが設けられたレジスタR1においてPFビット以外を
0にマスクして(ステップ420)、演算レジスタPF
側のレジスタR1と、スタックSn側のレジスタR2と
の論理和をとることによりPF値をスタックS1 にセッ
トする(ステップ430)、という3ステップで終了す
る。なお、各1ステップは、ほぼMPUインストラクシ
ョンの1ステップに対応している。
In this saving process, as shown in FIG. 3, first, the register R2 provided with the stack Sn is shifted to the left by one bit (step 410), and then the arithmetic register P is set.
In the register R1 provided with F, all but the PF bit are masked to 0 (step 420), and the arithmetic register PF
Side register R1 and the stack Sn side register R2 are ORed to set the PF value in the stack S1 (step 430). It should be noted that each one step substantially corresponds to one step of the MPU instruction.

【0041】図8に、前述した演算レジスタPFへの接
点入力情報のセット処理の手順を示す。
FIG. 8 shows the procedure of the process of setting the contact input information to the arithmetic register PF described above.

【0042】この処理は、まずI/Oメモリからチャネ
ルデータを読出してテンポラリのレジスタにセットし
(ステップ510)、次いで取り出したい接点入力情報
がPF値の位置にくるまでテンポラリのレジスタをシフ
トして、PF値のレジスタにセットする(ステップ52
0)、という2ステップで終了する。なお、この処理で
も、各1ステップは、ほぼMPUインストラクションの
1ステップに対応している。
In this process, first, the channel data is read from the I / O memory and set in the temporary register (step 510), and then the temporary register is shifted until the contact input information to be taken out is at the PF value position. , PF value register (step 52)
The process is completed in two steps of 0). Even in this process, each step corresponds to one step of the MPU instruction.

【0043】ここで、図9に、図16に示す従来技術の
場合と同じシーケンスプログラムSPを実行した場合の
演算レジスタPFにおける演算動作を示す。
Here, FIG. 9 shows an arithmetic operation in the arithmetic register PF when the same sequence program SP as in the case of the conventional technique shown in FIG. 16 is executed.

【0044】図9に示すように、“LD 00000
0”の接点入力命令の場合には、前述した通りPUSH
フィールドに“0”がセットされており、PF値の退避
必要なしを示しているため、当該命令を実行した際には
前の命令によってPF値に格納された“X”をスタック
S1 へ退避しない。
As shown in FIG. 9, "LD 00000
In the case of a 0 "contact input command, PUSH is used as described above.
Since "0" is set in the field, indicating that it is not necessary to save the PF value, "X" stored in the PF value by the previous instruction is not saved to the stack S1 when the relevant instruction is executed. .

【0045】また、“LD 000002”の接点入力
命令の場合には、前述した通りPUSHフィールドに
“1”がセットされており、PF値の退避必要ありを示
しているため、当該命令を実行した際には前の命令“O
R 000001”によってPF値に格納された“A+
B”をスタックS1 へ退避する。
Further, in the case of the contact input command of "LD 000002", "1" is set in the PUSH field as described above, indicating that it is necessary to save the PF value, so the command is executed. When the previous instruction "O
"A +" stored in the PF value by R000001 "
B "is saved to the stack S1.

【0046】従って、PF値を退避する接点入力命令の
場合には、図6(a)に示すように、図7に示すPF値
の退避処理および図8に示す演算レジスタPFへの接点
情報のセット処理の両方の処理を行うが、PF値を退避
しない接点入力命令の場合には、図6(b)に示すよう
に、図7に示すPF値の退避処理は行わずに、図8に示
す演算レジスタPFへの接点情報のセット処理のみを行
う。
Therefore, in the case of a contact input instruction for saving the PF value, as shown in FIG. 6A, the PF value saving process shown in FIG. 7 and the contact information to the operation register PF shown in FIG. In the case of a contact input command that performs both of the set processing but does not save the PF value, as shown in FIG. 6B, the PF value saving processing shown in FIG. Only the setting process of the contact information to the operation register PF shown is performed.

【0047】このため、このPF値を退避しない接点入
力命令を実行する場合には、無駄なPF値の退避処理を
実行しなくなり、処理時間がステップ比で3ステップ分
の60%だけ減少することになる。
Therefore, when the contact input command that does not save the PF value is executed, useless save processing of the PF value is not executed, and the processing time is reduced by 60% corresponding to 3 steps. become.

【0048】実際にサンプルのシーケンスプログラムを
解析したところ、約80%ほどの接点入力命令について
PF値の退避が必要ないという結果が得られている。
When the sample sequence program was actually analyzed, it was found that about 80% of the contact input commands did not require saving of the PF value.

【0049】よって、実際のサンプルのシーケンスプロ
グラムでは、その約80%ほどの接点入力命令について
処理時間がステップ比で60%だけ減少されため、本実
施例によれば、シーケンスプログラムを高速に処理でき
ることがわかる。
Therefore, in the actual sample sequence program, the processing time is reduced by 60% in step ratio for about 80% of the contact input commands. Therefore, according to the present embodiment, the sequence program can be processed at high speed. I understand.

【0050】次に、本発明の第2実施例を説明する。Next, a second embodiment of the present invention will be described.

【0051】このPLCは、シーケンスプログラムをイ
ンタプリタ方式で実行する第1実施例と異なり、コンパ
イラ方式でシーケンスプログラムを実行するものであ
る。
Unlike the first embodiment in which the sequence program is executed in the interpreter system, this PLC executes the sequence program in the compiler system.

【0052】図10に、この第2実施例のPLCの構成
を示す。
FIG. 10 shows the configuration of the PLC of the second embodiment.

【0053】この第2実施例は、MPU21、退避情報
付加プログラムメモリ22、コンパイラプログラムメモ
リ23、I/Oメモリ24、シーケンスプログラムメモ
リ25、MPUインストラクションメモリ26、ワーク
メモリ27、およびプログラミングツールI/F28を
有しており、第1実施例と異なる点は、インタプリタプ
ログラムメモリの代りにコンパイラプログラムメモリ2
3を設けた点と、シーケンスプログラムをコンパイルす
るためのMPUインストラクションメモリ26を設けた
点である。
In the second embodiment, the MPU 21, save information addition program memory 22, compiler program memory 23, I / O memory 24, sequence program memory 25, MPU instruction memory 26, work memory 27, and programming tool I / F 28 are used. The difference from the first embodiment is that the compiler program memory 2 is used instead of the interpreter program memory.
3 is provided and an MPU instruction memory 26 for compiling the sequence program is provided.

【0054】次に、この第2実施例の動作を説明する。Next, the operation of the second embodiment will be described.

【0055】図11に、この第2実施例のPLCの動作
を示す。
FIG. 11 shows the operation of the PLC of the second embodiment.

【0056】この第2実施例のPLCでは、電源ON後
に、まず所定のイニシャライズ処理を行って(ステップ
600)、続いてプログラミングツールI/F28を介
してプログラミングツールよりシーケンスプログラムの
読み込みを行い(ステップ610)、続いて退避情報付
加プログラムメモリ12に格納された退避情報付加プロ
グラムに基づいて第1実施例の場合と同様に図5に示す
ように命令の退避情報付加処理を行って、各接点入力命
令に退避情報を付加する(ステップ620)。
In the PLC of the second embodiment, after the power is turned on, first, a predetermined initialization process is performed (step 600), and then the sequence program is read from the programming tool via the programming tool I / F 28 (step 600). 610), and subsequently, based on the save information adding program stored in the save information adding program memory 12, the save information adding process of the instruction is performed as shown in FIG. Save information is added to the instruction (step 620).

【0057】そして、その退避情報付加処理が終了する
と、MPU21がコンパイラプログラムメモリ23に格
納されたコンパイラプログラムによって退避情報が付加
された命令コードをMPUインストラクションに展開し
てMPUのインストラクションメモリ26に格納して
(ステップ630)、当該インストラクションをMPU
21が実行して(ステップ640)、その実行後に入出
力リフレッシュ処理を行う(ステップ650)。
When the save information adding process is completed, the MPU 21 expands the instruction code to which the save information is added by the compiler program stored in the compiler program memory 23 into an MPU instruction and stores it in the MPU instruction memory 26. (Step 630), the instruction is MPU
21 executes (step 640), and after the execution, I / O refresh processing is performed (step 650).

【0058】なお、ステップ630でコンパイラプログ
ラムによってLD命令等の接点入力命令をインストラク
ションに展開する際には、図2に示すように接点入力命
令のPUSHフィールドにセットされた退避情報に基づ
いて展開するようにする。
When a contact input instruction such as an LD instruction is expanded into an instruction by the compiler program in step 630, it is expanded based on the save information set in the PUSH field of the contact input instruction as shown in FIG. To do so.

【0059】つまり、退避情報として“1”がセットさ
れている場合には、PF値の退避を行うことを示してい
るため、PF値の退避を行うようなインストラクション
に展開、すなわち第1実施例のところで説明した図7に
示すPF値の退避処理および図8に示すPF値への接点
情報のセット処理の両方の処理を行うようなインストラ
クションに展開する。
That is, when "1" is set as the save information, it indicates that the PF value is saved. Therefore, the instruction is expanded to save the PF value, that is, the first embodiment. The instruction is expanded to the instruction that performs both the PF value saving process shown in FIG. 7 and the contact information setting process to the PF value shown in FIG.

【0060】これに対し、退避情報として“0”がセッ
トされている場合には、PF値の退避を行わないことを
示しているため、図7に示すPF値の退避処理は行わ
ず、図8に示すPF値への接点情報のセット処理のみを
行うようなインストラクションに展開する。
On the other hand, when "0" is set as the save information, it indicates that the PF value is not saved, so that the PF value save process shown in FIG. 7 is not executed. The instruction shown in FIG. 8 is developed so that only the contact information is set to the PF value.

【0061】このため、図11におけるステップ640
でこのPF値を退避しない接点入力命令のインストラク
ションを実行する場合には、第1実施例の場合と同様
に、処理時間がステップ比で3ステップ分の60%だけ
減少することになる。
Therefore, step 640 in FIG.
Therefore, when the instruction of the contact input instruction which does not save the PF value is executed, the processing time is reduced by 60% corresponding to three steps as in the case of the first embodiment.

【0062】従って、コンパイル方式の第2実施例によ
っても、第1実施例と同様、無駄なPF値の退避処理を
実行しなくなり、シーケンスプログラムを高速に処理で
きることになる。
Therefore, according to the second embodiment of the compiling method, similarly to the first embodiment, the wasteful PF value saving processing is not executed and the sequence program can be processed at high speed.

【0063】[0063]

【発明の効果】以上説明したように、本発明では、シー
ケンスプログラム中の各接点入力命令について、命令実
行の際に演算レジスタに保持された演算結果をスタック
へ退避する必要があるか否かを判断して、演算結果の退
避が必要でない接点入力命令を実行する場合のみ、演算
レジスタに保持された演算結果をスタックへ退避せずに
その演算レジスタに接点入力情報をセットするようにし
たため、無駄なPF値の退避処理を実行しなくなり、シ
ーケンスプログラムを高速に処理できる。
As described above, according to the present invention, for each contact input instruction in the sequence program, it is determined whether the operation result held in the operation register at the time of executing the instruction needs to be saved in the stack. Only when a judgment is made and a contact input instruction that does not require saving the operation result is executed, the contact input information is set in that operation register without saving the operation result held in the operation register to the stack. It is possible to process the sequence program at high speed without executing the saving process of the PF value.

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

【図1】本発明に係るPLCの第1実施例の構成を示す
ブロック図。
FIG. 1 is a block diagram showing the configuration of a first embodiment of a PLC according to the present invention.

【図2】ロード命令の命令コードフォーマットの一例を
示す説明図。
FIG. 2 is an explanatory diagram showing an example of an instruction code format of a load instruction.

【図3】本発明におけるPF値とスタックの構成を示す
説明図。
FIG. 3 is an explanatory diagram showing a PF value and a stack configuration according to the present invention.

【図4】第1実施例の動作を示すフローチャート。FIG. 4 is a flowchart showing the operation of the first embodiment.

【図5】各接点入力命令についての退避情報付加処理を
示すフローチャート。
FIG. 5 is a flowchart showing a save information addition process for each contact input command.

【図6】接点入力命令の処理手順を示すフローチャー
ト。
FIG. 6 is a flowchart showing a processing procedure of a contact input command.

【図7】PF値の退避処理の手順を示すフローチャー
ト。
FIG. 7 is a flowchart showing a procedure of PF value saving processing.

【図8】PF値への接点情報のセット処理の手順を示す
フローチャート。
FIG. 8 is a flowchart showing a procedure of a process of setting contact information to a PF value.

【図9】図16に示す従来の場合と同じシーケンスプロ
グラムを実行した場合のPF値における演算動作を示す
説明図。
9 is an explanatory diagram showing a calculation operation for a PF value when the same sequence program as that of the conventional case shown in FIG. 16 is executed.

【図10】本発明に係るPLCの第2実施例の構成を示
すブロック図。
FIG. 10 is a block diagram showing the configuration of a second embodiment of the PLC according to the present invention.

【図11】第2実施例の動作を示すフローチャート。FIG. 11 is a flowchart showing the operation of the second embodiment.

【図12】従来のPLCにおけるPF値とスタックの構
成す説明図。
FIG. 12 is an explanatory diagram showing a configuration of a PF value and a stack in a conventional PLC.

【図13】従来のPLCにおける接点入力命令の処理手
順を示すフローチャート。
FIG. 13 is a flowchart showing a processing procedure of a contact input command in a conventional PLC.

【図14】ラダ−チャート表現によるシーケンスプログ
ラムの一例を示す説明図。
FIG. 14 is an explanatory diagram showing an example of a sequence program represented by a ladder chart.

【図15】I/Oメモリ内の状態を示す説明図。FIG. 15 is an explanatory diagram showing a state in the I / O memory.

【図16】従来のPLCにおけるPF値のビット演算動
作を示すフローチャート。
FIG. 16 is a flowchart showing a bit calculation operation of a PF value in a conventional PLC.

【符号の説明】[Explanation of symbols]

11 MPU(退避情報付加手段,命令実行手段) 12 退避情報付加プログラムメモリ 13 インタプリタプログラムメモリ 14 I/Oメモリ 15 シーケンスプログラムメモリ 16 ワークメモリ 17 プログラミングツールI/F SP シーケンスプログラム PF 演算レジスタ Sn(n=1,2,…) スタック 11 MPU (save information adding means, instruction executing means) 12 save information adding program memory 13 interpreter program memory 14 I / O memory 15 sequence program memory 16 work memory 17 programming tool I / F SP sequence program PF operation register Sn (n = 1,2, ...) Stack

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 接点入力命令等の命令を含むシーケンス
プログラムを実行するプログラマブルコントローラにお
いて、 シーケンスプログラム中の各命令の実行による演算結果
を保持する演算レジスタと、 接点入力命令を実行する際、その前に実行された命令の
演算結果が退避されるスタックと、 シーケンスプログラム中の各接点入力命令について、命
令実行の際に上記演算レジスタに保持された演算結果を
スタックへ退避する必要があるか否かを判断して、各接
点入力命令に当該退避を行うか否かを示す退避情報を付
加する退避情報付加手段と、 上記退避情報付加手段によって接点入力命令に付加され
た退避情報を参照して、演算結果の退避が必要でない接
点入力命令の場合には、上記演算レジスタに保持された
演算結果を上記スタックへ退避せずにその演算レジスタ
に接点入力情報をセットする命令実行手段と、 を具備することを特徴とするプログラマブルコントロー
ラ。
1. In a programmable controller that executes a sequence program including instructions such as contact input instructions, an operation register that holds an operation result obtained by executing each instruction in the sequence program, and before executing the contact input instruction. The stack in which the operation result of the executed instruction is saved and whether or not it is necessary to save the operation result held in the above operation register to the stack for each contact input instruction in the sequence program when the instruction is executed By referring to the evacuation information adding means for adding evacuation information indicating whether or not to perform evacuation to each contact input instruction, and the evacuation information added to the contact input instruction by the evacuation information adding means, In the case of contact input instructions that do not need to save the calculation result, the calculation result held in the above calculation register is transferred to the above stack. Programmable controller characterized by comprising an instruction execution means for setting the contact input information to the calculation register without avoid the.
【請求項2】 命令実行手段が、シーケンスプログラム
中の各命令をインタプリタ方式で順次実行し、接点入力
命令を実行する場合には、退避情報付加手段によって接
点入力命令に付加された退避情報を参照して、演算結果
の退避が必要でない接点入力命令の場合のみ、演算レジ
スタに保持された演算結果をスタックへ退避せずにその
演算レジスタに接点入力情報をセットする、 ことを特徴とする請求項1記載のプログラマブルコント
ローラ。
2. When the instruction executing means sequentially executes each instruction in the sequence program by an interpreter method and executes the contact input instruction, the save information adding means refers to the save information added to the contact input instruction. The contact input information is set in the operation register without saving the operation result held in the operation register to the stack only when the contact input instruction does not require saving the operation result. 1. The programmable controller according to 1.
【請求項3】 命令実行手段が、シーケンスプログラム
をコンパイル方式でインストラクションに展開してから
実行し、接点入力命令を実行する場合には、退避情報付
加手段によって接点入力命令に付加された退避情報を参
照して、演算結果の退避が必要でない接点入力命令の場
合のみ、演算レジスタに保持された演算結果をスタック
へ退避せずにその演算レジスタに接点入力情報をセット
するインストラクションに展開してから実行する、 ことを特徴とする請求項1記載のプログラマブルコント
ローラ。
3. When the instruction executing means expands the sequence program into instructions by a compiling method and then executes the instruction to execute the contact input instruction, the save information added means saves the save information added to the contact input instruction. Refer only to the case of contact input instruction that does not need to save the operation result, expand the operation result held in the operation register to the instruction that sets the contact input information in the operation register without saving to the stack, and execute it The programmable controller according to claim 1, wherein:
【請求項4】 退避情報付加手段が、シーケンスプログ
ラムの最後から先頭にさかのぼって解析して、スタック
に退避された演算結果を参照するスタック参照命令の場
合にはカウンタの値をインクリメントする一方、接点入
力命令の場合にはさらに上記カウンタの値がその初期値
より増加しているか否かを判断して、増加している場合
には当該接点入力命令に演算結果の退避を示す退避情報
を付加すると共に上記カウンタの値をデクリメントする
一方、増加してない場合には当該接点入力命令に演算結
果の退避しないことを示す退避情報を付加する、 ことを特徴とする請求項1記載のプログラマブルコント
ローラ。
4. The save information adding means analyzes the sequence program from the end to the beginning and increments the value of the counter in the case of a stack reference instruction that refers to the operation result saved in the stack, while making a contact. In the case of an input command, it is further determined whether or not the value of the counter has increased from its initial value, and if it has increased, save information indicating save of the operation result is added to the contact input command. At the same time, while decrementing the value of the counter, save information indicating that the operation result is not saved is added to the contact input command when the value has not increased, and the programmable controller according to claim 1.
JP21274393A 1993-08-27 1993-08-27 Programmable controller Withdrawn JPH0764469A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP21274393A JPH0764469A (en) 1993-08-27 1993-08-27 Programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP21274393A JPH0764469A (en) 1993-08-27 1993-08-27 Programmable controller

Publications (1)

Publication Number Publication Date
JPH0764469A true JPH0764469A (en) 1995-03-10

Family

ID=16627696

Family Applications (1)

Application Number Title Priority Date Filing Date
JP21274393A Withdrawn JPH0764469A (en) 1993-08-27 1993-08-27 Programmable controller

Country Status (1)

Country Link
JP (1) JPH0764469A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000250779A (en) * 1999-02-25 2000-09-14 Toshiba Corp Programmable controller
JP2005115969A (en) * 2005-01-11 2005-04-28 Toshiba Corp Programmable controller

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000250779A (en) * 1999-02-25 2000-09-14 Toshiba Corp Programmable controller
JP2005115969A (en) * 2005-01-11 2005-04-28 Toshiba Corp Programmable controller

Similar Documents

Publication Publication Date Title
JP2765423B2 (en) Programmable controller and control method thereof
US4833640A (en) Register bank change including register to register transfer in a data processing system
EP3125108A1 (en) Vector processing using loops of dynamic vector length
US9436466B2 (en) Blank bit and processor instructions employing the blank bit
JPH0764469A (en) Programmable controller
US6718459B1 (en) Device and method for arithmetic processing
WO2021182222A1 (en) Computation device and computation method
JPS6010645B2 (en) Sequence control device
JPH07306783A (en) Program counting system and operating method of program counter
JPH0675957A (en) Restoration mechanism of fault during editing
JPH09223009A (en) Device and method for processing data
JPS63157204A (en) Programmable controller
JPH04342037A (en) Operand checking system for program
JP3013619B2 (en) Programmable controller
JP2793809B2 (en) Applied instruction processing method of programmable controller
JPS5829051A (en) Operation processing device
JPS60110043A (en) Information processor
JP2559924B2 (en) Programmable controller
JP2679603B2 (en) Microcomputer
JPS58149571A (en) Processing system of vector operation in information processing device
JPS6325373B2 (en)
JPS60214004A (en) Function instruction system of programmable controller
JPH09128245A (en) Compiling processing system
JPS5842487B2 (en) Program loading method
JPH1124939A (en) Program conversion method

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20001031