JPH042961B2 - - Google Patents

Info

Publication number
JPH042961B2
JPH042961B2 JP57027788A JP2778882A JPH042961B2 JP H042961 B2 JPH042961 B2 JP H042961B2 JP 57027788 A JP57027788 A JP 57027788A JP 2778882 A JP2778882 A JP 2778882A JP H042961 B2 JPH042961 B2 JP H042961B2
Authority
JP
Japan
Prior art keywords
instruction
data
accumulator
stack
user program
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.)
Expired - Lifetime
Application number
JP57027788A
Other languages
Japanese (ja)
Other versions
JPS58144913A (en
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 filed Critical
Priority to JP57027788A priority Critical patent/JPS58144913A/en
Publication of JPS58144913A publication Critical patent/JPS58144913A/en
Publication of JPH042961B2 publication Critical patent/JPH042961B2/ja
Granted legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • G05B19/056Programming the PLC
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/10Plc systems
    • G05B2219/13Plc programming
    • G05B2219/13151Correction of program using grammatical error detection

Description

【発明の詳細な説明】 この発明は、プログラマブル・コントローラに
おける機械語のユーザプログラムをそれと同等の
シーケンス制御機能を有する継電器ラダー回路図
に変換して表示装置に出力し、該出力結果に基い
てプログラマブル・コントローラにおけるシーケ
ンス制御を実現するプログラマブル・コントロー
ラにおけるユーザプログラムの回路図化出力装置
に関する。
DETAILED DESCRIPTION OF THE INVENTION This invention converts a user program in machine language in a programmable controller into a relay ladder circuit diagram having an equivalent sequence control function and outputs it to a display device. -Relates to a circuit diagram output device for a user program in a programmable controller that realizes sequence control in a controller.

従来のこの種プログラマブル・コントローラに
おけるユーザプログラムの回路図化出力装置は、
回路図への変換に先だつて機械語のユーザプログ
ラムの文法エラーをチエツクし、継電器ラダー回
路図に変換できない文法エラーを含んだ部分につ
いては、『文法エラー有り』といつた趣旨のメツ
セージ表示をするだけで、その部分の未完成ラダ
ー回路図を表示するようにはなつていなかつた。
The conventional circuit diagram output device for user programs in this type of programmable controller is
Before converting to a circuit diagram, check the machine language user program for grammatical errors, and display a message saying ``grammar error exists'' for parts that contain grammatical errors that cannot be converted to relay ladder circuit diagrams. However, the unfinished ladder schematic for that part was not displayed.

そのため、そのようなエラーメツセージを含ん
だ継電気ラダー回路図の表示からは、どのように
文法エラーを犯しているのか、およびその文法エ
ラーに対して目的とする正しいユーザプログラム
とするにはどのように修正を加えたらよいのか、
といつた点が非常に分り難いという欠点があつ
た。
Therefore, from the display of the relay electrical ladder circuit diagram that includes such an error message, it is possible to determine how the syntax error is being committed and how to correct the syntax error by correcting the intended user program. Should I make a modification to
The problem was that it was very difficult to understand.

この発明は上述した従来の問題点に鑑みなされ
たものであり、その目的は、文法エラーを含んだ
機械語のユーザプログラムを自動的にかつ合理的
に修正し、その修正したユーザプログラムを継電
気ラダー回路図の形で表示装置に出力し、しかも
修正のために追加した命令を他の命令とは区別で
きる形で表示し、これによりユーザプログラムの
どの部分がどのように誤つており、その修正にど
のような例があるか簡単に分るようにしたプログ
ラマブル・コントローラにおけるユーザプログラ
ムの回路図化出力装置を提供することにある。
This invention was made in view of the above-mentioned conventional problems, and its purpose is to automatically and rationally correct a machine language user program containing grammatical errors, and to transfer the corrected user program to a relay computer. It outputs to the display device in the form of a ladder circuit diagram, and also displays instructions added for correction in a way that can be distinguished from other instructions. An object of the present invention is to provide a circuit diagram output device for a user program in a programmable controller, which makes it easy to see what examples exist.

以下、この発明の実施例を図面に基づいて詳細
に説明する。
Hereinafter, embodiments of the present invention will be described in detail based on the drawings.

まず最初に、以下に説明する回路図化出力装置
の一実施例が対象とするプログラマブル・コント
ローラのユーザプログラムは次のような命令によ
つて構成される。
First of all, the user program of the programmable controller targeted by one embodiment of the circuit diagram output device described below is composed of the following instructions.

(1) データ読込命令…1ビツトアキユームレータ
のデータをスタツクレジスタにプツシユダウン
し、かつ指定番号の1ビツトデータをアキユー
ムレータに読込む。以下このデータ読込命令を
LD命令と称す。
(1) Data read command: Pushes down the data of the 1-bit accumulator to the stack register, and reads the 1-bit data of the specified number into the accumulator. Below is this data reading command
It is called LD command.

(2) 論理演算命令…指定番号の1ビツトデータと
アキユームレータのデータとの論理演算をし、
その結果をアキユームレータにストアする。こ
の論理演算命令の中には、論理積をとるAND
命令と、論理和をとるOR命令が含まれる。
(2) Logical operation instruction... Performs a logical operation on the 1-bit data of the specified number and the data of the accumulator,
Store the result in the accumulator. Some of these logical operation instructions include AND
It includes an instruction and an OR instruction that performs a logical sum.

(3) スタツク演算命令…スタツクレジスタをプル
アツプして得られる1ビツトデータとアキユー
ムレータのデータとの論理演算をし、その結果
をアキユームレータにストアする。このスタツ
ク演算命令の中には、論理積をとるANDLD命
令と、論理和をとるORLD命令とが含まれる。
(3) Stack operation instruction: Performs a logical operation on the 1-bit data obtained by pulling up the stack register and the data in the accumulator, and stores the result in the accumulator. These stack operation instructions include an ANDLD instruction that performs logical product, and an ORLD instruction that performs logical sum.

(4) データ出力命令…アキユームレータのデータ
を指定番号のデータエリアに転送し、かつスタ
ツクレジスタからアキユームレータにデータを
プルアツプする。以下このデータ出力命令を
OUT命令と称す。
(4) Data output command: Transfers the data of the accumulator to the data area of the specified number, and pulls up the data from the stack register to the accumulator. Below is this data output command
It is called an OUT command.

以上の各命令の組合せからなる機械語のユーザ
プログラムでもつて任意の継電器ラダー回路図と
同等のシーケンス制御機能を表現し、プログラマ
ブル・コントローラはそのユーザプログラムを高
速に繰り返し実行することにより上記シーケンス
制御を実現するものである。
A machine language user program consisting of a combination of the above instructions expresses a sequence control function equivalent to an arbitrary relay ladder circuit diagram, and the programmable controller performs the above sequence control by repeatedly executing the user program at high speed. It is something that will be realized.

この発明の回路図化出力装置は、上述の機械語
で構成されるユーザプログラムを、それと同等の
シーケンス制御機能を有する継電器ラダー回路図
に変換してCRT表示装置等に出力するものであ
る。この回路図化出力装置の電気的構成の概略を
第1図に示す。この回路図化出力装置は、マイク
ロコンピユータからなる中央処理装置1と、
RAM3と、中央処理装置1に対して各種の入力
を与えるキーボード等よりなる操作装置4と、
CRT等に継電気ラダー回路図を表示する表示装
置5とを備える。プログラマブル・コントローラ
2は上記中央処理装置1に接続される。中央処理
装置1はプログラマブル・コントローラ2から機
械語のユーザプログラムを読取つてRAM3の入
力テーブル31に格納する。この入力テーブル3
1に格納されたユーザプログラムを編集テーブル
32、LDスタツク34、ワークエリア35を使
つて文法エラーのチエツクと、その修正を行な
い、修正された機械語のユーザプログラムを出力
テーブル33に格納する。そして、出力テーブル
33に格納された修正後のユーザプログラムを継
電器ラダー回路図の回路図データに変換し、それ
を表示装置5に表示させる。そのとき、修正のた
めに加えた命令の他の命令と異なる表示形態で表
示させる。
The circuit diagram output device of the present invention converts the user program composed of the above-mentioned machine language into a relay ladder circuit diagram having an equivalent sequence control function, and outputs the converted circuit diagram to a CRT display device or the like. A schematic electrical configuration of this circuit diagram output device is shown in FIG. This circuit diagram output device includes a central processing unit 1 consisting of a microcomputer,
RAM 3, and an operating device 4 consisting of a keyboard or the like that provides various inputs to the central processing unit 1;
A display device 5 for displaying a relay electrical ladder circuit diagram on a CRT or the like is provided. A programmable controller 2 is connected to the central processing unit 1 mentioned above. The central processing unit 1 reads a machine language user program from the programmable controller 2 and stores it in the input table 31 of the RAM 3. This input table 3
The user program stored in 1 is checked for grammatical errors and corrected using an edit table 32, LD stack 34, and work area 35, and the corrected machine language user program is stored in an output table 33. Then, the modified user program stored in the output table 33 is converted into circuit diagram data of a relay ladder circuit diagram, and the data is displayed on the display device 5. At that time, the instruction added for modification is displayed in a different display form from other instructions.

第2A図〜第2D図は中央処理装置1によつて
実行される文法エラーのチエツクおよびその修正
のための処理プログラムの構成を示すフローチヤ
ートである。このフローチヤートの詳細な説明に
先だつて、本発明の文法エラーのチエツクおよび
その修正の手法について要点を説明する。
FIGS. 2A to 2D are flowcharts showing the structure of a processing program executed by the central processing unit 1 for checking for grammatical errors and correcting them. Prior to a detailed explanation of this flowchart, the main points of the method of checking and correcting grammar errors of the present invention will be explained.

上記LD命令がプログラマブル・コントローラ
2にて実行されると、ある意味のあるデータがア
キユームレータに取込まれ、アキユームレータに
あつたデータはスタツクにプツシユダウンされ
る。従つて、例えばLD命令が2回続いたとする
と、意味のあるデータはスタツクに1ビツトとア
キユームレータに1ビツトの合計2つになる。
When the above LD instruction is executed by the programmable controller 2, meaningful data is taken into the accumulator, and the data received in the accumulator is pushed down to the stack. Therefore, for example, if the LD instruction is repeated twice, there will be two meaningful data: 1 bit in the stack and 1 bit in the accumulator.

上記スタツク演算命令がプログラマブル・コン
トローラ2にて実行されると、スタツクレジスタ
の最初の1ビツトがプルアツプされ、アキユーム
レータのデータと論理演算され、その結果がアキ
ユームレータに格納される。従つて、スタツク演
算命令によつてスタツクレジスタに格納されてい
た意味のあるデータが1ビツタ減少することにな
る。
When the above stack operation instruction is executed by the programmable controller 2, the first bit of the stack register is pulled up, a logical operation is performed on the data in the accumulator, and the result is stored in the accumulator. Therefore, the meaningful data stored in the stack register by the stack operation instruction is reduced by one bit.

上記OUT命令がプログラマブル・コントロー
ラ2にて実行されると、アキユームレータのデー
タが他のエリアに転送され、スタツクレジスタか
らアキユームレータにデータがプルアツプされ
る。従つて、OUT命令によりアキユームレータ
に格納されていた意味のあるデータが1つ減少し
たことになる。
When the above-mentioned OUT instruction is executed by the programmable controller 2, the data in the accumulator is transferred to another area, and the data is pulled up from the stack register to the accumulator. Therefore, the meaningful data stored in the accumulator is decreased by one due to the OUT instruction.

上記論理演算命令がプログラマブル・コントロ
ーラ2で実行されると、アキユームレータのデー
タと他のエリアからのデータとの論理演算が取ら
れ、その結果がアキユームレータに格納される。
従つて、論理演算命令ではアキユームレータの意
味のあるデータの数は増加も減少もしない。
When the above logical operation instruction is executed by the programmable controller 2, a logical operation is performed on the data in the accumulator and data from another area, and the result is stored in the accumulator.
Therefore, logical operation instructions neither increase nor decrease the number of meaningful data in the accumulator.

以上の如く、LD命令によつて増加するととも
にスタツク演算命令およびOUT命令によつて減
少する上記アキユームレータおよびスタツクに格
納される意味あるデータのことを、以下の説明で
は有意データと称する。
As mentioned above, the meaningful data stored in the accumulator and stack, which is increased by the LD instruction and decreased by the stack operation instruction and the OUT instruction, will be referred to as significant data in the following explanation.

上記論理演算命令を実行するには、アキユーム
レータに有意データがなければならない。つま
り、論理演算命令は有意データを少なくとも1つ
必要とする。
To execute the above logic operation instruction, there must be significant data in the accumulator. In other words, a logical operation instruction requires at least one piece of significant data.

上記スタツク演算命令を実行するには、スタツ
クとアキユームレータにそれぞれ有意データがな
ければならない。つまり、スタツク演算命令は有
意データを少なくとも2ビツト必要とする。
In order to execute the above stack operation instruction, the stack and the accumulator must each have significant data. That is, a stack operation instruction requires at least 2 bits of significant data.

上記OUT命令を実行するには、アキユームレ
ータに有意データが格納されていなければならな
い。つまり、OUT命令は有意データを少なくと
も1ビツト必要とする。
To execute the above OUT instruction, significant data must be stored in the accumulator. In other words, the OUT instruction requires at least one bit of significant data.

この実施例においては、機械語のユーザプログ
ラムについて以下に説明する状態を生ずるとき、
これを文法エラーであると規定する。
In this embodiment, when the following conditions occur in a machine language user program,
This is defined as a syntax error.

(a)…論理演算命令が実行に供されるときに有意デ
ータの数が0になつている場合 (b)…OUT命令が実行に供されるときに有意デー
タの数が0になつている場合 (c)…スタツク演算命令が実行に供されるときに有
意データの数が2に充たない場合 (d)…OUT命令を実行した結果有意データの数が
0にならない場合 (e)…プログラムの最後の命令がOUT命令でない
場合 この発明の装置では、機械語のユーザプログラ
ムを先頭から順番にチエツクし、上述の(a)〜(e)の
文法エラーが検出されると、以下に説明するよう
にして、LD命令またはOUT命令を適宜に追加す
ることによつてそのエラーを修正する。
(a)...The number of significant data is 0 when the logical operation instruction is executed (b)...The number of significant data is 0 when the OUT instruction is executed Case (c)...If the number of significant data is less than 2 when the stack operation instruction is executed (d)...If the number of significant data does not become 0 as a result of executing the OUT instruction (e)... When the last instruction of the program is not an OUT instruction In the device of this invention, the user program in machine language is checked in order from the beginning, and if any of the syntax errors (a) to (e) above are detected, Correct the error by adding an LD or OUT instruction as appropriate.

(A)…上記(a)の文法エラーが検出されたとき、その
論理演算命令の直前にLD命令を挿入する。
(A)...When the syntax error in (a) above is detected, insert an LD instruction immediately before the logical operation instruction.

(B)…上記(b)の文法エラーが検出されたとき、その
OUT命令の直前にLD命令を挿入する。
(B)...When the grammar error in (b) above is detected,
Insert the LD instruction just before the OUT instruction.

(C)…上記(c)の文法エラーが検出されたとき、その
スタツク演算命令の直前にLD命令を1または
2命令挿入する。
(C)...When the syntax error in (c) above is detected, insert one or two LD instructions immediately before the stack operation instruction.

(A)…上記(d)の文法エラーが検出されたとき、その
OUT命令の前段のLD命令の直前にOUT命令
を挿入する。1つのOUT命令の追加だけでは
まだ有意データが0にならない場合、更に前段
のLD命令の直前にOUT命令を挿入する。
(A)...When the grammar error in (d) above is detected,
Insert the OUT instruction immediately before the LD instruction before the OUT instruction. If the significant data does not become 0 even after adding one OUT instruction, an OUT instruction is further inserted immediately before the previous LD instruction.

(E)…上記(e)の文法エラーが検出されたとき、プロ
グラムの最後にOUT命令を追加し、その追加
によつて有意データの数が0にならない場合
は、上記(D)と同じ処理によつて更にOUT命令
を追加する。
(E)...When the syntax error in (e) above is detected, add an OUT instruction to the end of the program, and if the addition does not reduce the number of significant data to 0, perform the same process as in (D) above. Add more OUT instructions by

この実施例においては、上述したように機械語
のユーザプログラムの文法エラーを定義し、かつ
検出された文法エラーに対して上述したように規
定されたエラーの修正を行なうものである。
In this embodiment, a grammatical error in a machine language user program is defined as described above, and the detected grammatical error is corrected as defined above.

次に、上記文法エラーとその修正について1例
をあげる。第3A図は文法エラーを含んだ機械語
のユーザプログラムの一例であり、第3B図はそ
の文法エラーを修正した機械語のユーザプログラ
ムである。なお以下の説明では、文法エラーの修
正のために挿入したLD命令またはOUT命令をダ
ミーのLD命令またはダミーのOUT命令と称し、
これらダミーの命令についてはそのオペランドの
エリアにXと記している。
Next, I will give an example of the above grammar error and its correction. FIG. 3A is an example of a machine language user program containing a grammatical error, and FIG. 3B is a machine language user program in which the grammatical error has been corrected. In the following explanation, the LD instruction or OUT instruction inserted to correct a syntax error will be referred to as a dummy LD instruction or a dummy OUT instruction.
For these dummy instructions, an X is written in the operand area.

第3A図のプログラム例において、アドレス1
およびアドレス2の2つのLD命令により有意デ
ータの数は2となり、アドレス3のOUT命令に
より有意データの数が1つ減るが、それでもまだ
1つの有意データが残る。つまりアドレス3の
OUT命令をチエツクした時点で上記(d)の文法エ
ラーが検出される。これを修正するために上記(D)
の処理がなされると、第3B図示されるように、
「LD26」命令の直前にダミーのOUT命令
「OUT・X」が挿入される。これにより、
「OUT27」命令の実行によつて有意データの数が
0となるように修正される。
In the example program in Figure 3A, address 1
The two LD instructions at address 2 reduce the number of significant data to 2, and the OUT instruction at address 3 reduces the number of significant data by one, but one significant data still remains. In other words, address 3
The syntax error (d) above is detected when the OUT instruction is checked. (D) above to fix this
When the processing is done, as shown in Figure 3B,
A dummy OUT instruction “OUT・X” is inserted immediately before the “LD26” instruction. This results in
By executing the "OUT27" instruction, the number of significant data is corrected to zero.

また第3A図において、アドレス4の
「AND28」命令の実行には有意データを1つ必要
とするが、その有意データは既になく、従つて上
記(a)の文法エラーが検出される。この文法エラー
は上記(A)の処理によつて修正される。つまり第3
B図に示すように「AND28」命令の直前にダミ
ーのLD命令「LD・X」命令が挿入される。これ
により有意データの数は1となる。
Further, in FIG. 3A, one significant data is required to execute the "AND28" instruction at address 4, but that significant data is already absent, so the syntax error (a) above is detected. This syntax error is corrected by processing (A) above. In other words, the third
As shown in Figure B, a dummy LD command "LD.X" is inserted immediately before the "AND28" command. As a result, the number of significant data becomes 1.

また第3A図におけるアドレス5の「ORLD」
命令を実行するには、有意データを2つ必要とす
る。しかしこのとき有意データの数は1つであつ
て、従つて上記(c)文法エラーが検出される。この
文法エラーは上記(C)の処理によつて修正される。
つまり第3B図に示すように、「ORLD」命令の
直前にダミーのLD命令「LD・X」命令が挿入さ
れる。またこの修正を加えることにより、
「ORLD」命令の実行後に有意データは1となる。
Also, "ORLD" at address 5 in Figure 3A.
To execute an instruction, two pieces of significant data are required. However, at this time, the number of significant data is one, so the above-mentioned (c) grammatical error is detected. This syntax error is corrected by the processing in (C) above.
That is, as shown in FIG. 3B, a dummy LD instruction "LD.X" is inserted immediately before the "ORLD" instruction. Also, by adding this modification,
Significant data becomes 1 after execution of the "ORLD" instruction.

また第3A図に示すように、このプログラムの
最後がOUT命令で終わつていないため、上記(e)
の文法エラーが検出される。この文法エラーは上
記(E)の処理によつて修正される。つまり第3B図
に示すように、プログラムの最後にダミーの
OUT命令「OUT・X」命令が追加される。この
修正により最後のOUT命令の実行後に有意デー
タの数は0となるので、これ以上のOUT命令の
追加はない。
Also, as shown in Figure 3A, the last of this program does not end with the OUT instruction, so the above (e)
syntax errors are detected. This syntax error is corrected by processing (E) above. In other words, as shown in Figure 3B, at the end of the program, a dummy
OUT command "OUT・X" command is added. With this modification, the number of significant data becomes 0 after the last OUT instruction is executed, so no more OUT instructions are added.

そして、第3B図に示すように修正された機械
語のユーザプログラムは、周知の逆アセンブル処
理によつてそのプログラムと同等のシーケンス制
御機能を有する継電器ラダー回路図に変換され、
上記表示装置5の表示画面に表示される。その継
電器ラダー回路図を第3C図に示している。この
第3C図の回路図において、Xと付記しているの
はダミーのLD命令またはOUT命令に対応する回
路素子である。このように文法エラー修正のため
に追加したダミーのLD命令またはOUT命令は他
の命令と区別ができるような形で表示する。
Then, as shown in FIG. 3B, the modified user program in machine language is converted into a relay ladder circuit diagram having the same sequence control function as that program by a well-known disassembly process.
It is displayed on the display screen of the display device 5. The relay ladder circuit diagram is shown in FIG. 3C. In the circuit diagram of FIG. 3C, those marked with X are circuit elements corresponding to the dummy LD instruction or OUT instruction. In this way, the dummy LD or OUT instructions added to correct syntax errors are displayed in a way that they can be distinguished from other instructions.

このように、第3A図のような文法エラーを含
んだユーザプログラムは周知の逆アセンブル処理
では継電気ラダー回路図の形に変換できないが、
第3B図のように文法エラーを修正した後は周知
の逆アセンブル処理によつて第3C図のような継
電器ラダー回路図として表示することができる。
これによりユーザは、単に「文法エラー有り」と
だけ知らされるよりも、第3C図のようなラダー
回路図の形で表示された方が、文法エラーの認知
とその修正のための手助けとなつて非常に便利な
訳である。
In this way, a user program containing a grammatical error like the one shown in Figure 3A cannot be converted into a relay electrical ladder circuit diagram using well-known disassembly processing.
After correcting grammatical errors as shown in FIG. 3B, it can be displayed as a relay ladder circuit diagram as shown in FIG. 3C by a well-known disassembly process.
As a result, users are better able to recognize and correct grammatical errors if they are displayed in the form of a ladder circuit diagram as shown in Figure 3C, rather than simply being informed that there is a ``grammatical error.'' This is a very convenient translation.

次に、上述した各処理を行なうためのシステム
プログラムを示す第2A図〜第2B図のフローチ
ヤートにおける各ステツプの処理内容を説明す
る。
Next, the processing contents of each step in the flowchart of FIGS. 2A to 2B showing a system program for performing each of the above-mentioned processes will be explained.

第2A図は上記システムプログラムの全体の概
略を示すフローチヤートであり、第2B図は第2
A図のステツプ110のダミーのLD命令作成ルーチ
ンの詳細を示すフローチヤート、第2C図は第2
A図におけるステツプ115と107に示すダミーの
OUT命令作成ルーチンの詳細なフローチヤート、
第2D図は第2A図のステツプ108に示す修正プ
ログラム編集ルーチンの詳細なフローチヤートで
ある。
FIG. 2A is a flowchart showing the overall outline of the above system program, and FIG. 2B is a flowchart showing the overall outline of the system program.
A flowchart showing the details of the dummy LD instruction creation routine at step 110 in Figure A, and Figure 2C is the second step.
The dummy shown in steps 115 and 107 in Figure A
Detailed flowchart of the OUT instruction creation routine,
FIG. 2D is a detailed flowchart of the modification program editing routine shown in step 108 of FIG. 2A.

ステツプ100…上記入力テーブル31に転送さ
れた機械語のユーザプログラムをアドレツシング
するためのプログラムカウンタPCをクリアし、
ユーザプログラムの先頭の命令を定する。
Step 100...Clears the program counter PC for addressing the machine language user program transferred to the input table 31,
Define the first instruction of the user program.

ステツプ101…プログラムカウンタPCで指定さ
れる命令を入力テーブル31から読出し編集テー
ブル32にストアする。以下、このステツプ101
で読出した命令を本命令と称す。
Step 101: The command specified by the program counter PC is read from the input table 31 and stored in the editing table 32. Below is this step 101
The command read in is called the main command.

ステツプ102…本命令がLD命令か否かを判断す
る。
Step 102: Determine whether or not this command is an LD command.

ステツプ111…本命令が論理演算命令か否かを
判断する。
Step 111: Determine whether this instruction is a logical operation instruction.

ステツプ114、205…本命令がスタツク演算命令
か否かを判断する。
Steps 114 and 205: Determine whether or not this instruction is a stack operation instruction.

ステツプ103、201、207…本命令を含む1レコ
ードをLDスタツク34にプツシユする。
Steps 103, 201, 207...Push one record including this command to the LD stack 34.

ステツプ113、303…LDスタツク34から1レ
コードをプルする。
Steps 113, 303...Pull one record from the LD stack 34.

ステツプ104、203、209…LDスタツク34の最
新レコードのOUT命令追加ポインタに、そのレ
コードに含まれる命令の編集テーブル32におけ
る格納アドレスをポインタとしてセツトする。
Steps 104, 203, 209...The OUT instruction addition pointer of the latest record of the LD stack 34 is set to the storage address in the edit table 32 of the instruction included in that record.

ステツプ202、208…LDスタツク34の最新レ
コードのLD命令追加ポインタに、そのレコード
に含まれる命令の編集テーブル32における格納
アドレスをポインタとしてセツトする。
Steps 202, 208...The LD instruction addition pointer of the latest record of the LD stack 34 is set to the storage address in the edit table 32 of the instruction included in that record.

ステツプ112…LDスタツク34の最新レコード
のOUT命令追加ポインタを、そのレコードに含
まれる命令に続く命令(ユーザプログラム上)の
編集テーブル32における格納アドレスに更新す
る。
Step 112: The OUT instruction addition pointer of the latest record in the LD stack 34 is updated to the storage address in the edit table 32 of the instruction (on the user program) following the instruction included in that record.

ステツプ105…プログラムカウンタPCを+1す
る。
Step 105...Increment the program counter PC by 1.

ステツプ106…プログラムカウンタPCで指定さ
れる入力テーブル31のデータがユーザプログラ
ムの最終命令以降のものであるか否か、すなわち
ユーザプログラムの最後まで処理したか否かを判
断する。
Step 106: It is determined whether the data in the input table 31 specified by the program counter PC is after the last instruction of the user program, that is, whether the user program has been processed to the end.

ステツプ200、301…LDスタツク34が空か否
かを判断する。
Steps 200 and 301... It is determined whether the LD stack 34 is empty.

ステツプ206…LDスタツク34に1レコー
ドのみストアされているか否かを判断する。
Step 206: Determine whether only one record is stored in the LD stack 34.

ステツプ204、210…LDスタツク34の最新レ
コードのLD命令追加ポインタで指定される編集
テーブル32の命令に付加されているLD命令追
加カウンタを+1する。
Steps 204, 210...The LD instruction addition counter added to the instruction in the edit table 32 specified by the LD instruction addition pointer of the latest record of the LD stack 34 is incremented by 1.

ステツプ302…LDスタツク34の最新レコード
のOUT命令追加ポインタで指定される編集テー
ブル32の命令に付加されているOUT命令追加
カウンタを+1する。
Step 302: The OUT instruction addition counter added to the instruction in the edit table 32 specified by the OUT instruction addition pointer of the latest record of the LD stack 34 is incremented by 1.

ステツプ400…編集テーブル32の最初のレコ
ードを指定し、これを読取る。この指定されたレ
コードを以下の説明では本レコードと称す。
Step 400: Specify the first record of the edit table 32 and read it. This designated record will be referred to as the main record in the following explanation.

ステツプ401…本レコードのLD命令追加カウン
タが0か否かを判断する。
Step 401: Determine whether the LD instruction addition counter of this record is 0 or not.

ステツプ402…ダミーのLD命令を出力テーブル
33にセツトする。
Step 402: A dummy LD instruction is set in the output table 33.

ステツプ403…本レコードのLD命令追加カウン
タを−1する。
Step 403...The LD instruction addition counter of this record is decremented by 1.

ステツプ404…本レコードの命令を出力テーブ
ル33にセツトする ステツプ405…本レコードのOUT命令追加カウ
ンタが0か否かを判断する ステツプ406…ダミーのOUT命令を出力テーブ
ル33にセツトする。
Step 404: Set the command of this record in the output table 33. Step 405: Determine whether the OUT command addition counter of this record is 0. Step 406: Set a dummy OUT command in the output table 33.

ステツプ407…本レコードのOUT命令追加カウ
ンタを−1する。
Step 407...The OUT instruction addition counter of this record is decremented by 1.

ステツプ408…編集テーブル32の次のレコー
ドを指定する。
Step 408: Specify the next record in the edit table 32.

ステツプ409…編集テーブル32の全てのレコ
ードを読取つたか否かを判断する。
Step 409: Determine whether all records in the edit table 32 have been read.

ステツプ109…出力テーブル33に格納された
修正後のユーザプログラムを継電器ラダー回路図
の表示データに変換し、かつその回路図を表示装
置5に表示する。そのとき、ダミーのLD命令と
ダミーのOUT命令は他の命令と区別がつくよう
にして表示する。
Step 109: Convert the modified user program stored in the output table 33 into display data of a relay ladder circuit diagram, and display the circuit diagram on the display device 5. At this time, the dummy LD instruction and the dummy OUT instruction are displayed so that they can be distinguished from other instructions.

以上本発明の一実施例について詳細に説明した
が、この発明は上記実施例に限定されるものでは
なく、対象となるプログラマブル・コントローラ
のアーキテクチヤや命令体系、およびユーザプロ
グラムの文法エラーの定義の仕方に応じて、文法
エラーの検出方式や文法エラーの修正方式は様々
に実施することができるものである。また、修正
のために追加したダミーのLD命令やOUT命令の
表示を他の命令と異ならせる方式も、様々に実施
することができるものである。
Although one embodiment of the present invention has been described above in detail, the present invention is not limited to the above embodiment, and the present invention is not limited to the above embodiment. Depending on the method, various grammatical error detection methods and grammatical error correction methods can be implemented. Furthermore, various methods can be used to display the dummy LD command and OUT command added for correction differently from other commands.

以上の如く、この発明に係るプログラマブル・
コントローラにおけるユーザプログラムの回路図
化出力装置によれば、機械語のユーザプログラム
に文法エラーが含まれている場合、その文法エラ
ーがある規則に従つて自動的に修正され、その修
正されたユーザプログラムが継電器ラダー回路図
の形で表示器に表示され、かつ修正のために加え
たデータ読込命令およびデータ出力命令が他の命
令と区別できる形で表示されるため、プログラム
のエラーに対する認知は容易であるとともに、そ
の修正のための指針が示されることになるので、
修正を行なうのに便利である。
As described above, the programmable computer according to the present invention
According to the user program circuit diagram output device in the controller, if a machine language user program contains a grammatical error, the grammatical error is automatically corrected according to a certain rule, and the corrected user program is is displayed on the display in the form of a relay ladder circuit diagram, and data read commands and data output commands added for correction are displayed in a form that can be distinguished from other commands, making it easy to recognize program errors. As well as providing guidelines for correction,
Useful for making corrections.

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

第1図はこの発明に係る回路図化出力装置の概
略ブロツク図、第2図は機械語のユーザプログラ
ムの文法エラーのチエツク、文法エラーの修正、
継電器ラダー回路図データへの変換および表示を
行なうためのシステムプログラムのフローチヤー
ト、第3A図は文法エラーを含んだ機械語のユー
ザプログラムの一例を示す図、第3B図は第3A
図のプログラムに修正が加えられた後のプログラ
ムを示す図、第3C図は第3B図の修正後のプロ
グラムから変換された継電器ラダー回路図を示す
図である。 1……中央処理装置、2……プログラマブル・
コントローラ、3……RAM、4……操作装置、
5……表示装置。
FIG. 1 is a schematic block diagram of a circuit diagram output device according to the present invention, and FIG. 2 shows a system for checking and correcting grammatical errors in a machine language user program.
A flowchart of a system program for converting and displaying relay ladder circuit diagram data, FIG. 3A is a diagram showing an example of a user program in machine language containing a grammatical error, and FIG. 3B is a flowchart of a system program for converting and displaying relay ladder circuit diagram data.
FIG. 3C is a diagram showing a program after modifications have been made to the program shown in the figure, and FIG. 3C is a diagram showing a relay ladder circuit diagram converted from the modified program in FIG. 3B. 1...Central processing unit, 2...Programmable
Controller, 3... RAM, 4... Operating device,
5...Display device.

Claims (1)

【特許請求の範囲】 1 機械語のユーザプログラムをそれと同等のシ
ーケンス制御機能を有する継電気ラダー回路図に
変換して表示装置に出力するプログラマブル・コ
ントローラにおけるユーザプログラムの回路図化
出力装置において、 1ビツトアキユームレータのデータをスタツク
レジスタにプツシユダウンし、かつ指定番号の1
ビツトデータをアキユームレータに読込むLD命
令と、 指定番号の1ビツトデータとアキユームレータ
のデータとの論理演算をし、その結果をアキユー
ムレータにストアする論理演算命令と、 スタツクレジスタをプルアツプして得られる1
ビツトデータとアキユームレータのデータとの論
理演算をし、その結果をアキユームレータにスト
アするスタツク演算命令と、 アキユームレータのデータを指定番号のデータ
エリアに転送し、かつスタツクレジスタからアキ
ユームレータにデータをプルアツプするOUT命
令と、 から構成される機械語のユーザプログラムをその
先頭から順番にチエツクし、 LD命令で増加するとともに、OUT命令および
スタツク演算命令によつて減少する上記アキユー
ムレータおよびスタツクに格納される有意データ
の数を順次求める計数手段と、 論理演算命令が実行に供されるとき、前記計数
手段の計数値が0になつている場合、その論理演
算命令の直前にLD命令を挿入する手段と、 OUT命令が実行に供されるとき、前記計数手
段の計数値が0になつている場合、そのOUT命
令の直前にLD命令を挿入する手段と、 スタツク演算命令が実行に供されるとき、前記
計数手段の計数値が2に満たない場合、そのスタ
ツク演算命令の直前にLD命令を1または2命令
挿入する手段と、 OUT命令を実行した結果、前記計数手段の計
数値が0にならない場合、そのOUT命令の直前
のLD命令の前にOUT命令を挿入し、1つの
OUT命令の追加だけではまだ前記計数手段の計
数値が0にならない場合、さらにその前のLD命
令の直前にOUT命令を挿入する手段と、 プログラムの最後の命令がOUT命令でない場
合、プログラムの最後にOUT命令を追加し、そ
の追加によつて前記計数手段の計数値が0になら
ない場合、さらにOUT命令を追加する手段と、 を有し、 前記挿入手段および追加手段によつて挿入、追
加された命令をその他の命令と区別できる表示形
態で表示装置に出力することを特徴とするプログ
ラマブル・コントローラにおけるユーザプログラ
ムの回路図化出力装置。
[Scope of Claims] 1. In a circuit diagram output device for a user program in a programmable controller that converts a user program in machine language into a relay electrical ladder circuit diagram having an equivalent sequence control function and outputs it to a display device, 1 Push down the bit accumulator data to the stack register and
An LD instruction that reads bit data into the accumulator, a logical operation instruction that performs a logical operation on 1-bit data of a specified number and the data in the accumulator, and stores the result in the accumulator, and a stack register. 1 obtained by pulling up
A stack operation instruction that performs a logical operation on bit data and data in the accumulator and stores the result in the accumulator, and a stack operation instruction that transfers the data in the accumulator to a data area with a specified number and stores the result from the stack register. Checks the machine language user program consisting of the OUT instruction that pulls up data to the umulator, and sequentially checks the machine language user program consisting of counting means for sequentially calculating the number of significant data stored in a mulrator and a stack; and, when a logical operation instruction is executed, if the count value of the counting means is 0, immediately before the logical operation instruction; means for inserting an LD instruction; means for inserting an LD instruction immediately before the OUT instruction if the count value of the counting means is 0 when the OUT instruction is executed; means for inserting one or two LD instructions immediately before the stack calculation instruction when the count value of the counting means is less than 2 when the count value of the counting means is executed; If the count value does not become 0, insert an OUT instruction before the LD instruction immediately before that OUT instruction, and
If the count value of the counting means does not become 0 just by adding the OUT instruction, there is also a means to insert the OUT instruction immediately before the previous LD instruction, and if the last instruction of the program is not the OUT instruction, the last instruction of the program and means for adding an OUT instruction if the count value of the counting means does not become 0 due to the addition, 1. A circuit diagram output device for a user program in a programmable controller, characterized in that the output device outputs a user program into a circuit diagram in a programmable controller, the output device outputting the command to a display device in a display format that allows the command to be distinguished from other commands.
JP57027788A 1982-02-23 1982-02-23 Circuit diagram producing and output device for user program of programmable controller Granted JPS58144913A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP57027788A JPS58144913A (en) 1982-02-23 1982-02-23 Circuit diagram producing and output device for user program of programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP57027788A JPS58144913A (en) 1982-02-23 1982-02-23 Circuit diagram producing and output device for user program of programmable controller

Publications (2)

Publication Number Publication Date
JPS58144913A JPS58144913A (en) 1983-08-29
JPH042961B2 true JPH042961B2 (en) 1992-01-21

Family

ID=12230708

Family Applications (1)

Application Number Title Priority Date Filing Date
JP57027788A Granted JPS58144913A (en) 1982-02-23 1982-02-23 Circuit diagram producing and output device for user program of programmable controller

Country Status (1)

Country Link
JP (1) JPS58144913A (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62254205A (en) * 1986-04-28 1987-11-06 Mitsubishi Electric Corp Debug device
JPH0353303A (en) * 1989-07-21 1991-03-07 Fuji Electric Co Ltd Program input device for programmable controller
US5058052A (en) * 1989-10-16 1991-10-15 Ge Fanuc Automation North America, Inc. Method for checking the syntax of an instruction list program to determine if the program is expressible as a relay ladder diagram by a programmable logic controller
DE10035896A1 (en) * 2000-07-21 2002-01-31 Siemens Ag Data processing system and a method for entering data into the data processing system

Also Published As

Publication number Publication date
JPS58144913A (en) 1983-08-29

Similar Documents

Publication Publication Date Title
US4455619A (en) Interactive equipment for computer programming by linkage of labeled block representations of arithmetic/logical subprograms
JPS6195458A (en) Testing method of graphic program
JPH02109127A (en) Specification processing method
JPH042961B2 (en)
JPS6214853B2 (en)
JPH07120285B2 (en) How to use the syntax checker and text editor
JP2604066B2 (en) Text file correction storage method
JP3034527B2 (en) Editor device
JPS5969831A (en) Device for documentation
JP2940394B2 (en) Source program modification device
JPH02165341A (en) Error detection processing system for input data
JPH03286226A (en) Method and system for generating program
JP3305858B2 (en) Automatic figure creation device and automatic figure creation method
JPH05307475A (en) Process control processing method
JP3270777B2 (en) Editor for logic diagram program
JPH04248624A (en) Program conversion processor
JPH05257658A (en) Automatic data generation system
JPH0685169B2 (en) Document processing method
JPS62203245A (en) Error message output system
JPH01298439A (en) List analyzing device
JPH04245335A (en) Knowledge expressing system
JPH0534707B2 (en)
JPH02244332A (en) Assembler object editing output system
JPH05233553A (en) Data editing system
JPH1063746A (en) Automatic table date generator