JP5800135B2 - Programmable controller - Google Patents

Programmable controller Download PDF

Info

Publication number
JP5800135B2
JP5800135B2 JP2011156328A JP2011156328A JP5800135B2 JP 5800135 B2 JP5800135 B2 JP 5800135B2 JP 2011156328 A JP2011156328 A JP 2011156328A JP 2011156328 A JP2011156328 A JP 2011156328A JP 5800135 B2 JP5800135 B2 JP 5800135B2
Authority
JP
Japan
Prior art keywords
machine language
language object
optimized machine
programmable controller
instruction
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.)
Active
Application number
JP2011156328A
Other languages
Japanese (ja)
Other versions
JP2013025347A (en
Inventor
吉原 大助
大助 吉原
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.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Co Ltd
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 Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Priority to JP2011156328A priority Critical patent/JP5800135B2/en
Publication of JP2013025347A publication Critical patent/JP2013025347A/en
Application granted granted Critical
Publication of JP5800135B2 publication Critical patent/JP5800135B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Programmable Controllers (AREA)

Description

本発明は、最適化された機械語オブジェクトを実行するプログラマブルコントローラに関する。   The present invention relates to a programmable controller that executes an optimized machine language object.

プログラムを高速に処理するため、プログラムのコンパイル時に最適化を行なう方法が提案されている。しかし、最適化された機械語オブジェクト(以降、最適化機械語オブジェクトと称す)はプログラムの実行順序の変更や不用変数の削除等が行われた可能性があるため、ソースコード上でデバックすることが困難になる。   In order to process a program at high speed, a method of performing optimization at the time of program compilation has been proposed. However, since the optimized machine language object (hereinafter referred to as the optimized machine language object) may have been changed in the program execution order or deleted unnecessary variables, it should be debugged on the source code. Becomes difficult.

そこで、従来、最適化機械語オブジェクトを入力し、この最適化機械語オブジェクトを逆コンパイルしてソースコードでデバッグするためのデバッグ用ソースコードを生成し、このデバッグ用ソースコードとシンボル情報などを用いてソースコード上でデバッグするようにしたソースコードレベルデバッグ装置が提案されている(例えば、特許文献1参照)。   Therefore, conventionally, an optimized machine language object is input, a source code for debugging is generated to decompile the optimized machine language object and debugged with the source code, and the debugging source code and symbol information are used. There has been proposed a source code level debugging apparatus that debugs on source code (see, for example, Patent Document 1).

特開平6−242942号公報JP-A-6-242942

しかしながら、上記特許文献1に記載の従来例にあっては、デバッグの際、最適化機械語オブジェクトをその都度逆コンパイルしてデバッグ用のソースコードを生成する必要があり、このため作業が煩雑になり、デバッグの効率がよくないという問題がある。   However, in the conventional example described in Patent Document 1, it is necessary to decompile the optimized machine language object each time for debugging and generate a source code for debugging, which makes the work complicated. Therefore, there is a problem that debugging efficiency is not good.

本発明は、上記のような問題に着目して考案されたものであり、デバッグ時にソースコード上でデバッグできるとともに、デバッグプロセスを簡単に実装することが可能なプログラマブルコントローラを提供することにある。   The present invention has been devised by paying attention to the above problems, and it is an object of the present invention to provide a programmable controller that can be debugged on a source code during debugging and can easily implement a debugging process.

また、本発明は最適化機械語オブジェクトを実行することによりプログラム実行速度の高速化を図るプログラマブルコントローラにおいて、そのプログラム実行速度を維持し実運用状態でデバッグすることが可能なプログラマブルコントローラを提供することにある。   In addition, the present invention provides a programmable controller capable of increasing the program execution speed by executing an optimized machine language object, and maintaining the program execution speed and enabling debugging in an actual operation state. It is in.

上記のような課題を解決する方法として、本発明は以下のように構成される。
請求項1に係る発明は、最適化機械語オブジェクトを保持する第一の記憶領域と、最適化機械語オブジェクトの先頭アドレスが登録されるテーブルと、テーブルに登録された先頭アドレスを指定して最適化機械語オブジェクトを実行するプログラム実行部と、このプログラム実行部をサイクリックに呼び出し最適化機械語オブジェクトを実行するプログラム実行管理部と、トレース指示に基づき、プログラム実行管理部のプログラム実行部の呼び出し後にトレース処理に切り替えるデバッグ制御部と、トレース処理の実行結果を出力するトレース結果出力部と、最適化機械語オブジェクトに対応した非最適化機械語オブジェクトを保持する第二の記憶領域と、を備え、デバッグ制御部は、オブジェクトの実行の停止位置を含むブレーク指示が与えられると停止位置に基づき非最適化機械語オブジェクトにブレーク命令を挿入するとともに非最適化機械語オブジェクトの先頭アドレスをテーブルに登録するブレーク実行手段をさらに備え、プログラム実行部は、ブレーク実行手段によって登録された非最適化機械語オブジェクトの先頭アドレスを指定して非最適化機械語オブジェクトを実行し、該非最適化機械語オブジェクトに挿入されたブレーク命令の実行に伴い、非最適化機械語オブジェクトの実行を停止し、この停止情報を出力することを特徴とする。
As a method for solving the above problems, the present invention is configured as follows.
According to the first aspect of the present invention, the first storage area for holding the optimized machine language object, the table in which the start address of the optimized machine language object is registered, and the start address registered in the table are designated and optimized. A program execution unit that executes the machine language object, a program execution management unit that cyclically calls the program execution unit and executes the optimization machine language object, and a call of the program execution unit of the program execution management unit based on the trace instruction A debug control unit that switches to trace processing later, a trace result output unit that outputs the execution result of the trace processing, and a second storage area that holds a non-optimized machine language object corresponding to the optimized machine language object , The debug control unit receives a break instruction including the execution stop position of the object. And a break execution means for inserting a break instruction into the non-optimized machine language object based on the stop position and registering the start address of the non-optimized machine language object in a table. A non-optimized machine language object is executed by specifying the start address of the registered non-optimized machine language object, and the execution of the break instruction inserted in the non-optimized machine language object causes Execution is stopped and this stop information is output.

請求項2に係る発明は、請求項1記載のプログラマブルコントローラにおいて、デバッグ制御部は、トレース指示に基づきプログラム実行管理部の最適化機械語オブジェクトの呼出し命令を抽出し、該抽出された呼び出し命令の後にトレース処理を呼び出すトレース命令を挿入し、プログラム実行管理部にトレース命令を実行させることによりトレース処理に切り替えるように構成される。   According to a second aspect of the present invention, in the programmable controller according to the first aspect, the debug control unit extracts a call instruction of the optimized machine language object of the program execution management unit based on the trace instruction, and the extracted call instruction It is configured to switch to the trace process by inserting a trace instruction for calling the trace process later and causing the program execution management unit to execute the trace instruction.

請求項に係る発明は、請求項1または請求項2記載のプログラマブルコントローラにおいて、ブレーク指示はプログラマブルコントローラと通信部を介して接続される支援装置から与えられ、デバッグ制御部は非最適化機械語オブジェクトへのブレーク命令の挿入に先立ち、非最適化機械語オブジェクトがプログラマブルコントローラに既に登録されているかを示す有無情報を支援装置に送信し、この送信の後に支援装置から非最適化機械語オブジェクトを受信することにより該受信した非最適化機械語オブジェクトを第二の記憶領域に転送するように構成される。 According to a third aspect of the present invention, in the programmable controller according to the first or second aspect , the break instruction is given from a support device connected to the programmable controller via the communication unit, and the debug control unit is a non-optimized machine language. Prior to the insertion of the break instruction into the object, the presence / absence information indicating whether or not the non-optimized machine language object is already registered in the programmable controller is transmitted to the support device, and after this transmission, the non-optimized machine language object is transmitted from the support device. Upon reception, the received non-optimized machine language object is configured to be transferred to the second storage area.

請求項に係る発明は、請求項記載のプログラマブルコントローラにおいて、支援装置は所定のソースコードをコンパイルするコンパイル手段を有し、該コンパイル手段はブレーク指示を含むデバッグ開始指示を受けると、有無情報の返信を要求するコマンドをプログラマブルコントローラに送信し、この送信に対する有無情報を含む応答をプログラマブルコントローラから受信し、この受信された有無情報を参照して非最適化機械語オブジェクトがプログラマブルコントローラに既に登録されていることを確認し、この確認の結果、非最適化機械語オブジェクトがプログラマブルコントローラに既に登録されているこ
とが確認されるとソースコードをコンパイルせず非最適化機械語オブジェクトを未生成とし、有無情報を参照した結果、非最適化機械語オブジェクトがプログラマブルコントローラに登録されてないことが確認されるとソースコードをコンパイルして非最適化機械語オブジェクトを生成し、該生成された非最適化機械語オブジェクトをプログラマブルコントローラに送信するように構成される。
According to a fourth aspect of the present invention, in the programmable controller according to the third aspect , the support device has a compiling unit for compiling a predetermined source code, and the compiling unit receives presence / absence information when receiving a debug start instruction including a break instruction. Sends a command requesting a response to the programmable controller, receives a response including presence / absence information for the transmission from the programmable controller, and refers to the received presence / absence information to register the non-optimized machine language object in the programmable controller. If it is confirmed that the non-optimized machine language object is already registered in the programmable controller, the source code is not compiled and the non-optimized machine language object is not generated. , As a result of referring to presence information, When it is confirmed that the optimized machine language object is not registered in the programmable controller, the source code is compiled to generate a non-optimized machine language object, and the generated non-optimized machine language object is transmitted to the programmable controller. Configured to do.

請求項に係る発明は、請求項2記載のプログラマブルコントローラにおいて、デバッグ制御部はトレース命令をサイクリックの周期に同期して挿入し、トレース解除指示が与えられるとプログラム実行管理部に挿入したトレース命令をサイクリックの周期に同期して削除するように構成される。 The invention according to claim 5 is the programmable controller according to claim 2, wherein the debug control unit inserts the trace instruction in synchronization with the cyclic period, and the trace inserted into the program execution management unit when a trace release instruction is given. The instruction is configured to be deleted in synchronization with the cyclic period.

請求項に係る発明は、請求項記載のプログラマブルコントローラにおいて、デバッグ制御部はブレーク命令をサイクリックの周期に同期して挿入し、ブレーク解除指示が与えられるとサイクリックの周期に同期して非最適化機械語オブジェクトに挿入したブレーク命令を削除するとともにテーブルに最適化機械語オブジェクトの先頭アドレスを登録するように構成される。

The invention according to claim 6, in a programmable controller of claim 1 wherein the debug control unit inserts in synchronization with the cycle of the cyclically break instruction, in synchronization with the cycle of the cyclic a break cancellation instruction is given The break instruction inserted in the non-optimized machine language object is deleted, and the head address of the optimized machine language object is registered in the table.

本発明において支援装置はソースコードをコンパイルして、最適化機械語オブジェクトを生成しプログラマブルコントローラ(PLC)に転送しておく。
ユーザがデバッグモードとしてブレークを選択すると、支援装置はソースコード上に設定されたブレークポイントを基にデバッグ情報を生成する。この際、デバッグ対象の非最適化機械語オブジェクトが既にプログラマブルコントローラに格納されていれば非最適化機械語オブジェクトを生成せず、デバッグ情報のみをプログラマブルコントローラに送信する。一方、デバッグ対象の非最適化機械語オブジェクトが既にプログラマブルコントローラに格納されていれば、支援装置はソースコードをコンパイルして非最適化機械語オブジェクトを生成しデバッグ情報および非最適化機械語オブジェクトの両方をプログラマブルコントローラに送信する。
In the present invention, the support device compiles the source code, generates an optimized machine language object, and transfers it to a programmable controller (PLC).
When the user selects a break as the debug mode, the support apparatus generates debug information based on the breakpoint set on the source code. At this time, if the non-optimized machine language object to be debugged is already stored in the programmable controller, the non-optimized machine language object is not generated, and only debug information is transmitted to the programmable controller. On the other hand, if the non-optimized machine language object to be debugged is already stored in the programmable controller, the support device compiles the source code to generate the non-optimized machine language object, and generates the debug information and the non-optimized machine language object. Send both to the programmable controller.

そして、プログラマブルコントローラは支援装置から非最適化機械語オブジェクトを受信すると内部メモリに転送し、デバッグ情報に応じて、内部メモリに転送された非最適化機械語オブジェクトにブレークポイント処理コードを挿入し、この非最適化機械語オブジェクトの先頭アドレスをアドレステーブルに登録する。続いて、プログラマブルコントローラはアドレステーブルに登録されたアドレス情報をアクセス先として非最適化機械語オブジェクトを実行し、ブレークポイント処理コードを実行したとき、ブレークする。   When the non-optimized machine language object is received from the support device, the programmable controller transfers the non-optimized machine language object to the internal memory, and inserts breakpoint processing code into the non-optimized machine language object transferred to the internal memory according to the debug information. The head address of this non-optimized machine language object is registered in the address table. Subsequently, the programmable controller executes the non-optimized machine language object using the address information registered in the address table as an access destination, and breaks when the breakpoint processing code is executed.

一方、ユーザがデバッグモードとしてトレースを選択すると、支援装置はソースコード上に設定されたトリガ条件を基にデバッグ情報を生成しに送信する。プログラマブルコントローラは受信したデバッグ情報を基に、デバッグ対象の最適化機械語オブジェクトを特定し、この最適化機械語オブジェクトの実行が完了した時点でトレース機能を呼び出し、このタイミングを起点にプログラムの実行をトレースする。   On the other hand, when the user selects the trace as the debug mode, the support device generates and transmits debug information based on the trigger condition set on the source code. The programmable controller identifies the optimized machine language object to be debugged based on the received debug information, calls the trace function when execution of this optimized machine language object is completed, and executes the program starting from this timing. Trace.

このように構成することにより、本発明は最適化機械語オブジェクトを実行することによって高速化を図るプログラマブルコントローラのデバッグ作業の効率を向上させるとともに、プログラマブルコントローラが運用状態でその高速化されたプログラムの実行速度を維持したままデバッグ可能なプログラマブルコントローラを提供できる。   By configuring in this way, the present invention improves the efficiency of the debugging operation of the programmable controller that achieves high speed by executing the optimized machine language object, and the speed of the high-speed program in the operating state of the programmable controller is increased. A programmable controller that can be debugged while maintaining the execution speed can be provided.

本発明に係るプログラマブルコントローラシステムの一実施形態を示すシステム構成図The system block diagram which shows one Embodiment of the programmable controller system which concerns on this invention 本発明に係るプログラマブルコントローラのブロック図Block diagram of a programmable controller according to the present invention 本発明に係るプログラマブルコントローラシステムの機能構成図Functional configuration diagram of programmable controller system according to the present invention 図1に係る支援装置の支援処理の一例を示すフローチャートThe flowchart which shows an example of the assistance process of the assistance apparatus which concerns on FIG. 図1に係る支援装置が表示するメニュー画面の一例An example of a menu screen displayed by the support device according to FIG. 本発明に係るプログラマブルコントローラが実行する処理の一例を示すフローチャートThe flowchart which shows an example of the process which the programmable controller which concerns on this invention performs 本発明に係る送信される機械語オブジェクトの構成を示す説明図Explanatory drawing which shows the structure of the machine language object transmitted based on this invention 本発明に係るデバッグ時に送信されるデバッグ情報を示す説明図Explanatory drawing which shows the debug information transmitted at the time of debugging which concerns on this invention 本発明に係る機械語オブジェクトとアドレステーブルがプログラムメモリに転送され登録されることを説明する図The figure explaining that the machine language object and address table which concern on this invention are transferred and registered to program memory ブレーク実行時の動作を説明する図Diagram explaining the operation during break execution トレース実行時の動作を説明する図Diagram explaining the operation during trace execution

以下、本発明の一実施形態について、図面を参照しながら説明する。以降の説明においてアドレス表記は16進である。
図1は本発明に係るプログラマブルコントローラシステムの一実施形態を説明する構成図である。
Hereinafter, an embodiment of the present invention will be described with reference to the drawings. In the following description, the address notation is hexadecimal.
FIG. 1 is a configuration diagram illustrating an embodiment of a programmable controller system according to the present invention.

図1に示すように、このシステムは、支援装置100(プログラミングローダ)がプログラマブルコントローラ(以下、PLCという)200と信号線110により着脱可能に接続されており、PLC200は制御機器300に接続されている。PLC200はシーケンス制御プログラムを実行して制御機器300を制御する。   As shown in FIG. 1, in this system, a support device 100 (programming loader) is detachably connected to a programmable controller (hereinafter referred to as PLC) 200 by a signal line 110, and the PLC 200 is connected to a control device 300. Yes. The PLC 200 executes the sequence control program and controls the control device 300.

支援装置100は、中央演算処理装置(CPU)101、内部メモリ104、記憶装置105、マウスやキーボード等からなる入力装置102、表示器103、入出力インターフェイス(I/O)106などから構成され、これらが共通バス107に接続されている。   The support device 100 includes a central processing unit (CPU) 101, an internal memory 104, a storage device 105, an input device 102 including a mouse and a keyboard, a display 103, an input / output interface (I / O) 106, and the like. These are connected to the common bus 107.

記憶装置105には各種のデータが記憶されている。入力装置102は、オペレータによって外部から操作されるマウスやキーボード等からの入力イベントをCPU101に通知する。   Various data are stored in the storage device 105. The input device 102 notifies the CPU 101 of an input event from a mouse, a keyboard, or the like operated from the outside by an operator.

表示器103は、例えば液晶デスプレイからなり、入力イベントに応じて、各種データや画像を表示する。I/O106は、信号線110を介してPLC200と接続されており、支援装置100とPLC200とのデータを授受する。   The display device 103 is composed of, for example, a liquid crystal display, and displays various data and images according to input events. The I / O 106 is connected to the PLC 200 via the signal line 110, and exchanges data between the support apparatus 100 and the PLC 200.

CPU101は、入力装置102に入力される入力イベントと、内部メモリ104から読み出したプログラムに従って、記憶装置105から各種のデータを読み出しながら、或いは記憶装置105に各種のデータを書き込みながら、各部の動作を制御する。さらに、CPU101はパラメータなどPLC200に対する動作指示を、I/O106を介してPLC200に送出することや、PLC200が実行するためのシーケンス制御プログラムをI/O106を介してPLC200にダウンロードすることができる。   The CPU 101 operates each unit while reading various data from the storage device 105 or writing various data to the storage device 105 according to an input event input to the input device 102 and a program read from the internal memory 104. Control. Furthermore, the CPU 101 can send operation instructions to the PLC 200 such as parameters to the PLC 200 via the I / O 106, and can download a sequence control program to be executed by the PLC 200 to the PLC 200 via the I / O 106.

このように構成された支援装置100は、ユーザによってプログラミングされたソースプログラムをコンパイルして、後述する図2のCPU211が直接実行可能な実行コード(機械語)を生成する機能を有している。そして、実行コードが、通信線110を介してCPUモジュール210にダウンロードされることにより、CPUモジュール210は、システムプログラムメモリ212などに保持されたシーケンス制御プログラムを、ダウンロードされた実行コードに更新することができる(プログラム更新手段)。   The support apparatus 100 configured as described above has a function of compiling a source program programmed by a user and generating an execution code (machine language) that can be directly executed by the CPU 211 of FIG. Then, when the execution code is downloaded to the CPU module 210 via the communication line 110, the CPU module 210 updates the sequence control program held in the system program memory 212 or the like to the downloaded execution code. (Program update means).

図2はPLC200の内部構成図である。
PLC200はCPU(Central Processing Unit)モジュール210を有する。このCPUモジュール210はCPU211、ドライバ/レシーバ217、PLC固有バスインターフェース214、システムプログラムメモリ(FLASH)212、システムワークメモリ(RAM(Random Access Memory))216、ユーザプログラムメモリ(RAM)213、ユーザデータメモリ(RAM)215などを有し、それらがバス218により接続されている。また、CPUモジュール210はPLC固有バスインターフェース214を通して入出力モジュール222と接続される。
FIG. 2 is an internal configuration diagram of the PLC 200.
The PLC 200 includes a CPU (Central Processing Unit) module 210. The CPU module 210 includes a CPU 211, a driver / receiver 217, a PLC specific bus interface 214, a system program memory (FLASH) 212, a system work memory (RAM (Random Access Memory)) 216, a user program memory (RAM) 213, and a user data memory. (RAM) 215 and the like, which are connected by a bus 218. The CPU module 210 is connected to the input / output module 222 through the PLC specific bus interface 214.

また、PLC200はパワーオンまたはリセットスタート後、システムの初期化を経てシステムプログラムメモリ212に保持されたシーケンス制御プログラムをサイクリックに実行し、制御機器300を所定の周期で制御するよう構成されている。   The PLC 200 is configured to cyclically execute the sequence control program held in the system program memory 212 after system initialization after power-on or reset start, and to control the control device 300 at a predetermined cycle. .

図3は、本発明の一実施形態を示す機能ブロック図であり、図中、支援装置100はユーザによって作成されたソースコード(ソースプログラム)を機械語オブジェクトに変換するコンパイル機能を備える。支援装置100によってコンパイルされた機械語オブジェクトはPLC200などのターゲットにダウンロードされる。   FIG. 3 is a functional block diagram showing an embodiment of the present invention, in which the support apparatus 100 has a compile function for converting source code (source program) created by a user into a machine language object. The machine language object compiled by the support apparatus 100 is downloaded to a target such as the PLC 200.

ユーザインタフェース部11はユーザによって作成されたIEC(International Electrotechnical Commission)言語のソースコードをコンパイラに与える。コンパイラ12(コンパイル手段)は、通常時(デバッグを実行しないとき)、ソースコードを最適化コンパイルして最適化機械語オブジェクトを生成し、最適化機械語オブジェクト13として図示しない記憶領域等に格納する。生成された最適化機械語オブジェクト13はRS232C等の通信部14を介してPLC200にダウンロードされる。   The user interface unit 11 gives the IEC (International Electrotechnical Commission) language source code created by the user to the compiler. The compiler 12 (compilation means) generates an optimized machine language object by optimizing and compiling the source code during normal times (when debugging is not executed), and stores the optimized machine language object 13 in an unillustrated storage area or the like. . The generated optimized machine language object 13 is downloaded to the PLC 200 via the communication unit 14 such as RS232C.

一方、デバッグ時にコンパイラ12は、ソースコードをコンパイルしてデバッグ可能な機械語オブジェクト(非最適化機械語オブジェクト)を生成し、非最適化機械語オブジェクト15として図示しない記憶領域等に格納する。生成された非最適化機械語オブジェクト15は、データ通信部14を介してPLC200にダウンロードされる。   On the other hand, during debugging, the compiler 12 generates a machine language object (non-optimized machine language object) that can be debugged by compiling the source code, and stores it as a non-optimized machine language object 15 in a storage area (not shown). The generated non-optimized machine language object 15 is downloaded to the PLC 200 via the data communication unit 14.

PLC200は、データ通信部21を有し、このデータ通信部21を通じて支援装置100から入力される最適化機械語オブジェクト13を最適化機械語オブジェクト22として転送し登録するとともに、最適化機械語オブジェクト22の先頭アドレスをアドレステーブル24に登録する。プログラム実行部27はサイクリックに実行されるオペレーション機能(プログラム実行管理部)に呼び出され、アドレステーブル24に登録されたアドレス情報に基づいて最適化機械語オブジェクトを実行するよう構成されており、通常時は最適化機械語オブジェクト22を実行している。すなわち、プログラム実行部27はアドレステーブル24を参照して、該アドレステーブル24の情報を間接アドレス指定して、そのアドレス先に保持された機械語オブジェクトを実行する。通常時、アドレステーブル24には最適化機械語オブジェクト22の先頭アドレスが登録されており、プログラム実行部27は最適化機械語オブジェクト22を実行することでプログラムを高速に実行している。   The PLC 200 includes a data communication unit 21. The optimized machine language object 13 input from the support apparatus 100 through the data communication unit 21 is transferred and registered as the optimized machine language object 22, and the optimized machine language object 22 is also registered. Is registered in the address table 24. The program execution unit 27 is called by a cyclically executed operation function (program execution management unit), and is configured to execute an optimized machine language object based on address information registered in the address table 24. At the time, the optimized machine language object 22 is executed. That is, the program execution unit 27 refers to the address table 24, indirectly specifies the information in the address table 24, and executes the machine language object held at the address destination. Normally, the start address of the optimized machine language object 22 is registered in the address table 24, and the program execution unit 27 executes the program at high speed by executing the optimized machine language object 22.

一方、デバッグ時にPLC200は、支援装置100から入力される非最適化機械語オブジェクト15を非最適化機械語オブジェクト23として転送し登録するとともに、非最適化機械語オブジェクト23の先頭アドレスをアドレステーブル24に登録する。この登録に基づきプログラム実行部27は非最適化機械語オブジェクト23を実行する。そして、PLC200はデバッグの終了時に最適化機械語オブジェクト22の先頭アドレスをアドレステーブル24に再び登録することにより、通常時に戻る。   On the other hand, at the time of debugging, the PLC 200 transfers and registers the non-optimized machine language object 15 input from the support apparatus 100 as the non-optimized machine language object 23 and also registers the start address of the non-optimized machine language object 23 in the address table 24. Register with. Based on this registration, the program execution unit 27 executes the non-optimized machine language object 23. Then, the PLC 200 returns to the normal time by re-registering the head address of the optimized machine language object 22 in the address table 24 at the end of debugging.

このように、通常時は最適化機械語オブジェクト22が保持された領域(第一の記憶領域)の先頭アドレスをアドレステーブル24に登録し、デバッグ時には非最適化機械語オブジェクト23が保持された領域(第二の記憶領域)の先頭アドレスをアドレステーブル24に登録することにより、通常時とデバッグ時とで機械語オブジェクトを切り替えて実行するので、最適化機械語オブジェクトを実行して高速化を図るPLCのデバッグ作業が極めて容易になる。   As described above, the start address of the area (first storage area) in which the optimized machine language object 22 is held is registered in the address table 24 in normal times, and the area in which the non-optimized machine language object 23 is held in debugging. By registering the start address of the (second storage area) in the address table 24, the machine language object is switched between the normal time and the debug time and executed. Therefore, the optimized machine language object is executed to increase the speed. PLC debugging is extremely easy.

ここで、支援装置100の具体的な処理の一例を説明する。図4は、支援装置100の支援処理手順の一例を示している。支援処理は、先ず、ステップS1で、処理メニューを表示する。この処理メニューとしては図5に示すように、コンパイル開始ボタン31、デバッグ開始ボタン32、デバッグ終了ボタン34、終了ボタン33が少なくとも設定されている。またデバッグ開始ボタン32には後述のブレーク処理またはトレース処理が選択できるようラジオボタンがオプションとして付与されている。これらメニュー31〜34のうちの所望のボタンがユーザにより選択されることにより、支援装置100は各種処理を実行する。   Here, an example of specific processing of the support apparatus 100 will be described. FIG. 4 shows an example of a support processing procedure of the support apparatus 100. The support process first displays a process menu in step S1. As shown in FIG. 5, at least a compile start button 31, a debug start button 32, a debug end button 34, and an end button 33 are set as this processing menu. The debug start button 32 is provided with a radio button as an option so that a break process or a trace process described later can be selected. When the user selects a desired button from the menus 31 to 34, the support apparatus 100 executes various processes.

続いて、ステップS2に移行して、支援処理はコンパイル開始ボタン31が選択されたか否かを判定し、コンパイル開始ボタン31が選択されていないときには、後述するステップS5に移行し、コンパイル開始ボタン31が選択されたときには、ステップS3に移行して、ソースコードを最適化コンパイルして最適化機械語オブジェクトを生成するとともに、このときのソースコードのファイル名と識別番号とを対応付けた対応表(ソースコード・識別番号対応表)を作成し、このソースコード・識別番号対応表および最適化機械語オブジェクト13を記憶領域に保存する。なお、識別番号については後述するが、コンパイル後の機械語オブジェクトを一意に識別する情報(番号)であって、その記述方法はどのような形式でも構わない。   Subsequently, the process proceeds to step S2, where the support process determines whether or not the compile start button 31 has been selected. If the compile start button 31 has not been selected, the process proceeds to step S5 described later, and the compile start button 31 is reached. Is selected, the source code is optimized and compiled to generate an optimized machine language object, and the source code file name at this time is associated with the identification number ( Source code / identification number correspondence table) is created, and the source code / identification number correspondence table and the optimized machine language object 13 are stored in the storage area. Although the identification number will be described later, it is information (number) for uniquely identifying the machine language object after compilation, and the description method may be in any format.

続いて、処理はステップS4に移行し、支援処理は記憶領域に保持された最適化機械語オブジェクト13を、データ通信部14を介してPLC200にダウンロードし、ステップS5に移行する。   Subsequently, the process proceeds to step S4, and the support process downloads the optimized machine language object 13 held in the storage area to the PLC 200 via the data communication unit 14, and proceeds to step S5.

ステップS5で支援処理は、デバッグ開始ボタン32が選択されたか否かを判定し、デバッグ開始ボタン32が選択されていないときにはステップS16に移行し、デバッグ開始ボタン32が選択されればステップS6に移行する。   In step S5, the support process determines whether or not the debug start button 32 is selected. If the debug start button 32 is not selected, the process proceeds to step S16. If the debug start button 32 is selected, the process proceeds to step S6. To do.

ステップS6に移行した支援処理は、デバッグ開始ボタン32のオプションとして選択されるブレーク処理のラジオボタンが選択されているか否かを判定する。ブレーク処理が選択されていない場合に支援処理はステップS17に移行し、ブレーク処理が選択された場合にはステップS7に移行する。   In step S6, the support process determines whether the break process radio button selected as the option of the debug start button 32 is selected. When the break process is not selected, the support process proceeds to step S17, and when the break process is selected, the process proceeds to step S7.

ステップS7に移行した支援処理は、ユーザがソースコード上に設定したブレークポイントを基に図8に示すデバッグ情報を作成する。このデバッグ情報の識別番号51は、ブレークポイントが設定されたソースコードのファイル名を基に、前述ソースコード・識別番号対応表から特定された識別番号であり、ブレーク位置52は、ブレークポイントが設定された行番号である。なお、ブレークポイントについては後述するが、ソースコードにおける任意の位置に相当する箇所で、プログラム実行を中止させる為の一種のマーカー(識別子)であって、その実現方法はどのような形式でも構わない。以降の説明では、一例として、ブレークポイント処理コードを挿入する方法を用いるものとする。   The support processing that has shifted to step S7 creates debug information shown in FIG. 8 based on the breakpoint set by the user on the source code. The debug information identification number 51 is an identification number specified from the source code / identification number correspondence table based on the file name of the source code in which the breakpoint is set, and the break position 52 is set by the breakpoint. Line number. Although the breakpoint will be described later, it is a kind of marker (identifier) for stopping the program execution at a position corresponding to an arbitrary position in the source code, and its implementation method may take any form. . In the following description, as an example, a method of inserting a breakpoint processing code is used.

続いて、ステップS8に移行して、支援処理はPLC200に対してデバッグ開始通知を送信する。このとき支援処理は、デバッグ情報に加えて、実行すべきデバッグ処理がブレークであることをPLC200に送信する。   Subsequently, the process proceeds to step S <b> 8, and the support process transmits a debug start notification to the PLC 200. At this time, the support process transmits to the PLC 200 that the debug process to be executed is a break in addition to the debug information.

続いて、ステップS9に移行し、支援処理はPLC200にデバッグ対象の非最適化機械語オブジェクトが存在するか否かを確認する。この確認は所定の確認コマンドをPLC200に送信し、PLC200からデバッグ対象の非最適化機械語オブジェクトの有無を表すオブジェクト有無通知(有無情報)を受信することで達成される。この結果、デバッグ対象の非最適化機械語オブジェクトがPLC200に存在する通知をPLC200から受信したときには、ステップS13に移行し、デバッグ対象の非最適化機械語オブジェクトがPLC200に存在しない場合にはステップS10に移行する。   Subsequently, the process proceeds to step S <b> 9, and the support process confirms whether or not a non-optimized machine language object to be debugged exists in the PLC 200. This confirmation is achieved by transmitting a predetermined confirmation command to the PLC 200 and receiving an object presence / absence notification (presence / absence information) indicating the presence / absence of a non-optimized machine language object to be debugged from the PLC 200. As a result, when the notification that the non-optimized machine language object to be debugged exists in the PLC 200 is received from the PLC 200, the process proceeds to step S13, and when the non-optimized machine language object to be debugged does not exist in the PLC 200, the process proceeds to step S10. Migrate to

ステップS10に移行した支援処理は、ソースコードをコンパイルして非最適化機械語オブジェクト15を生成して記憶領域に保存し、次いでステップS11に移行して、記憶領域に保持された非最適化機械語オブジェクト15を、データ通信部14を介してPLC200にダウンロードする。   The support process that has shifted to step S10 compiles the source code to generate the non-optimized machine language object 15 and stores it in the storage area, and then shifts to step S11 to store the non-optimized machine stored in the storage area. The word object 15 is downloaded to the PLC 200 via the data communication unit 14.

続いて、ステップS12に移行して、支援処理はPLC200から後述する処理完了通知(ブレークポイント処理コードの挿入処理の完了を示す通知)を受信したか否かを判定し、処理完了通知を受信していないときには処理完了通知を受信するまで待機し、処理完了通知を受信したときにはステップS13に移行する。   Subsequently, the process proceeds to step S12, where the support process determines whether or not a process completion notification (notification indicating completion of the breakpoint process code insertion process) described later has been received from the PLC 200, and receives the process completion notification. If not, the process waits until a process completion notice is received. If a process completion notice is received, the process proceeds to step S13.

ステップS13で支援処理は、PLC200がブレークしたときのステータス情報を表示するなどのデバッグ処理を実行し、次いで、ステップS14に移行して、デバッグ終了ボタン34が選択されたか否かを判定してデバッグ処理の終了を判定し、デバッグ処理が終了していないときにはこれが終了するまで待機し、デバッグ終了ボタン34が選択されたときにはステップS15に移行して、デバッグ終了通知をPLC200に送信しステップS16に移行する。そして、ステップS16にて支援処理は、終了ボタン33が選択されたか否かを判定し、終了ボタン33選択されたときにはメニュー画面を消して支援処理を終了する。そうでないときにはステップS2に戻る。   In step S13, the support process executes debug processing such as displaying status information when the PLC 200 breaks, and then proceeds to step S14 to determine whether or not the debug end button 34 has been selected for debugging. When the end of the process is determined, the process waits until the end of the debug process, and when the debug end button 34 is selected, the process proceeds to step S15, a debug end notification is transmitted to the PLC 200, and the process proceeds to step S16. To do. In step S16, the support process determines whether or not the end button 33 has been selected. When the end button 33 is selected, the menu screen is cleared and the support process ends. Otherwise, the process returns to step S2.

また、ステップS6の判定の結果、ステップS17に移行した支援処理は、トレース処理のラジオボタンが設定されていることを確認し、トレースを開始するためのトリガ条件を設定する。このトリガ条件は前述ブレークポイントの設定の要領と同じく、トレースさせたい部分をユーザがソースコード上に設定することにより図8に示すデバッグ情報を抽出し、PLC200に送信する(ステップS18)。このステップS18で支援処理は、デバッグ情報に加えて実行すべきデバッグ処理がトレースであることをPLC200に送信する。   As a result of the determination in step S6, the support process that has shifted to step S17 confirms that the radio button for the trace process is set, and sets a trigger condition for starting the trace. The trigger condition is the same as the above-described breakpoint setting procedure, and the user sets the part to be traced on the source code, thereby extracting the debug information shown in FIG. 8 and transmitting it to the PLC 200 (step S18). In step S18, the support process transmits to the PLC 200 that the debug process to be executed is a trace in addition to the debug information.

ここで、PLC200の具体的な処理の一例を説明する。
図6は、PLC200が機械語オブジェクトをプログラムメモリ213に転送し、デバッグする際の処理手順(以下PLC処理)の一例を示している。このPLC処理は、先ず、ステップS21で、支援装置100から最適化機械語オブジェクト13を受信したか否かを判定し、最適化機械語オブジェクト13を受信していないときにはステップS31に移行し、最適化機械語オブジェクト13を受信したときにはステップS22に移行する。
Here, an example of specific processing of the PLC 200 will be described.
FIG. 6 shows an example of a processing procedure (hereinafter referred to as PLC processing) when the PLC 200 transfers the machine language object to the program memory 213 and debugs it. In this PLC process, first, in step S21, it is determined whether or not the optimized machine language object 13 is received from the support apparatus 100. If the optimized machine language object 13 is not received, the process proceeds to step S31. When the computerized machine language object 13 is received, the process proceeds to step S22.

ステップS22に移行したPLC処理は、受信した最適化機械語オブジェクト13をユーザプログラムメモリ213の最適化機械語オブジェクト保存領域(不図示)に最適化機械語オブジェクト22として転送し、続いてステップS23に移行し、最適化機械語オブジェクト22の保存領域の先頭アドレスをアドレステーブル24に登録する。ステップS21からステップS23に係る処理をオブジェクト展開機能ともいい、図3のオブジェクト展開部25に相当する。   The PLC process that has proceeded to step S22 transfers the received optimized machine language object 13 to the optimized machine language object storage area (not shown) of the user program memory 213 as the optimized machine language object 22, and then proceeds to step S23. Then, the start address of the storage area of the optimized machine language object 22 is registered in the address table 24. The processing from step S21 to step S23 is also called an object expansion function, and corresponds to the object expansion unit 25 in FIG.

そして、PLC処理はステップS31に移行し、支援装置100からデバッグ開始通知を受信したか否かを判定する。この判定の結果、デバッグ開始通知を受信していないときにはステップS21に戻り、デバッグ開始通知を受信したときにはステップS32に移行する。なお、デバッグ開始通知には前述図8に示すデバッグ情報と実行すべきデバッグ処理(ブレーク、もしくはトレース)を示すデバッグ処理パラメータを含むものとする。   Then, the PLC process proceeds to step S31, and determines whether or not a debug start notification is received from the support apparatus 100. As a result of this determination, when the debug start notification is not received, the process returns to step S21, and when the debug start notification is received, the process proceeds to step S32. It is assumed that the debug start notification includes the debug information shown in FIG. 8 and the debug process parameter indicating the debug process (break or trace) to be executed.

ステップS32に移行したPLC処理は、前述デバッグ処理パラメータを判定し、デバッグ処理パラメータがブレークであるときステップS33に移行し、そうでないときにはステップS41に移行する。   The PLC process which shifted to step S32 determines the above-mentioned debug process parameter, and when the debug process parameter is a break, shifts to step S33, and when not, shifts to step S41.

ステップS33においてPLC処理は、デバッグ対象の機械語オブジェクトが既に格納済みか否かを確認してその有無情報を支援装置100に送信し、ステップS34に移行する。S34でPLC処理は、所定の時間を経過後、支援装置100から非最適化機械語オブジェクトを受信したか否かを判定し、非最適化機械語オブジェクトを受信したならばステップS35に移行し、非最適化機械語オブジェクトを受信しなければステップS36に移行する。   In step S33, the PLC process confirms whether the machine language object to be debugged has already been stored, transmits the presence / absence information to the support apparatus 100, and proceeds to step S34. In S34, the PLC process determines whether or not a non-optimized machine language object has been received from the support apparatus 100 after a predetermined time has elapsed. If a non-optimized machine language object has been received, the process proceeds to step S35. If no non-optimized machine language object is received, the process proceeds to step S36.

処理はステップS35に移行し、PLC処理は受信した機械語オブジェクト43(後術図7)をユーザプログラムメモリ213の非最適化機械語オブジェクト保存領域(不図示)に転送し、続いてステップS36に移行し、前述デバッグ情報を参照して、デバッグ対象とする機械語オブジェクトの識別番号およびブレーク位置を取得し、該識別番号が付与された非最適化機械語オブジェクトにブレークポイント処理コードを挿入する。このブレークポイントコードが挿入される位置は前述ブレーク位置にて特定される。処理はステップS37に移行し、PLC処理はアドレステーブル24にデバッグ用アドレスとして前述非最適化機械語オブジェクトの保存先先頭アドレスを登録する。   The process proceeds to step S35, and the PLC process transfers the received machine language object 43 (see FIG. 7) to a non-optimized machine language object storage area (not shown) in the user program memory 213, and then proceeds to step S36. Transition is made, the identification number and break position of the machine language object to be debugged are obtained by referring to the debug information, and the breakpoint processing code is inserted into the non-optimized machine language object to which the identification number is assigned. The position where the breakpoint code is inserted is specified by the break position. The process proceeds to step S37, and the PLC process registers the storage destination head address of the non-optimized machine language object in the address table 24 as a debug address.

処理はステップS38に移行し、PLC処理はデータ通信部21を介して、処理完了通知を支援装置100に送信してからステップS39に移行する。ステップS39でPLC処理は、支援装置100からデバッグ完了通知を受信したか否かを判定し、デバッグ完了通知を受信していないときにはこれを受信するまで待機し、デバッグ完了通知を受信したときにはステップS40に移行して、アドレステーブル24を最適化用アドレスに切換えてからステップS21に戻る。   The process proceeds to step S38, and the PLC process transmits a process completion notification to the support apparatus 100 via the data communication unit 21, and then proceeds to step S39. In step S39, the PLC process determines whether or not a debug completion notification has been received from the support apparatus 100. If the debug completion notification has not been received, the PLC processing waits until it is received, and if a debug completion notification has been received, step S40. Then, after the address table 24 is switched to the optimization address, the process returns to step S21.

また、ステップS32の判定にて、デバッグ処理パラメータがブレークでない場合、処理はステップS41に移行する。ステップS41でPLC処理は、支援装置100から受信したデバッグ情報を参照してトリガ条件を設定し、続いてステップS42に移行して、処理完了通知を支援装置100に送信してからステップS43に移行する。ステップS43でPLC処理は、支援装置100からデバッグ完了通知を受信したか否かを判定し、デバッグ完了通知を受信していないときにはこれを受信するまで待機し、デバッグ完了通知を受信したときにはステップS21に戻る。なお、ステップS31からステップS43に係る処理をデバッグ制御機能ともいい、図3のデバッグ制御部26に相当する。   If it is determined in step S32 that the debug process parameter is not a break, the process proceeds to step S41. In step S41, the PLC process refers to the debug information received from the support apparatus 100, sets a trigger condition, then proceeds to step S42, transmits a process completion notification to the support apparatus 100, and then proceeds to step S43. To do. In step S43, the PLC process determines whether or not a debug completion notification has been received from the support apparatus 100. If the debug completion notification has not been received, the PLC processing waits until it is received. Return to. Note that the processing from step S31 to step S43 is also called a debug control function, and corresponds to the debug control unit 26 in FIG.


次に、上記実施形態の動作を説明する。
(機械語オブジェクトをダウンロードするまでの支援装置100に係る動作)
支援装置100を使用してPLC200に機械語オブジェクトをダウンロードするには、ユーザは先ず、支援装置100のユーザインタフェース部11でプログラムをIEC言語で記述したソースコードを作成する。このソースコードを作成した状態で、支援装置100で、表示器103に表示された処理メニューからコンパイル開始ボタン31を選択する。このコンパイル開始ボタン31の選択がされることによって、支援装置100はコンパイラ12でソースコードを最適化コンパイルして最適化機械語オブジェクト13を生成し、これを記憶領域に格納する。この最適化コンパイルは、ソースコードの実行順序の変更、レジスタの有効活用等を行なうことにより、コードサイズを縮小する。ここで、最適化機械語オブジェクト13は、POU(Program Organization Unit)毎に生成される。このPOUとは、プログラム構成単位であり、PLC200の言語要素である。なお、POUの種類には、アプリケーションプログラム、ファンクションブロック等があり、C言語の関数に相当するものである。

Next, the operation of the above embodiment will be described.
(Operations related to the support device 100 until the machine language object is downloaded)
In order to download a machine language object to the PLC 200 using the support apparatus 100, the user first creates a source code in which a program is described in the IEC language by the user interface unit 11 of the support apparatus 100. With this source code created, the support device 100 selects the compile start button 31 from the processing menu displayed on the display unit 103. When the compile start button 31 is selected, the support apparatus 100 optimizes and compiles the source code with the compiler 12 to generate the optimized machine language object 13 and stores it in the storage area. In this optimization compilation, the code size is reduced by changing the execution order of the source code, effectively using the registers, and the like. Here, the optimized machine language object 13 is generated for each POU (Program Organization Unit). The POU is a program unit and is a language element of the PLC 200. Note that POU types include application programs, function blocks, and the like, which correspond to C language functions.

支援装置100は最適化コンパイルを行なう際、生成された最適化機械語オブジェクト13が何れのソースコードを変換したものであるかを対応付けるようにソースコード・識別番号対応表を作成し記憶領域に保存する。すなわち、ソースコード・識別番号対応表はソースコードのファイル名と識別番号とを対応付けたテーブル情報である。   When performing the optimization compilation, the support apparatus 100 creates a source code / identification number correspondence table so that the generated optimized machine language object 13 corresponds to which source code is converted, and saves it in the storage area. To do. That is, the source code / identification number correspondence table is table information in which the file name of the source code is associated with the identification number.

そして、支援装置100は最適化機械語オブジェクト13の生成が完了すると、データ通信部14を介してPLC200にダウンロードする。
このとき、最適化機械語オブジェクト13は、図7に示すように、POU単位の機械語オブジェクト43(オブジェクト本体)に対して識別番号41及び最適化機械語オブジェクトであるか非最適化機械語オブジェクトであるかを表す情報42が付加されてプPLC200にダウンロードされる。識別番号41はコンパイルされた最適化機械語オブジェクトおよび非最適化機械語オブジェクトそれぞれのPOUに付与される番号であり、POUを一意に識別するための識別子である。種別42は機械語オブジェクト43が最適化されたものか、デバッグ可能な非最適化のものかを示す種別コードであり、本発明の実施形態では「1」を最適化された機械語オブジェクト、「2」を非最適化機械語オブジェクト(デバッグ可能な機械語オブジェクト)として定義している。
Then, when the generation of the optimized machine language object 13 is completed, the support apparatus 100 downloads it to the PLC 200 via the data communication unit 14.
At this time, as shown in FIG. 7, the optimized machine language object 13 is an identification number 41 and an optimized machine language object or a non-optimized machine language object for the machine language object 43 (object body) in POU units. Information 42 indicating whether or not is added and downloaded to the PLC 200. The identification number 41 is a number given to each POU of the compiled optimized machine language object and the non-optimized machine language object, and is an identifier for uniquely identifying the POU. The type 42 is a type code indicating whether the machine language object 43 is optimized or non-optimizable that can be debugged. In the embodiment of the present invention, “1” is optimized as a machine language object, “ 2 "is defined as a non-optimized machine language object (debuggable machine language object).

(PLC200が支援装置100から受信した最適化機械語オブジェクトを展開する動作)
例えば、PLC200は支援装置100から図9に示すような機械語オブジェクト(61a、61b)を支援装置100からダウンロードされたとする。機械語オブジェクト61aおよび61bは、その種別が「1」なので最適化である。PLC200はこれら機械語オブジェクト(POU本体)をユーザプログラムメモリ213の最適化機械語オブジェクト格納領域(0番地〜7FFF番地)に識別番号順に転送して保存し、アドレステーブル24の識別番号1用アドレス欄に、機械語オブジェクト61aの格納先頭アドレス「0000」を登録する。同様、アドレステーブル24の識別番号2用アドレス欄には、ユーザプログラムメモリ213に保存された機械語オブジェクト61bの先頭アドレス「1000」が登録される。
(Operation in which the PLC 200 expands the optimized machine language object received from the support apparatus 100)
For example, it is assumed that the PLC 200 has downloaded a machine language object (61a, 61b) as shown in FIG. The machine language objects 61a and 61b are optimized because the type is “1”. The PLC 200 transfers these machine language objects (POU main body) to the optimized machine language object storage area (addresses 0 to 7FFF) of the user program memory 213 in the order of the identification numbers, and stores them in the address field 24 for the identification number 1 in the address table 24. The storage start address “0000” of the machine language object 61a is registered. Similarly, the head address “1000” of the machine language object 61 b stored in the user program memory 213 is registered in the address field for the identification number 2 in the address table 24.

すなわち、PLC200は複数のPOUそれぞれを、識別番号順に展開しユーザプログラムメモリ213に保存する。この際、各POUが保存されたそれぞれの先頭アドレスをアドレステーブル24に登録する。   That is, the PLC 200 develops each of the plurality of POUs in the order of identification numbers and stores them in the user program memory 213. At this time, each head address where each POU is stored is registered in the address table 24.

(通常時にPLC200がオブジェクトを実行する動作)
PLC200はアドレステーブル24を参照して、該アドレステーブル24の情報を間接アドレス指定して機械語オブジェクトを実行する。通常時、上述のようにアドレステーブル24には最適化機械語オブジェクトの先頭アドレスが登録されているので、PLC200は最適化機械語オブジェクト22を高速に実行している。
(Operation in which the PLC 200 executes an object at normal time)
The PLC 200 refers to the address table 24 and indirectly addresses the information in the address table 24 to execute the machine language object. Normally, since the head address of the optimized machine language object is registered in the address table 24 as described above, the PLC 200 executes the optimized machine language object 22 at high speed.

(ブレークを目的としたデバッグにおける支援装置100の動作)
図5のメニュー画面でブレーク処理のラジオボタンが選択され、デバッグ開始ボタン32が選択されると、支援装置100はPLC200をブレークさせるデバッグを開始する。
(Operation of the support apparatus 100 in debugging for the purpose of break)
When the radio button for break processing is selected on the menu screen of FIG. 5 and the debug start button 32 is selected, the support apparatus 100 starts debugging that causes the PLC 200 to break.

PLC200をブレークさせる場合、ユーザは所望のソースコードを開き、開いたソースコードにブレークポイントを設定する。このとき、支援装置100は開かれているソースコードを基に前述ソースコード・識別番号対応表を参照してソースコードに対応する機械語オブジェクトの識別番号を獲得する。さらに、表示画面上で指定されたソースコードの行などの位置を認識する。そして、支援装置100はブレークポイントが設定されたソースコードをコンパイラ12でコンパイルして非最適化機械語オブジェクト15を生成する。この際に、識別番号とブレークポイントとしてソースコードの行を指定する図8に示すデバッグ情報を作成する。   When causing the PLC 200 to break, the user opens a desired source code, and sets a breakpoint in the opened source code. At this time, the support apparatus 100 obtains the identification number of the machine language object corresponding to the source code by referring to the source code / identification number correspondence table based on the opened source code. Furthermore, the position of the line of the source code designated on the display screen is recognized. Then, the support apparatus 100 compiles the source code in which the breakpoint is set by the compiler 12 to generate the non-optimized machine language object 15. At this time, the debug information shown in FIG. 8 is created which specifies the line of the source code as the identification number and the breakpoint.

このようにして、ユーザは所望のソースコードを開いてブレークポイントを設定し、支援装置100はブレークポイントが設定されたソースコードをコンパイラ12でコンパイルして非最適化機械語オブジェクト15を生成するとともにデバッグ情報を作成する。そして、支援装置100は、非最適化機械語オブジェクト15とデバッグ情報をPLC200にダウンロードし、PLC200の処理完了通知を待つ。   In this way, the user opens a desired source code and sets a breakpoint, and the support apparatus 100 generates the non-optimized machine language object 15 by compiling the source code with the breakpoint set by the compiler 12. Create debugging information. Then, the support apparatus 100 downloads the non-optimized machine language object 15 and debug information to the PLC 200 and waits for a process completion notification of the PLC 200.

このとき、支援装置100から送信される最適化機械語オブジェクトは、図7に示すフォーマットでダウンロードされ、デバッグ情報は前述デバッグ処理パラメータを含んだ図8に示すフォーマットにてダウンロードされる(図7の識別番号41と図8の識別番号51は、実質同じである)。   At this time, the optimized machine language object transmitted from the support apparatus 100 is downloaded in the format shown in FIG. 7, and the debug information is downloaded in the format shown in FIG. 8 including the debug processing parameters (FIG. 7). The identification number 41 and the identification number 51 in FIG. 8 are substantially the same).

支援装置100は、PLC200から処理完了通知を受信すると、PLC200がブレークするのを待ち、この待ち状態においてPLC200の状態情報(レジスタの値や入出力データなど)を、表示器103を使って表示し、ユーザにPLCの状態を通知する。そして、何らかの解析がユーザにより行われ、デバッグ終了ボタン34が押されると、デバッグ終了通知をPLC200に送信する。   When receiving the processing completion notification from the PLC 200, the support device 100 waits for the PLC 200 to break, and displays the status information (register values, input / output data, etc.) of the PLC 200 using the display unit 103 in this waiting state. The user is notified of the PLC status. When some analysis is performed by the user and the debug end button 34 is pressed, a debug end notification is transmitted to the PLC 200.


(ブレークを目的としたデバッグにおけるPLC200の動作)
ユーザによりブレークを目的とした操作が行われ、例えば、図10に示す機械語オブジェクト(62a、62b)とデバッグ情報(ブレーク指示)が支援装置100からPLC200にダウンロードされたとする。機械語オブジェクト61aおよび61bはその種別が「2」なので非最適化である。PLC200は、デバッグ情報に含まれるデバッグ処理パラメータを参照してブレーク処理を認識し、機械語オブジェクト62aおよび62bをユーザプログラムメモリ213の非最適化機械語オブジェクト格納領域(8000番地〜)に識別番号順に保存する。

(Operation of PLC 200 in debugging for the purpose of break)
Assume that the user performs an operation for the purpose of a break, and for example, the machine language objects (62a, 62b) and debug information (break instruction) shown in FIG. 10 are downloaded from the support apparatus 100 to the PLC 200. The machine language objects 61a and 61b are not optimized because the type is “2”. The PLC 200 recognizes the break processing by referring to the debug processing parameters included in the debug information, and sets the machine language objects 62a and 62b in the non-optimized machine language object storage area (address 8000) in the user program memory 213 in the order of the identification numbers. save.

そして、PLC200は、デバッグ情報を参照し、デバッグ情報の識別番号が「2」、ブレーク位置が「2」なので、ユーザプログラムメモリ213に保存された識別番号2の非最適化機械語オブジェクトの2行目にブレークポイント処理コードを挿入する。そして、アドレステーブル24の識別番号2用アドレス欄を、識別番号2の非最適化機械語オブジェクトの保存先先頭アドレスに更新する。具体的に説明すると、アドレステーブル24の識別番号2用アドレス欄は「1000」から「9000」に更新される。このように、PLC200は、非最適化機械語オブジェクトとデバッグ情報を受信すると、非最適化機械語オブジェクトを内部メモリに転送するとともに、デバッグ情報に基づいて、デバッグ対象の非最適化機械語オブジェクトを認識して該認識した非最適化機械語オブジェクトにブレークポイント処理コードを挿入し、該識別番号に該当するアドレステーブル欄を最適化機械語オブジェクト用アドレスから非最適化機械語オブジェクト用のアドレスに変更する。このアドレステーブルの変更に伴い、PLC200は識別番号2の機械語オブジェクトの実行に関しては非最適化機械語オブジェクトを実行するようになる。   The PLC 200 refers to the debug information, and since the debug information identification number is “2” and the break position is “2”, two lines of the non-optimized machine language object with the identification number 2 stored in the user program memory 213 are displayed. Insert breakpoint handling code into the eye. Then, the address field for the identification number 2 in the address table 24 is updated to the storage destination start address of the non-optimized machine language object with the identification number 2. More specifically, the address field for the identification number 2 in the address table 24 is updated from “1000” to “9000”. As described above, when the PLC 200 receives the non-optimized machine language object and the debug information, the PLC 200 transfers the non-optimized machine language object to the internal memory, and also sets the non-optimized machine language object to be debugged based on the debug information. Recognize and insert the breakpoint processing code into the recognized non-optimized machine language object, and change the address table column corresponding to the identification number from the address for the optimized machine language object to the address for the non-optimized machine language object To do. With the change of the address table, the PLC 200 executes the non-optimized machine language object with respect to the execution of the machine language object having the identification number 2.

続いて、PLC200は、処理完了通知を支援装置100に送信し、支援装置100からのデバッグ終了通知を待つ。この待ち状態においてPLC200は、挿入されたブレークポイント処理コードを実行した時点で、機械語オブジェクトの実行を停止し、PLC200の状態情報(レジスタの値や入出力データなど)およびブレークして停止したことを支援装置100に送信して待機状態になる。   Subsequently, the PLC 200 transmits a process completion notification to the support apparatus 100 and waits for a debug end notification from the support apparatus 100. In this waiting state, the PLC 200 stops executing the machine language object when executing the inserted breakpoint processing code, and stops the PLC 200 status information (register values, input / output data, etc.) and breaks. Is transmitted to the support device 100 to enter a standby state.

PLC200は、支援装置100からデバッグ終了通知を受信すると、アドレステーブル24をデバッグ用アドレスから最適化用アドレスに切換えるとともに、非最適化機械語オブジェクトに挿入されたブレークポイント処理コードを削除する。この動きについて図10を例に説明すると、アドレステーブル24の識別番号2用アドレス欄は「9000」から「1000」に再び更新され、識別番号2の非最適化機械語オブジェクトの2行目に挿入されたブレーク処理コードが削除される。このようにして、PLC200はデバッグ状態から通常時の状態(運用状態ともいう)に復帰し、最適化機械語オブジェクトの実行を再開する。   When receiving the debug end notification from the support apparatus 100, the PLC 200 switches the address table 24 from the debug address to the optimization address and deletes the breakpoint processing code inserted in the non-optimized machine language object. This operation will be described using FIG. 10 as an example. The address field for the identification number 2 in the address table 24 is updated again from “9000” to “1000”, and is inserted in the second line of the non-optimized machine language object with the identification number 2. The broken break processing code is deleted. In this way, the PLC 200 returns from the debug state to the normal state (also referred to as the operation state), and resumes execution of the optimized machine language object.

なお、デバッグ開始時に、デバッグ対象の非最適化機械語オブジェクトが既にPLC200に保存されているとき、PLC200は非最適化機械語オブジェクトが既に格納されていることを示す「有無情報」を支援装置100に送信し、支援装置100に非最適化機械語オブジェクトの送信を省略するよう促す。このようにして、無駄な通信時間を省くことができる。   Note that when the non-optimized machine language object to be debugged is already stored in the PLC 200 at the start of debugging, the PLC 200 provides “presence / absence information” indicating that the non-optimized machine language object is already stored. And the support apparatus 100 is prompted to omit transmission of the non-optimized machine language object. In this way, useless communication time can be saved.

以上説明したように、上記実施形態を一例とする本発明は、ソースコードをコンパイルする際に、最適化コンパイルのみを行なって、最適化機械語オブジェクトをPOU毎に生成し、これと同時にソースコード・識別番号対応表を作成する。そして、生成した最適化機械語オブジェクトに図7に示すような識別番号41及び種別42を付加してデータ送信部14からPLC200にダウンロードする。   As described above, according to the present invention taking the above embodiment as an example, when compiling source code, only optimization compilation is performed to generate an optimized machine language object for each POU, and at the same time, source code・ Create an identification number correspondence table. Then, an identification number 41 and a type 42 as shown in FIG. 7 are added to the generated optimized machine language object and downloaded from the data transmission unit 14 to the PLC 200.

すなわち、本発明は、コンパイラ12でソースコードを最適化コンパイルして最適化機械語オブジェクトのみを生成し、生成した最適化機械語オブジェクトをPLC200にダウンロードするので、ダウンロードに要する時間を必要最小限とすることができる。また、PLC200は、ダウンロードされた最適化機械語オブジェクトを実行するのでアプリケーションを高速に実行することができる。   That is, according to the present invention, the compiler 12 optimizes and compiles the source code, generates only the optimized machine language object, and downloads the generated optimized machine language object to the PLC 200. Therefore, the time required for downloading is minimized. can do. Further, since the PLC 200 executes the downloaded optimized machine language object, the application can be executed at high speed.

一方、デバッグ時において本発明は、デバッグ対象となる機械語オブジェクトのみをコンパイルして非最適化機械語オブジェクトを生成し、これとともにデバッグ情報をPLC200にダウンロードする。このようにすることにより、コンパイルおよびダウンロード時間を必要最小限とすることができ、効率の良いソフトウェア開発を支援することができる。   On the other hand, at the time of debugging, the present invention compiles only a machine language object to be debugged to generate a non-optimized machine language object, and downloads debugging information to the PLC 200 together with the non-optimized machine language object. By doing so, compilation and download time can be minimized, and efficient software development can be supported.

また、本発明は、ブレークに代わりトレースも実行可能である。トレースとは所定の起点から監視対象の変数の値を時系列で表示する機能、すなわち所定のトリガ条件を起点としてデータをロギングする機能である。例えば、このロギングはプログラムの実行過程などにおけるレジスタの値を収集することなどである。言い換えれば、本発明は最適化機械語オブジェクトを実行することによりプログラム実行速度の高速化を図るPLCにおいて、そのプログラム実行速度を維持し実運用状態でデバッグするという課題を解決することもできる。   The present invention can also execute a trace instead of a break. The trace is a function for displaying the value of a variable to be monitored in a time series from a predetermined starting point, that is, a function for logging data starting from a predetermined trigger condition. For example, this logging includes collecting register values in a program execution process or the like. In other words, the present invention can solve the problem of maintaining the program execution speed and debugging in the actual operation state in the PLC that increases the program execution speed by executing the optimized machine language object.

上述の如くブレーク処理においては非最適化機械語オブジェクトをPLCに実行させるため、最適化機械語オブジェクトを実行している通常の実行速度に対してそのプログラム実行速度は低下する。また、ブレーク条件が成立するとプログラムが停止されるので実運用の検証には得策とは言えず、PLCが実運用中でないとき(オフライン)の論理検証に適している。これに対し、トレースはPLCを停止させないので実運用でのデバッグ(実運用検証)に適している。   As described above, in the break processing, since the non-optimized machine language object is executed by the PLC, the program execution speed is lower than the normal execution speed at which the optimized machine language object is executed. In addition, since the program is stopped when the break condition is satisfied, it is not a good measure for verification of actual operation, and is suitable for logic verification when the PLC is not in actual operation (offline). On the other hand, since the trace does not stop the PLC, it is suitable for debugging in actual operation (verification of actual operation).

以下、本発明のトレースについて、その実行方法を説明する。
(トレースを目的としたデバッグにおける支援装置100の動作)
ユーザは要求するデバッグモードとして図5のトレース処理のラジオボタンを選択し開始ボタン32を選択する。そして、ユーザはトレースの開始条件としてトリガ条件を設定するが、このトリガ条件は前述ブレークポイントの設定の要領と同じように設定される。すなわち、トレースの開始ポイントをブレークポイントの設定と同じようにユーザがソースコード上に設定し、この設定を基に支援装置100は図8に示すデバッグ情報を抽出し、PLC200に送信する。このとき支援装置100は、デバッグ情報に加えて、選択されたデバッグモードがトレースであることを示すデバッグ処理パラメータをPLC200に送信し、PLC200の処理完了通知を待つ。以降の動きは前述ブレークの動きと同じである。
Hereinafter, the execution method of the trace of the present invention will be described.
(Operation of the support apparatus 100 in debugging for the purpose of tracing)
The user selects the trace processing radio button in FIG. 5 as the requested debug mode and selects the start button 32. Then, the user sets a trigger condition as a trace start condition, and this trigger condition is set in the same manner as the above-described breakpoint setting procedure. That is, the trace start point is set on the source code by the user in the same way as the breakpoint setting, and the support apparatus 100 extracts the debug information shown in FIG. 8 based on this setting and transmits it to the PLC 200. At this time, in addition to the debug information, the support apparatus 100 transmits a debug processing parameter indicating that the selected debug mode is trace to the PLC 200 and waits for a processing completion notification of the PLC 200. Subsequent movement is the same as the above-mentioned break movement.


(トレースを目的としたデバッグにおけるPLC200の動作)
選択されたデバッグ処理がトレースであることを示すデバッグ処理パラメータを受信したPLC200は、デバッグ情報を参照してトリガ条件を設定するが、上述の如く最適化機械語オブジェクトはプログラムの実行順序などが変更された可能性があるため、上述ブレークポイント処理コードのような所定の処理コードを最適化機械語オブジェクトに埋め込むことができない。

(Operation of PLC 200 in debugging for the purpose of tracing)
The PLC 200 that has received the debug process parameter indicating that the selected debug process is a trace sets the trigger condition with reference to the debug information. However, as described above, the execution order of the program is changed in the optimized machine language object. Therefore, a predetermined processing code such as the above breakpoint processing code cannot be embedded in the optimized machine language object.

本発明のデバッグ方法(トレース)の特徴点は、プログラムの実行を管理するオペレーション機能(プログラム実行管理部)がサイクリックに実行され最適化機械語オブジェクトを周期的(制御周期毎)に実行する点に着目して考案されたものである。具体的にはデバッグ情報の識別番号で指定される最適化機械語オブジェクトをオペレーション機能が呼び出し、その実行が終了した時点からトレースを開始するようにした点にある。このようにすることにより、最適化された機械語オブジェクトを実行するPLCにおいて、そのプログラム実行速度を低下させることがなく、PLCが運用状態のままデバッグが可能になる。   A feature of the debugging method (trace) of the present invention is that an operation function (program execution management unit) that manages program execution is cyclically executed to execute an optimized machine language object periodically (every control cycle). It was devised paying attention to. Specifically, the optimizing machine language object specified by the identification number of the debug information is called by the operation function, and tracing is started from the point when the execution is completed. By doing so, in the PLC that executes the optimized machine language object, debugging can be performed while the PLC is in an operating state without reducing the program execution speed.

図11はトレースの際のPLC200の動作概念図である。他の図と同符号のものは同構成である。この図はユーザプログラムメモリ213に識別番号「1」、識別番号「2」それぞれの最適化機械語オブジェクトと非最適化機械語オブジェクトを登録済みであり、識別番号が「2」のデバッグ情報(トレース指示)を支援装置100から受信した例である。トレースが指示された場合、デバッグ情報の「ブレーク位置」は適用されない。   FIG. 11 is a conceptual diagram of the operation of the PLC 200 during tracing. Components having the same reference numerals as those in other drawings have the same configuration. This figure shows that the optimized machine language object and the non-optimized machine language object of the identification number “1” and the identification number “2” have been registered in the user program memory 213, and the debug information (the trace is “2”). (Instruction) is received from the support apparatus 100. When tracing is instructed, the “break position” of the debug information is not applied.

デバッグ情報を受けたPLC200のデバッグ制御部26は、デバッグ情報の識別番号が「2」なので、識別番号「2」の最適化機械語オブジェクトを呼び出すコール命令をオペレーション機能の中のプログラムコードから抽出する。この抽出は、例えば、前述識別番号「2」をオペランドとするコール命令を検索することで達成される。そして、デバッグ制御部26は前述抽出されたコール命令の後にトレース処理を実行するためのトレース処理実行コード(トレース命令)をオペレーション機能内に挿入する。つまり、デバッグ制御部26は挿入したトレース処理実行コードをオペレーション機能に実行させることにより、オペレーション機能が順次実行するメインルーチンからトレース処理を実行させるように切り替える。   The debug control unit 26 of the PLC 200 that has received the debug information extracts the call instruction for calling the optimized machine language object with the identification number “2” from the program code in the operation function because the identification number of the debug information is “2”. . This extraction is achieved, for example, by searching for a call instruction having the identification number “2” as an operand. Then, the debug control unit 26 inserts a trace process execution code (trace instruction) for executing the trace process into the operation function after the extracted call instruction. In other words, the debug control unit 26 causes the operation function to execute the inserted trace processing execution code, thereby switching the main routine sequentially executed by the operation function to execute the trace processing.

そして、オペレーション機能はメインルーチンのプログラムを順次実行する際、挿入されたトレース処理実行コードを実行しトレース機能を呼び出す。呼び出されたトレース機能はプログラムの実行ログを不図示の記憶領域に格納する。そして、PLC200はトレース結果出力部によって前述実行ログを支援装置100に送信する。   When the operation function sequentially executes the main routine program, the operation function executes the inserted trace processing execution code to call the trace function. The called trace function stores a program execution log in a storage area (not shown). Then, the PLC 200 transmits the execution log to the support device 100 by the trace result output unit.

すなわち、オペレーション機能はプログラムを順次実行する際、識別番号「2」の最適化機械語オブジェクトを呼び出す。プログラム実行部27は、識別番号「2」の最適化機械語オブジェクトの呼び出しを受け、アドレステーブル24に登録されたデータを間接アドレス指定して識別番号「2」の最適化機械語オブジェクトを実行する。そして、プログラム実行部27は識別番号「2」の最適化機械語オブジェクトの実行が終了するとその完了をオペレーション機能に伝える。最適化機械語オブジェクトの実行の完了が伝えられたオペレーション機能は前述挿入されたトレース処理実行コードを実行してトレース機能を呼び出す。呼び出されたトレース機能はプログラムの実行ログを不図示の記憶領域に格納し、この実行ログをトレース結果出力部が支援装置100に送信する。   That is, the operation function calls the optimized machine language object with the identification number “2” when the program is sequentially executed. The program execution unit 27 receives the call of the optimized machine language object having the identification number “2”, indirectly specifies the data registered in the address table 24, and executes the optimized machine language object having the identification number “2”. . Then, when the execution of the optimized machine language object with the identification number “2” is completed, the program execution unit 27 notifies the operation function of the completion. The operation function notified of the completion of the execution of the optimized machine language object executes the inserted trace processing execution code and calls the trace function. The called trace function stores a program execution log in a storage area (not shown), and the trace result output unit transmits the execution log to the support apparatus 100.

そして、PLC200は処理完了通知を支援装置100に送信し、支援装置100からのデバッグ終了通知を待つ。
デバッグ終了通知を受信するとデバッグ制御部26は、オペレーション機能内に挿入したトレース処理実行コードを削除し、トレースを終了する。
Then, the PLC 200 transmits a process completion notification to the support device 100 and waits for a debug end notification from the support device 100.
When receiving the debug end notification, the debug control unit 26 deletes the trace processing execution code inserted in the operation function and ends the trace.


以上説明したように、本発明はソースコード上にブレークポイントもしくはトリガ条件が設定され、デバッグモードとしてブレークが選択されたときデバッグ情報を生成し、PLC200に送信する。この送信の際、デバッグ対象の非最適化機械語オブジェクトが既にPLC200に格納されていればデバッグ情報のみを送信する、一方デバッグ対象の非最適化機械語オブジェクトが既にPLC200に格納されていなければ支援装置100は非最適化機械語オブジェクト15とデバッグ情報の両方をPLC200に送信する。

As described above, according to the present invention, when breakpoints or trigger conditions are set on the source code and a break is selected as the debug mode, debug information is generated and transmitted to the PLC 200. In this transmission, if the non-optimized machine language object to be debugged is already stored in the PLC 200, only the debug information is transmitted. On the other hand, if the non-optimized machine language object to be debugged is not already stored in the PLC 200, support is provided. The apparatus 100 transmits both the non-optimized machine language object 15 and the debug information to the PLC 200.

PLC200は非最適化機械語オブジェクトを受信すると内部メモリに転送し、デバッグ情報に応じて、内部メモリに転送された非最適化機械語オブジェクトにブレークポイント処理コード(ブレーク命令)を挿入し、該非最適化機械語オブジェクトを実行するようアドレステーブル24を変更する。そして、PLC200は挿入されたブレークポイント処理コードを実行した際、ブレークする。   When receiving the non-optimized machine language object, the PLC 200 transfers the non-optimized machine language object to the internal memory, and inserts a breakpoint processing code (break instruction) into the non-optimized machine language object transferred to the internal memory according to the debug information. The address table 24 is changed to execute the computerized machine language object. Then, the PLC 200 breaks when the inserted breakpoint processing code is executed.

一方、デバッグモードとしてトレースが選択されたとき、支援装置100は、ユーザにより設定されたトリガ条件を基にデバッグ情報を生成し、PLCに送信する。PLCは受信したデバッグ情報を基に、デバッグ対象の最適化機械語オブジェクトを特定し、この最適化機械語オブジェクトの実行が完了した時点でトレース機能を呼び出し、このタイミングを起点にプログラムの実行をトレースする。そして、このトレース結果を支援装置100に送信する。   On the other hand, when the trace is selected as the debug mode, the support apparatus 100 generates debug information based on the trigger condition set by the user and transmits the debug information to the PLC. The PLC identifies the optimization machine language object to be debugged based on the received debug information, calls the trace function when execution of this optimization machine language object is completed, and traces program execution starting from this timing. To do. Then, the trace result is transmitted to the support apparatus 100.

このようにすることで、本発明は最適化機械語オブジェクトを実行して高速化を図ったPLCのデバッグ作業の効率を向上させるとともに、PLCが運用状態で、その高速化されたプログラムの実行速度を維持したままデバッグすることができる。   In this way, the present invention improves the efficiency of the debugging work of the PLC that has been accelerated by executing the optimized machine language object, and at the same time, the execution speed of the accelerated program while the PLC is operating. You can debug while maintaining

なお、運用状態とデバッグとの相互の切り替えタイミング、すなわちアドレステーブル24の更新タイミング、そしてトレース処理実行コードやブレークポイント処理コードの挿入・削除のタイミングは、PLC200が制御機器300を制御するための制御周期(オペレーション機能の実行が一巡するサイクリック周期)に同期して実行されることが望ましい。PLC200には複数のPOUが保存されており、PLC200はこれらPOUの処理結果を連携して演算しこの演算結果を使って制御機器300を制御している。このため、本発明は制御周期に同期してアドレステーブル24を更新するとともに、トレース処理実行コードやブレークポイント処理コードの挿入や削除を行うことにより、それぞれのPOUの入出力処理の連携を保ち、制御の影響を最小限にしている。   Note that the switching timing between the operation state and the debugging, that is, the update timing of the address table 24, and the timing of insertion / deletion of the trace processing execution code and breakpoint processing code are the controls for the PLC 200 to control the control device 300. It is desirable to execute in synchronization with the cycle (cyclic cycle in which the execution of the operation function makes a round). A plurality of POUs are stored in the PLC 200, and the PLC 200 calculates the processing results of these POUs in cooperation and controls the control device 300 using the calculation results. For this reason, the present invention updates the address table 24 in synchronization with the control cycle and inserts or deletes the trace processing execution code or breakpoint processing code, thereby maintaining the cooperation of the input / output processing of each POU, Minimize control effects.

また、上記実施例において、ユーザプログラムメモリはRAMなどの揮発性メモリに限定することはなく、フラッシュメモリなどの書き換え可能な不揮発性メモリで構成してもよい。   In the above embodiment, the user program memory is not limited to a volatile memory such as a RAM, but may be a rewritable nonvolatile memory such as a flash memory.

また、上述デバッグ情報は機械語オブジェクト(プログラム)を特定し、所定箇所にパッチ処理を挿入するための情報とも言える。
また、支援装置100は図8に示すデバッグ情報をPLC200に送信する際、図5に示すラジオボタン(ブレーク処理もしくはトレース処理)の選択情報を送信パケットに含ませてPLC200に送信している。PLC200は支援装置100からデバッグ情報を受信した際、前述送信パケットに含まれる選択情報を参照し、デバッグ情報がブレーク指示なのかトレース指示なのかを把握できるように構成されている。
The debug information can also be said to be information for specifying a machine language object (program) and inserting patch processing at a predetermined location.
Further, when transmitting the debug information illustrated in FIG. 8 to the PLC 200, the support apparatus 100 transmits the selection information of the radio button (break process or trace process) illustrated in FIG. When receiving debug information from the support device 100, the PLC 200 is configured to refer to the selection information included in the transmission packet and grasp whether the debug information is a break instruction or a trace instruction.

また、オペレーション機能(プログラム実行管理部)はファームウェアに相当するプログラムであり、最適化されてないデバッグ可能なプログラムである。   The operation function (program execution management unit) is a program corresponding to firmware, and is a non-optimized debuggable program.

100…支援装置、200…プログラマブルコントローラ、300…制御機器
11…ユーザインタフェース部、12…コンパイラ、13…最適化機械語オブジェクト、14…通信部、15…非最適化機械語オブジェクト
21…通信部、22…最適化機械語オブジェクト、23…非最適化機械語オブジェクト、24…アドレステーブル、25…オブジェクト展開部、26…デバッグ制御部、27…プログラム実行部
41…識別番号、42…種別、43…機械語オブジェクト
51…識別番号、52…ブレーク位置
61…最適化機械語オブジェクト
61a,61b…最適化機械語オブジェクト(本体)
62…非最適化機械語オブジェクト
62a,62b…非最適化機械語オブジェクト(本体)

DESCRIPTION OF SYMBOLS 100 ... Support apparatus, 200 ... Programmable controller, 300 ... Control apparatus 11 ... User interface part, 12 ... Compiler, 13 ... Optimization machine language object, 14 ... Communication part, 15 ... Non-optimization machine language object 21 ... Communication part, DESCRIPTION OF SYMBOLS 22 ... Optimization machine language object, 23 ... Non-optimization machine language object, 24 ... Address table, 25 ... Object expansion part, 26 ... Debug control part, 27 ... Program execution part 41 ... Identification number, 42 ... Type, 43 ... Machine language object 51 ... Identification number, 52 ... Break position 61 ... Optimization machine language object 61a, 61b ... Optimization machine language object (main body)
62 ... Non-optimized machine language object 62a, 62b ... Non-optimized machine language object (main body)

Claims (6)

最適化機械語オブジェクトを保持する第一の記憶領域と、
前記最適化機械語オブジェクトの先頭アドレスが登録されるテーブルと、
前記テーブルに登録された前記先頭アドレスを指定して前記最適化機械語オブジェクトを実行するプログラム実行部と、
このプログラム実行部をサイクリックに呼び出し前記最適化機械語オブジェクトを実行するプログラム実行管理部と、
トレース指示に基づき、前記プログラム実行管理部の前記プログラム実行部の呼び出し後にトレース処理に切り替えるデバッグ制御部と、
前記トレース処理の実行結果を出力するトレース結果出力部と、
前記最適化機械語オブジェクトに対応した非最適化機械語オブジェクトを保持する第二の記憶領域と、を備え、
前記デバッグ制御部は、オブジェクトの実行の停止位置を含むブレーク指示が与えられると前記停止位置に基づき前記非最適化機械語オブジェクトにブレーク命令を挿入するとともに前記非最適化機械語オブジェクトの先頭アドレスを前記テーブルに登録するブレーク実行手段をさらに備え、
前記プログラム実行部は、前記ブレーク実行手段によって登録された前記非最適化機械語オブジェクトの先頭アドレスを指定して前記非最適化機械語オブジェクトを実行し、該非最適化機械語オブジェクトに挿入された前記ブレーク命令の実行に伴い、前記非最適化機械語オブジェクトの実行を停止し、この停止情報を出力することを特徴とするプログラマブルコントローラ。
A first storage area for holding the optimized machine language object;
A table in which the start address of the optimized machine language object is registered;
A program execution unit that executes the optimized machine language object by designating the head address registered in the table;
A program execution management unit that cyclically calls the program execution unit and executes the optimized machine language object;
Based on a trace instruction, a debug control unit that switches to trace processing after calling the program execution unit of the program execution management unit;
A trace result output unit for outputting the execution result of the trace processing;
A second storage area for holding a non-optimized machine language object corresponding to the optimized machine language object,
When a break instruction including an execution stop position of an object is given, the debug control unit inserts a break instruction into the non-optimized machine language object based on the stop position and sets the start address of the non-optimized machine language object. A break execution means for registering in the table;
The program execution unit executes the non-optimized machine language object by designating a start address of the non-optimized machine language object registered by the break execution means, and the program execution unit inserted into the non-optimized machine language object A programmable controller characterized by stopping execution of the non-optimized machine language object and outputting the stop information in accordance with execution of a break instruction.
請求項1記載のプログラマブルコントローラにおいて、
前記デバッグ制御部は、前記トレース指示に基づき前記プログラム実行管理部の前記最適化機械語オブジェクトの呼出し命令を抽出し、該抽出された呼び出し命令の後に前記トレース処理を呼び出すトレース命令を挿入し、前記プログラム実行管理部に前記トレース命令を実行させることにより前記トレース処理に切り替えることを特徴とするプログラマブルコントローラ。
The programmable controller according to claim 1,
The debug control unit extracts a call instruction of the optimized machine language object of the program execution management unit based on the trace instruction, and inserts a trace instruction for calling the trace process after the extracted call instruction, A programmable controller characterized by switching to the trace processing by causing a program execution management unit to execute the trace instruction.
請求項1または請求項2記載のプログラマブルコントローラにおいて、
前記ブレーク指示は前記プログラマブルコントローラと通信部を介して接続される支援装置から与えられ、
前記デバッグ制御部は前記非最適化機械語オブジェクトへのブレーク命令の挿入に先立ち、前記非最適化機械語オブジェクトが前記プログラマブルコントローラに既に登録されているかを示す有無情報を前記支援装置に送信し、この送信の後に前記支援装置から前記非最適化機械語オブジェクトを受信することにより該受信した非最適化機械語オブジェクトを前記第二の記憶領域に転送することを特徴とするプログラマブルコントローラ。
The programmable controller according to claim 1 or 2 ,
The break instruction is given from a support device connected to the programmable controller via a communication unit,
Prior to insertion of a break instruction into the non-optimized machine language object, the debug control unit transmits presence / absence information indicating whether the non-optimized machine language object is already registered in the programmable controller to the support device, A programmable controller comprising: receiving the non-optimized machine language object from the support device after the transmission; and transferring the received non-optimized machine language object to the second storage area.
請求項記載のプログラマブルコントローラにおいて、
前記支援装置は所定のソースコードをコンパイルするコンパイル手段を有し、
該コンパイル手段は前記ブレーク指示を含むデバッグ開始指示を受けると、前記有無情報の返信を要求するコマンドを前記プログラマブルコントローラに送信し、この送信に対する前記有無情報を含む応答を前記プログラマブルコントローラから受信し、
この受信された前記有無情報を参照して前記非最適化機械語オブジェクトが前記プログラマブルコントローラに既に登録されていることを確認し、この確認の結果、前記非最適化機械語オブジェクトが前記プログラマブルコントローラに既に登録されていることが確認されると前記ソースコードをコンパイルせず前記非最適化機械語オブジェクトを未生成とし、前記有無情報を参照した結果、前記非最適化機械語オブジェクトが前記プログラマブルコントローラに登録されてないことが確認されると前記ソースコードをコンパイルして前記非最適化機械語オブジェクトを生成し、該生成された非最適化機械語オブジェクト
を前記プログラマブルコントローラに送信することを特徴とするプログラマブルコントローラ。
The programmable controller according to claim 3 ,
The support device has a compiling unit for compiling a predetermined source code,
When receiving a debug start instruction including the break instruction, the compiling means transmits a command requesting a return of the presence information to the programmable controller, and receives a response including the presence information for the transmission from the programmable controller.
With reference to the received presence / absence information, it is confirmed that the non-optimized machine language object is already registered in the programmable controller. As a result of the confirmation, the non-optimized machine language object is transferred to the programmable controller. When it is confirmed that it has already been registered, the source code is not compiled, the non-optimized machine language object is not generated, and the presence / absence information is referred to. As a result, the non-optimized machine language object is transferred to the programmable controller. When it is confirmed that the source code is not registered, the source code is compiled to generate the non-optimized machine language object, and the generated non-optimized machine language object is transmitted to the programmable controller. Programmable controller.
請求項2記載のプログラマブルコントローラにおいて、
前記デバッグ制御部は前記トレース命令を前記サイクリックの周期に同期して挿入し、トレース解除指示が与えられると前記プログラム実行管理部に挿入した前記トレース命令を前記サイクリックの周期に同期して削除することを特徴とするプログラマブルコントローラ。
The programmable controller according to claim 2 , wherein
The debug control unit inserts the trace instruction in synchronization with the cyclic period, and deletes the trace instruction inserted in the program execution management unit in synchronization with the cyclic period when a trace release instruction is given. A programmable controller characterized by:
請求項記載のプログラマブルコントローラにおいて、
前記デバッグ制御部は前記ブレーク命令を前記サイクリックの周期に同期して挿入し、
ブレーク解除指示が与えられると前記サイクリックの周期に同期して前記非最適化機械語オブジェクトに挿入した前記ブレーク命令を削除するとともに前記テーブルに前記最適化機械語オブジェクトの先頭アドレスを登録することを特徴とするプログラマブルコントローラ。
The programmable controller according to claim 1 ,
The debug control unit inserts the break instruction in synchronization with the cyclic period,
When a break release instruction is given, the break instruction inserted in the non-optimized machine language object is deleted in synchronization with the cyclic period, and the start address of the optimized machine language object is registered in the table. A programmable controller.
JP2011156328A 2011-07-15 2011-07-15 Programmable controller Active JP5800135B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011156328A JP5800135B2 (en) 2011-07-15 2011-07-15 Programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011156328A JP5800135B2 (en) 2011-07-15 2011-07-15 Programmable controller

Publications (2)

Publication Number Publication Date
JP2013025347A JP2013025347A (en) 2013-02-04
JP5800135B2 true JP5800135B2 (en) 2015-10-28

Family

ID=47783675

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011156328A Active JP5800135B2 (en) 2011-07-15 2011-07-15 Programmable controller

Country Status (1)

Country Link
JP (1) JP5800135B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5849592B2 (en) * 2011-10-07 2016-01-27 富士電機株式会社 Programmable controller system, programming device thereof, programmable controller, program, and debugging method
JP5957936B2 (en) * 2012-02-15 2016-07-27 富士電機株式会社 Programmable controller system, its support device, program
CN105408823B (en) 2014-05-08 2017-07-18 三菱电机株式会社 Engineering tools, program editing device and program editing system
KR101743836B1 (en) 2015-10-22 2017-06-07 엘에스산전 주식회사 debugging method of programmable logic controller which uses general purpose microprocessor
WO2024069730A1 (en) * 2022-09-27 2024-04-04 三菱電機株式会社 Debugging device and debugging method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10247105A (en) * 1997-03-05 1998-09-14 Yaskawa Electric Corp Programmable controller
JP2006202233A (en) * 2005-01-24 2006-08-03 Fuji Electric Fa Components & Systems Co Ltd Controller and program for same

Also Published As

Publication number Publication date
JP2013025347A (en) 2013-02-04

Similar Documents

Publication Publication Date Title
KR101558832B1 (en) Sequence-program debugging assistance apparatus
JP5800135B2 (en) Programmable controller
JP4877068B2 (en) Software development support program, software development support method
CN101681280B (en) In-process debugging using external debugging infrastructure
US20150212923A1 (en) Nontransitory processor readable recording medium having fault injection program recorded therein and fault injection method
US20070226702A1 (en) Method for operating a microcontroller in a test environment
US10789192B2 (en) System and method for programming data transfer within a microcontroller
CN106021101B (en) The method and device that mobile terminal is tested
JP5636783B2 (en) Programmable controller and method for debugging programmable controller
KR20120139403A (en) Device and method for executing and managing job file of game server
JP2009146229A (en) Programmable controller system
JP5849592B2 (en) Programmable controller system, programming device thereof, programmable controller, program, and debugging method
CN112463139A (en) Programming method and device based on electronic building blocks, electronic equipment and storage medium
WO2014136228A1 (en) Programmable controller, programmable controller system, and execute error information creation method
JP2008135008A (en) Program module verification method
JP5589670B2 (en) How to debug
CN108614704B (en) Code compiling method and device
CN110647349A (en) Method for realizing continuous delivery of iOS APP
CN105653333B (en) Programmable logic controller user program online modification system and method
JP2007004516A (en) Program debugging method of built-in system
JP4853998B2 (en) Debugger device and debugging method using the debugger device
KR100294633B1 (en) Simulator of plc
JP5120103B2 (en) Debugging method and debugging program
JP2011216056A (en) Programmable controller and peripheral device thereof
JP2007188366A (en) Compiler

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140616

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20150316

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20150324

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150410

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20150729

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150811

R150 Certificate of patent or registration of utility model

Ref document number: 5800135

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250