JP2006202233A - Controller and program for same - Google Patents

Controller and program for same Download PDF

Info

Publication number
JP2006202233A
JP2006202233A JP2005016122A JP2005016122A JP2006202233A JP 2006202233 A JP2006202233 A JP 2006202233A JP 2005016122 A JP2005016122 A JP 2005016122A JP 2005016122 A JP2005016122 A JP 2005016122A JP 2006202233 A JP2006202233 A JP 2006202233A
Authority
JP
Japan
Prior art keywords
program
stored
memory
control
change request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2005016122A
Other languages
Japanese (ja)
Inventor
Yukiteru Yuo
幸輝 湯尾
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 FA Components and Systems Co Ltd
Original Assignee
Fuji Electric FA Components and Systems 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 FA Components and Systems Co Ltd filed Critical Fuji Electric FA Components and Systems Co Ltd
Priority to JP2005016122A priority Critical patent/JP2006202233A/en
Publication of JP2006202233A publication Critical patent/JP2006202233A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To batch update a plurality of control programs at run time. <P>SOLUTION: Control programs PG3' and PG9' that are update versions of control programs PG3 and PG9 are stored in a free area of a program memory 23. This can be done independently even while PG3 or PG9 is executed. The storage locations of PG3' and PG9' are stored in a program change request queue 22. During later scan end processing, by reference to the queue 22, a program information table 21 is updated sequentially about PG3 and PG9. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、プログラマブルコントローラのユーザプログラム更新において、特に、プログラマブルコントローラの運転中に複数のプログラムを更新する手法に関する。   The present invention relates to a method for updating a plurality of programs during operation of a programmable controller, particularly in updating a user program of a programmable controller.

プログラマブルコントローラは、FA(Factory Automation)などの用途に使われるコンピュータであり、その適用システムは、ユーザの要求仕様により、24時間稼動など極力停止が望まれないシステムが多く存在する。   A programmable controller is a computer used for applications such as FA (Factory Automation), and there are many systems that are not desired to be stopped as much as possible, such as 24-hour operation, depending on user-specified specifications.

しかしながら、システムで稼動するユーザプログラムは、ユーザの単純なプログラムミスや動作仕様の変更、機器の経年変化による設定値の変更など、さまざまな理由により、プログラムの更新が要求される。   However, the user program running in the system is required to be updated for various reasons such as a simple program mistake of the user, a change in operation specifications, and a change in setting value due to aging of the device.

これらの条件を満たすため、プログラマブルコントローラにおいては、コントローラの運転中のプログラム更新(以下RUN中更新と呼ぶ)機能が具備されているものがある。
現在、一般的に行われているRUN中更新には、その変更範囲からおおよそ以下の3パターンが考えられる。
In order to satisfy these conditions, some programmable controllers have a program update function (hereinafter referred to as RUN update) during operation of the controller.
Currently, the following three patterns can be considered for the update during RUN that is generally performed from the change range.

すなわち
・プログラム内の1命令(ステップ)単位で命令を置き換える。
・複数あるプログラムのうちの1プログラムを全て変更する。
・ひとつのプログラマブルコントローラにある複数のプログラムを同時に変更する。
である。
That is, instructions are replaced in units of one instruction (step) in the program.
・ Change all programs in the program.
・ Change multiple programs in one programmable controller at the same time.
It is.

近年のプログラマブルコントローラのメモリ容量大型化、処理の高速化により、ひとつのコントローラが同時に扱えるプログラムの本数は増加してきており、複数プログラムのRUN中同時更新機能は、その必要度が高くなりつつある。   With the recent increase in memory capacity and processing speed of programmable controllers, the number of programs that can be handled simultaneously by a single controller has increased, and the necessity for the simultaneous update function during RUN of multiple programs is increasing.

このような複数プログラムのRUN中同時更新の問題を解決するため、特許文献1においては、コントローラ上にプログラムコード用メモリを2バンクもち、いずれかのプログラムコード用メモリを書き換え、プログラム格納バンクテーブルを変更することで、複数プログラムを同時更新する手法が提案されている。   In order to solve such a problem of simultaneous updating of a plurality of programs during RUN, Patent Document 1 has two banks of program code on the controller, rewrite one of the program code memories, and store a program storage bank table. A method for simultaneously updating a plurality of programs by changing them has been proposed.

しかしながら、ただでさえプログラム容量の大型化により大容量メモリが必要とされている中にあって、RUN中更新機能のためだけに普段使用しないメモリ(プログラムメモリと同サイズ)を持つことは、価格等の面で不利である。   However, even if a large-capacity memory is required due to an increase in program capacity, it is difficult to have memory that is not normally used only for the update function during RUN (the same size as the program memory). This is disadvantageous.

これに対して、特許文献2においては、実際のコントローラの実行コードであるプログラムを格納する領域と、各プログラムの先頭アドレスを示したテーブルを持ち、更新プログラムをプログラム格納領域に書き込み完了した時点で、プログラムアドレステーブルのアドレスを変更する手法を提案している。
特開平10−207512号公報 特開2001−142510号公報
On the other hand, Patent Document 2 has an area for storing a program that is an execution code of an actual controller and a table indicating the start address of each program, and when an update program has been written to the program storage area A method for changing the address of the program address table is proposed.
Japanese Patent Laid-Open No. 10-207512 JP 2001-142510 A

しかしながら、上記特許文献2の手法では、複数プログラムのRUN中同時更新を行うことは考えられない(特許文献1では行えるが、上記の通り、大容量メモリが必要とされるという問題が生じる)。すなわち、特許文献2ではPOUを格納領域に格納し終わったことを条件にPOUアドレステーブルを更新しているのであり、1つのPOUの更新のみを考えている。もし複数POU同時(一括)更新するならば、POUだけでなく何らかの追加の情報(例えば一括で更新したいPOUのリスト等)も一緒にコントローラ側に渡す必要がある。そうでなければ、コントローラ側では、どのタイミングでPOUアドレステーブルを置き換えてよいのか判断できない。あるいは、上記の通り、POUを格納領域に格納し終わるとPOUアドレステーブルを更新するので、例えばあるPOUのバージョンアップ版等を、このPOUの実行中に格納領域に格納した場合、問題が生じる可能性がある。   However, with the method of Patent Document 2, it is not considered to perform simultaneous updating of a plurality of programs during RUN (Although it can be performed in Patent Document 1, a problem arises that a large-capacity memory is required as described above). That is, in Patent Document 2, the POU address table is updated on the condition that the POU has been stored in the storage area, and only updating of one POU is considered. If a plurality of POUs are updated simultaneously (collectively), it is necessary to pass not only the POU but also some additional information (for example, a list of POUs to be updated collectively) to the controller side. Otherwise, the controller cannot determine when the POU address table can be replaced. Alternatively, as described above, the POU address table is updated when the POU has been stored in the storage area. For example, if an upgraded version of a POU is stored in the storage area during execution of this POU, a problem may occur. There is sex.

更に、上記特許文献2に記載の手法においては、プログラムのRUN中更新を繰り返していくうちに、プログラム格納領域の空き領域が細かく分断され、その分断された領域に更新プログラムを格納するために、ひとつのプログラムを空き領域にあわせ分割し、分割された個々のプログラム同士は新たにジャンプ命令を挿入することで、接続しようとしている。このようなやり方は実現可能ではあるが、支援ツール側で生成する場合、他の支援ツールで支援が不可能になる、コントローラ側で実現した場合、プログラム格納領域の空き領域管理、ジャンプ命令の生成、もともとのプログラムに存在するジャンプ命令のとび先アドレスの付け替えなど処理が重くなり、現実的ではない。   Furthermore, in the method described in the above-mentioned Patent Document 2, in order to store the update program in the divided area as the free area of the program storage area is divided finely while the updating of the program during RUN is repeated. One program is divided into empty areas, and the divided individual programs are connected by inserting a jump instruction. Such a method is feasible, but if it is generated on the support tool side, it cannot be supported on other support tools. If it is realized on the controller side, it manages free space in the program storage area and generates jump instructions. The processing such as changing the jump destination address of the jump instruction existing in the original program becomes heavy, which is not realistic.

本発明の課題は、プログラマブルコントローラにおけるRUN中更新に係り、大容量メモリ(2バンクメモリ)を必要とすることなく複数プログラムの一括更新を可能にし、あるいは更にプログラムメモリ上の空き領域を分断させることのないようにし、更新版プログラムを格納済みプログラム群の最後尾に追加すれば済むようにできるプログラマブルコントローラを提供することである。   An object of the present invention relates to updating during a RUN in a programmable controller, and enables a batch update of a plurality of programs without requiring a large-capacity memory (two-bank memory), or further divides an empty area in a program memory. It is an object of the present invention to provide a programmable controller that can be configured so that an updated program is added to the end of a stored program group.

本発明によるプログラマブルコントローラは、複数の制御プログラムを格納するプログラムメモリと、該プログラムメモリに格納されている各制御プログラムの格納位置を記憶するテーブルと、リードポインタとライトポインタを有するプログラム変更要求キューと、外部から、前記プログラムメモリに格納されている何れかの制御プログラムの更新版が送られてくると、該更新版の制御プログラムを前記プログラムメモリの空き領域に格納すると共に、該格納位置情報を前記プログラム変更要求キューに記憶すると共に前記ライトポインタを進める更新版プログラム受付手段と、スキャンエンド処理中に前記テーブルを更新するものであって、前記リードポインタの位置と前記ライトポインタの位置が一致しない場合には、更新要求有りと判定し、前記プログラム変更要求キューに格納されている前記更新版プログラムの格納位置情報を用いて、前記テーブルを更新するプログラム更新手段とを有するように構成する。   A programmable controller according to the present invention includes a program memory for storing a plurality of control programs, a table for storing a storage position of each control program stored in the program memory, a program change request queue having a read pointer and a write pointer, When an updated version of any control program stored in the program memory is sent from the outside, the updated version of the control program is stored in an empty area of the program memory, and the storage location information is Update program receiving means for storing in the program change request queue and advancing the write pointer, and updating the table during scan end processing, and the position of the read pointer does not match the position of the write pointer If there is an update request, Constant, and using the storage location information of the update program stored in the program change request queue and configured to have a program updating means for updating the table.

上記構成のプログラマブルコントローラは、更新版の制御プログラムを受信すると、これをプログラムメモリの空き領域に格納するが、直ちにテーブルを更新するのではなく、一旦、プログラム変更要求キューに、プログラム格納位置等を格納しておく。よって、この処理は、制御プログラム実行中であっても行える。また、更新版の制御プログラムが複数あってもよい。そして、スキャンエンド処理中に、プログラム変更要求キューを用いて、上記テーブルを更新する。更新版の制御プログラムが複数ある場合には、プログラム変更要求キューに複数分の格納位置情報を記憶しておき、スキャンエンド処理中に一括して更新できる。   When the programmable controller configured as described above receives the updated version of the control program, it stores it in the free space of the program memory, but does not immediately update the table, but temporarily sets the program storage location etc. in the program change request queue. Store it. Therefore, this process can be performed even while the control program is being executed. There may be a plurality of updated control programs. Then, the table is updated using the program change request queue during the scan end process. When there are a plurality of updated control programs, a plurality of storage location information can be stored in the program change request queue and updated at a time during the scan end process.

また、上記構成のプログラマブルコントローラにおいて、例えば、前記テーブルには各制御プログラムのサイズも格納されており、前記テーブルにおける各制御プログラムの格納位置とサイズとに基づいて、各制御プログラム間に空き領域が存在するか否かを判定し、空き領域が存在する場合には、前記プログラムメモリにおいて該空き領域の直後に格納されている制御プログラムを前詰めする空き領域調整手段とを更に有するように構成してもよい。   In the programmable controller configured as described above, for example, the size of each control program is also stored in the table, and based on the storage position and size of each control program in the table, there is an empty area between the control programs. It is determined whether or not there is an empty area, and when there is an empty area, the program memory further includes an empty area adjusting means for pre-packing a control program stored immediately after the empty area. May be.

また、この構成に関して、更に、前記プログラムメモリに格納されている制御プログラムを一時的に退避させる退避領域を更に有し、前記空き領域調整手段は、前記空き領域の直後に格納されている制御プログラムを該退避領域に退避させた後、該退避させた制御プログラムを前記空き領域の先頭から格納し直すことで前記前詰めを実現させるようにしてもよい。   In addition, regarding this configuration, the control program stored in the program memory is further provided with a save area for temporarily saving the control program stored in the program memory, and the free area adjusting means is stored immediately after the free area. May be realized by re-storing the saved control program from the beginning of the empty area after saving the program in the save area.

本発明のプログラマブルコントローラによれば、プログラマブルコントローラにおけるRUN中更新に係り、大容量メモリ(2バンクメモリ)を必要とすることなく複数プログラムの一括更新を可能にする。あるいは更にプログラムメモリ上の空き領域を分断させることのないようにし、更新版プログラムを格納済みプログラム群の最後尾に追加すれば済むようにできる。換言すれば、細かく分断された空き領域にあわせてプログラムを分割して格納する等の処理は必要なくなる。   According to the programmable controller of the present invention, it is possible to update a plurality of programs at once without requiring a large-capacity memory (two-bank memory) in connection with updating during RUN in the programmable controller. Alternatively, the free area on the program memory is not divided, and the updated version program can be added to the end of the stored program group. In other words, it is not necessary to perform processing such as dividing and storing the program in accordance with the finely divided free areas.

以下、図面を参照して、本発明の実施の形態について説明する。
図1は、本例で用いられるプログラマブルコントローラ・システムの概略構成図である。
Embodiments of the present invention will be described below with reference to the drawings.
FIG. 1 is a schematic configuration diagram of a programmable controller system used in this example.

図1において、コントローラ支援装置10は、ユーザが所望の制御プログラムを作成する為に入力を行う入力装置12と、この入力内容等を表示する表示装置11、および所定のアプリケーション・プログラムを記憶するための記憶媒体13等を有する。コンパイラ1は、コントローラ支援装置10で作成された制御プログラムを、コントローラ3(プログラマブル・コントローラ本体等)で実行できるコードに変換する。尚、図では、コンパイラ1とコントローラ支援装置10とを別に示しているが、これらは同一のハード(たとえばパソコン上)で構成されていてもよい。このようにして変換したプログラムコードを伝送装置2を介してコントローラ3に転送し、コントローラ3はこれを格納する。尚、以下の説明では、コンパイラ1及び伝送装置2に関しては省略して説明する。   In FIG. 1, a controller support device 10 stores an input device 12 on which a user performs input in order to create a desired control program, a display device 11 that displays the input contents, and a predetermined application program. Storage medium 13 or the like. The compiler 1 converts the control program created by the controller support device 10 into code that can be executed by the controller 3 (programmable controller main body or the like). In the figure, the compiler 1 and the controller support device 10 are separately shown, but they may be configured by the same hardware (for example, on a personal computer). The program code converted in this way is transferred to the controller 3 via the transmission device 2, and the controller 3 stores it. In the following description, the compiler 1 and the transmission device 2 will be omitted.

尚、コントローラ支援装置10は、例えばパソコン等のコンピュータにより実現されるものであり、従って特に図示していないが、当然、CPU、メモリ、通信インタフェース等も有しており、CPUが上記記憶媒体13に格納されている所定のアプリケーション・プログラムを読出し・実行することにより、ユーザに上記制御プログラム(コントローラ3で実行される、不図示の各種制御対象を制御する為のプログラムであり、例えば定周期プログラム等である)を作成させ、この制御プログラムを通信インタフェースを介してコントローラ3側に送信する処理を実行するものである。   Note that the controller support device 10 is realized by a computer such as a personal computer, and is not particularly shown in the figure. Of course, the controller support device 10 also has a CPU, a memory, a communication interface, and the like. By reading and executing a predetermined application program stored in the computer, the above control program (a program for controlling various control targets (not shown) executed by the controller 3) Etc.) and the process of transmitting this control program to the controller 3 side via the communication interface is executed.

同様に、コントローラ3も、特に図示していないが、CPU/MPU、メモリ等の記憶装置、通信インタフェース等を有している。この記憶装置は、例えば後述するプログラム情報テーブル21,51やプログラム変更要求キュー22を格納するメモリ(RAMやフラッシュメモリ等)や、制御プログラムを格納するプログラムメモリ23やシステム一時メモリ52等である。また、この記憶装置には、例えば後述する図4、図10等の処理を、CPU/MPU等により実行させる為のアプリケーション・プログラムも格納されている。   Similarly, the controller 3 includes a CPU / MPU, a storage device such as a memory, a communication interface, and the like, although not particularly illustrated. This storage device is, for example, a memory (RAM, flash memory, or the like) that stores program information tables 21 and 51 and a program change request queue 22 described later, a program memory 23 that stores a control program, a system temporary memory 52, or the like. The storage device also stores an application program for causing the CPU / MPU or the like to execute processes such as those shown in FIGS.

次に、コントローラ3における制御プログラムの格納方法について説明する。
コントローラ3は、図2(a)に示すプログラム情報テーブル21と、図2(b)に示すプログラム変更要求キュー22と、図2(c)に示すプログラムメモリ23を有する。
Next, a method for storing a control program in the controller 3 will be described.
The controller 3 includes a program information table 21 shown in FIG. 2A, a program change request queue 22 shown in FIG. 2B, and a program memory 23 shown in FIG.

図1のコンパイラで変換されコントローラ3にて実行可能なコードとなった制御プログラムは、上記不図示の通信インタフェースを介してコントローラ3側にロードされたら、図2(c)のプログラムメモリ23上に展開される。プログラムメモリ23上に置かれる制御プログラムは、登録された順番に前詰で展開されている。プログラムメモリ23に展開されている制御プログラムの番号とその格納場所の先頭アドレスは、図2(a)に示すプログラム情報テーブル21のプログラム番号21a、格納アドレス21bにそれぞれに格納される。尚、プログラム番号とは、図示のPG1、PG3のことであり、以下、各制御プログラムを、そのプログラム番号を用いて、例えばプログラムPG1等と呼ぶ場合がある。   When the control program converted by the compiler of FIG. 1 and converted into a code executable by the controller 3 is loaded on the controller 3 side via the communication interface (not shown), it is stored in the program memory 23 of FIG. Be expanded. The control program placed on the program memory 23 is expanded in the order in which it is registered. The number of the control program developed in the program memory 23 and the start address of the storage location are stored in the program number 21a and the storage address 21b of the program information table 21 shown in FIG. Note that the program numbers are PG1 and PG3 shown in the figure, and hereinafter, each control program may be referred to as, for example, a program PG1 or the like using the program numbers.

また、プログラム変更要求キュー22は、RUN中に複数の制御プログラムを一括更新する機能を実現するための構成であり、図示のリードポインタ31、ライトポインタ32を有している。これについて、図3を参照して説明する。   The program change request queue 22 has a configuration for realizing a function of updating a plurality of control programs at once during a RUN, and includes a read pointer 31 and a write pointer 32 shown in the figure. This will be described with reference to FIG.

図3は、コントローラのRUN中に2つのプログラム(PG3とPG9)の更新要求があった場合の例である。
すなわち、まず、コントローラ支援装置10側において、プログラムPG3及びPG9の更新版(バージョンアップ版、修正版等であり、旧バージョン等と区別する為、以下、PG3’、PG9’と記す)が作成される。そして、支援装置10は、このプログラムPG3’とPG9’とを、更新要求と共にコントローラ3側に送信する。これを受信したコントローラ3は、これら更新版の制御プログラム(PG3’、PG9’)を、旧版の制御プログラム(PG3、PG9)と入れ替える処理、すなわちプログラム更新処理を行う必要があるが、RUN中であるので、一旦、図3(c)に示すようにプログラムメモリ23の最後尾(格納済みプログラム領域の後)にこれら更新版の制御プログラム(PG3’、PG9’)を格納する。この格納処理の間は、制御処理等は既存の制御プログラム(PG3、PG9)によって動いているので、特に書き込みのタイミングを意識する必要はない。尚、プログラムメモリ23の記憶容量は、「全ての制御プログラムを格納できる容量+1つ以上の更新版プログラムを格納できる容量」が必要となるが、上記2バンク構成に比べれば、メモリ容量は少なくて済む。
FIG. 3 shows an example of a case where there are two program (PG3 and PG9) update requests during the RUN of the controller.
That is, first, on the controller support device 10 side, updated versions of the programs PG3 and PG9 (upgraded version, modified version, etc., which are hereinafter referred to as PG3 ′ and PG9 ′ in order to distinguish them from the old version) are created. The Then, the support apparatus 10 transmits the programs PG3 ′ and PG9 ′ to the controller 3 side together with the update request. The controller 3 that has received this needs to perform a process of replacing these updated control programs (PG3 ′, PG9 ′) with the old version control programs (PG3, PG9), that is, a program update process. Therefore, as shown in FIG. 3C, the updated control programs (PG3 ′, PG9 ′) are temporarily stored at the end of the program memory 23 (after the stored program area). During this storage process, the control process and the like are operated by the existing control program (PG3, PG9), so it is not particularly necessary to be aware of the write timing. The storage capacity of the program memory 23 needs to be “capacity that can store all control programs + 1 capacity that can store one or more updated programs”, but the memory capacity is small compared to the above-described two-bank configuration. That's it.

更新版の制御プログラム(PG3’、PG9’)の格納が完了したら、これらのプログラム番号(PG3、PG9)と、プログラムメモリ23における格納場所の先頭アドレス(ADR5、ADR6)とを、図3(b)に示す通りプログラム変更要求キュー22に書き込むと共に、そのライトポインタ32を進める(インクリメントする)。尚、プログラム番号は、旧版であっても更新版であっても同じである。上記PG3’、PG9’等の表記は、あくまでも本説明を分かり易くする為のものである。   When the storage of the updated control program (PG3 ′, PG9 ′) is completed, the program numbers (PG3, PG9) and the start addresses (ADR5, ADR6) of the storage locations in the program memory 23 are shown in FIG. As shown in (), the program change request queue 22 is written and the write pointer 32 is advanced (incremented). The program number is the same whether it is an old version or an updated version. The notations such as PG3 ', PG9', etc. are for easy understanding of the present description.

尚、本手法は複数プログラムの一括更新を実現するものであるから、キューへの書き込みが行われている間に(複数プログラム全てについて書き込み完了する前に)図4の処理が開始されてしまうと、不完全な形で更新が行われてしまう。よって、これを防止する為に、例えば、キューへの書き込みが完了するまでは、割り込み禁止にするか、あるいはキューへの書き込み処理の優先度を、図4の処理と同じかそれ以上とすることで、中途半端な更新が行われないようにすることが望ましい。   Since this method realizes batch update of a plurality of programs, if the processing of FIG. 4 is started while writing to the queue is performed (before writing is completed for all of the plurality of programs). The update will be done incompletely. Therefore, in order to prevent this, for example, interrupts are prohibited until the writing to the queue is completed, or the priority of the writing processing to the queue is set to be equal to or higher than the processing of FIG. Therefore, it is desirable to prevent halfway updates.

次にこのプログラム変更要求を認識し、制御プログラムの更新処理(つまり、プログラム情報テーブル21の格納内容の更新)を行うわけであるが、これは、全ての制御プログラムの実行が行われていないタイミングで行う必要がある。通常のコントローラ3は、プログラムへのデータ入力処理→プログラムの実行→プログラムからの結果出力処理を1スキャンとし、スキャンとスキャンの間にコントローラ3のシステムプログラムが処理を行う(以下、スキャンエンド処理という)。したがって、制御プログラムの更新処理は、スキャンエンド処理中に行う必要がある。   Next, this program change request is recognized, and the control program update process (that is, the update of the stored contents of the program information table 21) is performed. This is the timing when all the control programs are not executed. It is necessary to do in. The normal controller 3 performs a data input process to the program → execution of the program → result output process from the program as one scan, and the system program of the controller 3 performs a process between scans (hereinafter referred to as a scan end process). ). Therefore, the control program update process must be performed during the scan end process.

図4は、スキャンエンド処理から呼び出されるRUN中更新処理フローである。
以下、図4の処理について、図3、図5も参照しつつ説明する。
図4の処理では、まず始めにプログラム変更要求キュー22のリードポインタ31とライトポインタ32とを比較して、両ポインタが指す位置が一致するか否かを判定する(ステップS11)。両ポインタの位置が同じならば(ステップS11,NO)、プログラム変更要求がないことになるので、処理を終了する。
FIG. 4 is an RUN update process flow called from the scan end process.
Hereinafter, the process of FIG. 4 will be described with reference to FIGS.
In the process of FIG. 4, first, the read pointer 31 and the write pointer 32 in the program change request queue 22 are compared to determine whether or not the positions pointed to by both pointers match (step S11). If the positions of both pointers are the same (step S11, NO), there is no program change request, and the process ends.

一方、両ポインタの指す位置が違っていれば(ステップS11,YES)、プログラム変更要求ありということなので、以下の処理を行う。
まず、リードポインタ31が示すアドレスに格納されているプログラム番号(図3(b)の例では最初はPG3)を、変数Iに代入する。また、プログラム情報テーブル21の先頭アドレス(図3(a)の例では仮にPtr_1とする)を、変数Jに代入する(ステップS12)。
On the other hand, if the positions indicated by the two pointers are different (step S11, YES), it means that there is a program change request, so the following processing is performed.
First, the program number stored in the address indicated by the read pointer 31 (initially PG3 in the example of FIG. 3B) is substituted into the variable I. Further, the head address of the program information table 21 (assumed to be Ptr_1 in the example of FIG. 3A) is substituted into the variable J (step S12).

そして、変数Jが示すアドレス(最初は先頭アドレスPtr_1)に格納されているプログラム番号21aと変数Iの値とが等しいか否かを判定する(ステップS13)。もし両者が不一致であれば(ステップS13,NO)、一致するようになるまで繰返し変数Jの値を進めていく(例えばプログラム情報テーブル21には1byte単位でデータが格納されているとした場合には、J=J+1(byte)等とする)(ステップS14)。   Then, it is determined whether or not the program number 21a stored at the address indicated by the variable J (initially the top address Ptr_1) is equal to the value of the variable I (step S13). If they do not match (step S13, NO), the value of the variable J is repeatedly advanced until they match (for example, when data is stored in units of 1 byte in the program information table 21). Is J = J + 1 (byte) or the like) (step S14).

そして、変数Jが示す位置のプログラム番号21aと変数Iの値とが一致したら(ステップS13,YES)、当該プログラム番号21aに対応する格納アドレス21bの値を、プログラム変更要求キュー22のリードポインタ31が示す位置の格納アドレス33の値によって更新する(ステップS15)。上記の通り最初はPG3であるので、図3(a)では格納アドレス21bにADR2が格納されていたが、図5(a)のようにADR5へと変更される。   If the program number 21a at the position indicated by the variable J matches the value of the variable I (step S13, YES), the value of the storage address 21b corresponding to the program number 21a is set to the read pointer 31 of the program change request queue 22. Is updated with the value of the storage address 33 at the position indicated by (step S15). Since it is PG3 at first as described above, ADR2 is stored in the storage address 21b in FIG. 3A, but is changed to ADR5 as shown in FIG. 5A.

変更後、リードポインタ31を1つ進める(ステップS16)。そして、再びステップS11の処理に戻り、リードポインタ31とライトポインタ32が一致するまで(すなわち変更要求がなくなるまで)、上記ステップS12〜S16の処理を繰返し実行する。図3(b)の例では、上記PG3以外にPG9があるので、PG9についても上記処理を実行することで、図5(a)、(b)に示す状態になったら、当該処理は終了する。   After the change, the read pointer 31 is advanced by 1 (step S16). Then, the process returns to step S11 again, and the processes in steps S12 to S16 are repeatedly executed until the read pointer 31 and the write pointer 32 match (that is, until there is no change request). In the example of FIG. 3B, since there is PG9 other than the above PG3, the above processing is also executed for PG9, and when the state shown in FIGS. 5A and 5B is reached, the processing ends. .

尚、本例においては、既存の制御プログラムの更新を前提としているので、全く新しい制御プログラムを追加する場合については想定していない。
尚、上記ステップS11の処理は、特に、2チップ構成のコントローラにおいて意味がある。すなわち、従来より、制御プログラムを実行する第1のCPUと支援ツールとのインタフェース処理を行う第2のCPUとを有する2チップ構成のコントローラが存在する。この様な構成では、第1のCPUは、上記ステップS11の処理を行うことで、プログラム更新があったか否かを判別できる。
In this example, since it is assumed that the existing control program is updated, it is not assumed that a completely new control program is added.
Note that the processing in step S11 is particularly significant in a two-chip controller. That is, conventionally, there is a two-chip controller having a first CPU that executes a control program and a second CPU that performs interface processing between support tools. In such a configuration, the first CPU can determine whether or not the program has been updated by performing the process of step S11.

上記の一連の処理が完了したときのプログラムメモリ等の状態を示したものが図5である。図5(a)のプログラム情報テーブル21は、PG3とPG9に対応する格納アドレス21bがそれぞれADR5とADR6に更新され、図5(b)のプログラム変更要求キュー22は、リードポインタ31の位置がライトポインタ32の位置と一致している。更新後のプログラム情報テーブル21の内容により、図5(c)のプログラムメモリ23において旧版プログラムPG3とPG9が格納されている領域41,42は、空き領域として管理されることになる。尚、特に図示していないが、プログラムメモリ23には、格納している各プログラムの最後を示す各ポインタが用意されている。よって、図5(a)のプログラム情報テーブル21には、例えばプログラムPG1の格納領域の先頭アドレス(ADR1)のみが記憶されているが、上記ポインタによって、ADR1〜ADR2までの記憶領域に、プログラムPG1が格納されていることが分かるようになっている。但し、この例に限らず、例えば後述するプログラム情報テーブル51の様に、サイズ情報も格納するようにしてもよい。   FIG. 5 shows the state of the program memory and the like when the above series of processing is completed. In the program information table 21 of FIG. 5A, the storage addresses 21b corresponding to PG3 and PG9 are updated to ADR5 and ADR6, respectively, and the program change request queue 22 of FIG. It coincides with the position of the pointer 32. Depending on the contents of the updated program information table 21, the areas 41 and 42 in which the old version programs PG3 and PG9 are stored in the program memory 23 of FIG. 5C are managed as free areas. Although not particularly illustrated, each pointer indicating the end of each stored program is prepared in the program memory 23. Therefore, in the program information table 21 in FIG. 5A, for example, only the start address (ADR1) of the storage area of the program PG1 is stored, but the program PG1 is stored in the storage areas ADR1 to ADR2 by the pointer. Is stored. However, the present invention is not limited to this example. For example, size information may be stored as in a program information table 51 described later.

尚、上記図4の処理は、プログラム情報テーブル21の格納アドレス21bの値を更新するだけの処理であり、更新要求プログラムの数がさほど多くなければ、負担にならない処理である。   The process of FIG. 4 is a process that only updates the value of the storage address 21b of the program information table 21, and is a process that does not become a burden unless the number of update request programs is large.

以上述べたように、本例では、複数プログラムの一括更新を行うことができる。また、更新版プログラムをプログラムメモリ23に格納する処理自体は、更新対象のプログラムを実行中であっても行うことができる。   As described above, in this example, a plurality of programs can be updated at once. Further, the process itself of storing the updated version program in the program memory 23 can be performed even while the program to be updated is being executed.

以上述べた処理により、プログラムのRUN中更新処理は一応完了するが、更新版プログラムを格納済みプログラム領域の後ろに付け足し、旧版のプログラムを無効化する(プログラム情報テーブル21を更新する)処理を行っていくと、どうしてもプログラムメモリ23上に空き領域が分散して存在することになる(図5(c)参照)。   With the processing described above, the program update processing during RUN is completed, but the update program is added after the stored program area to invalidate the old program (update the program information table 21). As a result, vacant areas are inevitably distributed on the program memory 23 (see FIG. 5C).

特許文献2においては、空き領域にあわせ、更新するプログラムを分割していたが、上述した問題が生じる。
これより、本例では、空き領域が生じた場合には、既にプログラムメモリ23に格納した制御プログラムを、順次前詰めしていくことで、空き領域が分散配置されないようにする(最後尾の制御プログラムの後に空きスペースをまとめてしまう)方法を提案する。
In Patent Document 2, the program to be updated is divided in accordance with the free space, but the above-described problem occurs.
As a result, in this example, when a free area occurs, the control programs already stored in the program memory 23 are sequentially left-adjusted so that the free areas are not distributed (the last control). Propose a method to collect free space after the program.

本実施例では、簡単のためプログラムメモリ23の先頭から順に領域をサーチし、最初の空き領域の次の制御プログラムを、この空き領域の先頭から始まるように移し、それによって新たに生じる空き領域や別の空き領域に関しても同様にしてその次の制御プログラムを詰めていく処理を示す。この処理の一部は、図4のアルゴリズムを利用できる。以下、図6〜図8を参照して詳細に説明する。   In this embodiment, for the sake of simplicity, an area is searched in order from the top of the program memory 23, and the control program next to the first free area is moved so as to start from the top of this free area. The process of filling the next control program in the same way for another free area is also shown. A part of this process can use the algorithm of FIG. Hereinafter, a detailed description will be given with reference to FIGS.

まず、本例では、プログラム情報テーブル51は、図6(a)に示すように、プログラム番号51a、格納アドレス51bに加えて、制御プログラムのサイズを格納するサイズ51cを有している。これより、上記プログラム格納・更新処理の際には、プログラムメモリ23に格納した制御プログラムのサイズを、サイズ51cに格納する処理も行う。また、本例では、図6(d)に示すシステム一時メモリ52も備える。システム一時メモリ52は、プログラムメモリ23に格納されている複数の制御プログラムのうち、格納場所を移動させるべき制御プログラムがある毎に、その制御プログラムを一時的に退避させる為のメモリである。空き領域のサイズが、移動させるべき制御プログラムのサイズより大きければ、直接移動が可能であるが、必ずしも大きいわけではないので、システム一時メモリ52を準備している。このシステム一時メモリ52は、コントローラ3が許す単一プログラムの最大サイズを確保している。尚、システム一時メモリ52は、プログラムメモリ23の記憶領域の一部を用いても良い(この場合、プログラムメモリ23の記憶容量を、その分増やす)。   First, in this example, as shown in FIG. 6A, the program information table 51 has a size 51c for storing the size of the control program in addition to the program number 51a and the storage address 51b. Thus, in the program storing / updating process, the process of storing the size of the control program stored in the program memory 23 in the size 51c is also performed. In this example, a system temporary memory 52 shown in FIG. The system temporary memory 52 is a memory for temporarily evacuating the control program whenever there is a control program whose storage location is to be moved among the plurality of control programs stored in the program memory 23. If the size of the vacant area is larger than the size of the control program to be moved, direct movement is possible, but the system temporary memory 52 is prepared because it is not necessarily large. The system temporary memory 52 secures the maximum size of a single program allowed by the controller 3. The system temporary memory 52 may use a part of the storage area of the program memory 23 (in this case, the storage capacity of the program memory 23 is increased accordingly).

また、プログラム変更要求キュー22は、その構成自体は、上述したものと変わらないが、使い方が異なる。すなわち、図6(d)にはプログラムPG8をシステム一時メモリ52に退避させた状態を示しており、これに応じて、プログラム変更要求キュー22には図6(b)に示すようにプログラム番号PG8に対応付けて退避先の先頭アドレス(ADR10)が格納される。更に、プログラムPG8をプログラムメモリ23内の新たな格納先に書き戻したときには、後述する図8(b)に示すように、新たな格納先の先頭アドレスが格納されるようになる。   The configuration of the program change request queue 22 is not different from that described above, but the usage is different. That is, FIG. 6D shows a state in which the program PG8 is saved in the system temporary memory 52, and accordingly, the program change request queue 22 has a program number PG8 as shown in FIG. 6B. Is stored in association with the head address (ADR10) of the save destination. Furthermore, when the program PG8 is written back to a new storage location in the program memory 23, the start address of the new storage location is stored as shown in FIG.

以下、上記構成を用いたプログラム格納位置の再配置処理について説明する。
本プログラム再配置処理は、プログラム情報テーブル51を参照して、格納アドレス51bが若い順に、各制御プログラムの格納状態(その制御プログラムの前に空き領域があるか否か)をチェックして、空き領域がある場合にはその制御プログラムを移動させる(前へ詰める)処理を順次実行していくものである。図示の例では、格納アドレスは、ADR1<ADR3<ADR5<ADR6であるので、PG1→PG8→PG3→PG9の順番で、各制御プログラムについて、以下に説明する処理を行う。
Hereinafter, the program storage location rearrangement processing using the above configuration will be described.
In this program rearrangement process, the storage state of each control program (whether or not there is an empty area before the control program) is checked by referring to the program information table 51 in ascending order of the storage address 51b. If there is an area, the process of moving the control program (to the front) is sequentially executed. In the illustrated example, since the storage address is ADR1 <ADR3 <ADR5 <ADR6, the processing described below is performed for each control program in the order of PG1, PG8, PG3, and PG9.

まず、処理対象とした制御プログラムの1つ前の制御プログラムの“格納アドレス51bの値+サイズ51cの値”が、処理対象プログラムの格納アドレス51bの値と一致するか否かを判定する。これは、各制御プログラムの“先頭アドレス+サイズ”が次の制御プログラムの先頭アドレスになっているかどうかで、空き領域があるかないかを確認するためである。但し、一番最初のPG1のみは、その前の制御プログラムが存在しないので、別の処理を行う。すなわち、PG1の格納アドレス51bの値が、プログラムメモリ23の先頭アドレスと一致するか否かを判定する。図示の例では一致するので、PG1は移動させることなく処理終了し、続いてPG8を処理対象とする。   First, it is determined whether “the value of the storage address 51b + the value of the size 51c” of the control program immediately before the control program to be processed matches the value of the storage address 51b of the process target program. This is to check whether there is a free area by checking whether “start address + size” of each control program is the start address of the next control program. However, since only the first PG1 has no previous control program, another process is performed. That is, it is determined whether or not the value of the storage address 51b of PG1 matches the head address of the program memory 23. Since they match in the example shown in the figure, PG1 ends the process without being moved, and PG8 is subsequently processed.

PG8に関しては、その1つ前の制御プログラムPG1の“先頭アドレスADR1+サイズ51c”が、プログラムPG8の先頭アドレスADR3と一致するか否かをチェックするのであり、図6(c)に示すように、PG1の“先頭アドレス+サイズ”=ADR2であるので、一致しないので、プログラムPG8の前に、空き領域があることが分かる。   With respect to PG8, it is checked whether or not the “start address ADR1 + size 51c” of the immediately preceding control program PG1 matches the start address ADR3 of the program PG8, as shown in FIG. Since “start address + size” of PG1 = ADR2, since they do not match, it can be seen that there is an empty area before the program PG8.

この様に“一致しない”と判定した場合には、続いて、プログラムPG8を、その先頭アドレスがADR2となる位置へと移動させるが、その為には、上記の通り、システム一時メモリ52に一時的に退避(コピー)させる。そして、退避させた制御プログラムのプログラム番号(PG8)と退避先の先頭アドレス(ADR10)とを、プログラム変更要求キュー22に格納し、ライトポインタ32をインクリメントする。これより、プログラム変更要求キュー22は、図6(b)に示す状態となる。   If it is determined that they do not coincide with each other, the program PG 8 is subsequently moved to a position where the start address is ADR 2. For this purpose, the program PG 8 is temporarily stored in the system temporary memory 52 as described above. Evacuate (copy) automatically. Then, the program number (PG8) of the saved control program and the save destination head address (ADR10) are stored in the program change request queue 22, and the write pointer 32 is incremented. As a result, the program change request queue 22 is in the state shown in FIG.

次に、図4に示す処理を呼出す。これにより、図4の処理が実行されることで、プログラム情報テーブル51は、図7(a)に示す状態になる。すなわち、PG8に対応する格納アドレス51bが、ADR3からADR10へと更新される。また、ステップS16によりリードポインタ31が1つ進められるので、プログラム変更要求キュー22は、図7(b)に示す状態となる。すなわち、リードポインタ31の位置とライトポインタ32の位置とが一致する状態となる。また、図7(a)に示すプログラム情報テーブル51の内容により、プログラムメモリ23には図7(c)に示す空き領域61が存在することになる(プログラムPG8があった領域も空き領域になっている)。   Next, the process shown in FIG. 4 is called. As a result, the program information table 51 is in the state shown in FIG. That is, the storage address 51b corresponding to PG8 is updated from ADR3 to ADR10. Further, since the read pointer 31 is advanced by one in step S16, the program change request queue 22 is in the state shown in FIG. That is, the position of the read pointer 31 and the position of the write pointer 32 coincide with each other. Further, according to the contents of the program information table 51 shown in FIG. 7A, the program memory 23 has the empty area 61 shown in FIG. 7C (the area where the program PG8 was present is also an empty area). ing).

続いて、システム一時メモリ52から空き領域61の先頭へプログラムPG8を書き戻す処理を実行する。すなわち、図8(c)に示すように、システム一時メモリ52に退避させていたプログラムPG8のコピー先の先頭アドレスを、上記“PG1の先頭アドレス+サイズ=ADR2”として、当該プログラムPG8をコピーする。コピー完了したら、図8(b)に示すように、プログラム変更要求キュー22に、プログラムメモリに書き込んだプログラム番号PG8とその先頭アドレスADR2をセットし、ライトポインタ32をインクリメントする。   Subsequently, a process of writing back the program PG 8 from the system temporary memory 52 to the head of the empty area 61 is executed. That is, as shown in FIG. 8C, the program PG8 is copied by setting the start address of the copy destination of the program PG8 saved in the system temporary memory 52 as "start address of PG1 + size = ADR2". . When the copying is completed, as shown in FIG. 8B, the program change request queue 22 is set with the program number PG8 written in the program memory and its start address ADR2, and the write pointer 32 is incremented.

そして、再び図4の処理を呼出して実行させることにより、プログラム情報テーブル51は、図8(a)に示す状態になる。すなわち、PG8に対応する格納アドレス51bが、ADR10からADR2へと更新される。   Then, by calling and executing the processing of FIG. 4 again, the program information table 51 is in the state shown in FIG. That is, the storage address 51b corresponding to PG8 is updated from ADR10 to ADR2.

以上説明した処理は、他の制御プログラムについても同様にして実行していく。すなわち、上記の通りPG1→PG8→PG3→PG9の順番でチェックしていくので、次はPG3に関して、上記PG8の場合と同様にして処理を実行する。PG9についても同様である。尚、ある制御プログラムを移動させたら、基本的に、それ以降の制御プログラムは全て移動させることになるので、チェック処理は省いて直ぐに移動処理を行うようにしてもよい。   The processing described above is executed in the same manner for other control programs. That is, since the check is performed in the order of PG1, PG8, PG3, and PG9 as described above, the process for PG3 is executed in the same manner as in the case of PG8. The same applies to PG9. If a certain control program is moved, basically all subsequent control programs are moved, so that the check process may be omitted and the movement process may be performed immediately.

PG9についての処理が完了した時点で、プログラムメモリ23の格納状態は、格納済みプログラムの後ろに一括して空き領域が存在する状態となる。よって、その後にプログラム更新が行われる場合には、更新版プログラムはこの空き領域に格納されるので、更新版プログラムを分割・格納する必要はない。   When the processing for PG9 is completed, the storage state of the program memory 23 is a state in which an empty area exists collectively after the stored program. Therefore, when a program update is performed thereafter, the updated version program is stored in this empty area, and therefore it is not necessary to divide and store the updated version program.

以上、本発明の実施の形態の一例について説明したが、本発明は、この様な一例に限らない。例えば、上述した一例では、ユーザ要求によるプログラム更新処理に用いるプログラム変更要求キュー22を、システムによるプログラム格納位置の再配置処理の際にも用いた(共用した)が、2つのキューを用意して、別々に用いるようにしてもよい。この様に、ユーザ要求によるプログラム変更要求キューとシステムが使用するキューとを用意する構成としたのは、システムの要求を優先的に処理することにより、プログラム再配置を早めるためと、システム要求のプログラム再配置は、スキャン中かどうかにかかわらず実行可能なためである。なぜならば、システム要求によるプログラム格納位置再配置処理は、同一のプログラムを移動させるのであって、移動前のプログラムと移動後のプログラムのどちらを実行しても演算に影響しないからである。ただし、システム一時メモリ52に格納されたプログラムを実行中にシステム一時メモリ52に他のプログラムを上書きするのは問題外である。   The example of the embodiment of the present invention has been described above, but the present invention is not limited to such an example. For example, in the above-described example, the program change request queue 22 used for the program update process by the user request is also used (shared) for the program storage location relocation process by the system. May be used separately. In this way, the program change request queue by the user request and the queue used by the system are prepared in order to speed up the program relocation by preferentially processing the system request, This is because program rearrangement can be executed regardless of whether or not scanning is in progress. This is because the program storage location rearrangement process according to the system request moves the same program, and does not affect the operation regardless of whether the program before the movement or the program after the movement is executed. However, overwriting another program in the system temporary memory 52 during execution of the program stored in the system temporary memory 52 is not a problem.

あるいは、上記2つのキューを用いる方法以外にも、例えば、キューは1つのみを共有するが、プログラム変更要求キューに、システムからの要求かユーザからの要求かを判別する為のビット情報を設けてもよい。この変形例について、以下、図9、図10を参照して説明する。本変形例では、概略的には、まず、図9(b)に示すように、プログラム変更要求キュー70は、リードポインタ31、ライトポインタ32だけでなく、システム用リードポインタ71を用いて管理されている。更に、プログラム変更要求キュー70には、プログラム番号73、格納アドレス74だけでなく、ビット情報72が格納される。ビット情報72が‘1’であれば、その格納データは上記プログラム格納位置の再配置処理による(システムからの要求による)ものであることを意味し、ビット情報72が‘0’であれば、その格納データは上記RUN中更新処理に係わるもの(ユーザ要求によるもの)であることを意味する。つまり、図6〜図8で説明したプログラム格納位置の再配置処理中に、プログラム変更要求キュー70にデータ格納したときには、ビット情報72に‘1’を格納する。一方、図3で説明したように更新版プログラムをプログラムメモリ23に格納したことに伴ってプログラム変更要求キュー70にデータ格納したときには、ビット情報72に‘0’を格納する。尚、“ユーザ要求による”とは、支援装置10から上記更新要求が送られてくることを意味する。   Alternatively, in addition to the method using the above two queues, for example, only one queue is shared, but bit information for determining whether the request is from the system or the user is provided in the program change request queue. May be. This modification will be described below with reference to FIGS. 9 and 10. In this modification, generally, as shown in FIG. 9B, first, the program change request queue 70 is managed using not only the read pointer 31 and the write pointer 32 but also the system read pointer 71. ing. In addition, the program change request queue 70 stores not only the program number 73 and the storage address 74 but also bit information 72. If the bit information 72 is “1”, it means that the stored data is based on the program storage location relocation process (by a request from the system), and if the bit information 72 is “0”, This means that the stored data is related to the update process during RUN (according to a user request). That is, when data is stored in the program change request queue 70 during the program storage location rearrangement processing described with reference to FIGS. 6 to 8, “1” is stored in the bit information 72. On the other hand, when the updated version program is stored in the program memory 23 as described with reference to FIG. 3, “0” is stored in the bit information 72 when the data is stored in the program change request queue 70. Note that “by user request” means that the update request is sent from the support apparatus 10.

図9に示す例では、ユーザ要求により、プログラムPG3の更新版であるプログラムPG3’が送られてきて、これがプログラムメモリ23に格納され、その後、RUN中更新処理によってプログラム情報テーブル51におけるPG3に対応する格納アドレスがADR5へと変更され、その後に上記プログラム格納位置の再配置処理によってPG8がシステム一時メモリ52に退避されると共にこの格納位置がプログラム変更要求キュー70に格納されている。この場合、ビット情報72は、図示の通り‘1’である。この状態で、ユーザ要求により、プログラムPG9の更新版であるプログラムPG9’が送られてきて、これがプログラムメモリ23に格納されると共にその格納位置データが、プログラム変更要求キュー70に格納されている。この場合、ビット情報72は、図示の通り‘0’である。   In the example shown in FIG. 9, a program PG3 ′, which is an updated version of the program PG3, is sent in response to a user request and stored in the program memory 23, and then corresponds to PG3 in the program information table 51 by update processing during RUN. The storage address to be changed is changed to ADR 5, and then PG 8 is saved in the system temporary memory 52 by the above-described rearrangement processing of the program storage location, and this storage location is stored in the program change request queue 70. In this case, the bit information 72 is “1” as illustrated. In this state, a program PG 9 ′, which is an updated version of the program PG 9, is sent in response to a user request, which is stored in the program memory 23 and its storage position data is stored in the program change request queue 70. In this case, the bit information 72 is “0” as illustrated.

以上説明したことにより、プログラム情報テーブル51、プログラム変更要求キュー70、プログラムメモリ23、システム一時メモリ52のデータ格納状態は、図9(a)〜(d)に示す通りとなっている。   As described above, the data storage states of the program information table 51, the program change request queue 70, the program memory 23, and the system temporary memory 52 are as shown in FIGS.

そして、この状態のときに、スキャンエンド処理に入り、この処理中に図10に示すRUN中更新処理を実行する処理ルーチンが呼び出される。
図10に示す処理は、基本的な処理内容は図4に示す処理と略同様であり、異なる点は、まず、システム用リードポインタ71を用いて、ビット情報72が‘1’であるデータを処理対象としたRUN中更新処理を実行し、次にリードポインタ31を用いて、ビット情報72が‘0’であるデータを処理対象としたRUN中更新処理を実行するものである。
Then, in this state, the scan end process is started, and a processing routine for executing the RUN update process shown in FIG. 10 is called during this process.
The processing shown in FIG. 10 is basically the same as the processing shown in FIG. 4 except that the data having bit information 72 of “1” is first used using the system read pointer 71. The update processing during RUN as the processing target is executed, and then the update processing during RUN is executed using the read pointer 31 for the data whose bit information 72 is “0”.

図10に示す処理では、まず、システム用リードポインタ71の位置がライトポインタ32の位置と同じであるか否かを判定し(ステップS21)、同じであるならば(ステップS21,NO)、ステップS22以降の処理は実行せずに、ステップS28の処理へと進む。   In the process shown in FIG. 10, first, it is determined whether or not the position of the system read pointer 71 is the same as the position of the write pointer 32 (step S21). The processing proceeds to step S28 without executing the processing after S22.

システム用リードポインタ71の位置がライトポインタの位置と異なるならば(ステップS21,YES)、更に、システム用リードポインタ71が指すデータのビット情報72が‘1’であるか否かを判定し(ステップS22)、ビット情報72が‘0’であるならば(ステップS22,NO)、ステップS23以降の処理は実行せずにステップS27へと進み、システム用リードポインタ71を進めて(インクリメントして)、ステップS21に戻る。   If the position of the system read pointer 71 is different from the position of the write pointer (step S21, YES), it is further determined whether or not the bit information 72 of the data pointed to by the system read pointer 71 is “1” ( If the bit information 72 is '0' (step S22, NO), the process proceeds to step S27 without executing the processes after step S23, and advances (increments) the system read pointer 71. ), The process returns to step S21.

一方、ビット情報72が‘1’であるならば(ステップS22,YES)、ステップS23以降の処理へと進む。ステップS23〜S27の処理は、図4に示すステップS12〜S16の処理と略同様であるので、ここでは説明しない。   On the other hand, if the bit information 72 is “1” (step S22, YES), the process proceeds to step S23 and subsequent steps. The processing of steps S23 to S27 is substantially the same as the processing of steps S12 to S16 shown in FIG. 4 and will not be described here.

尚、システム用リードポインタ71とリードポインタ31は、最初は同じ位置にあり、上記処理によってシステム用リードポインタ71を進めても、リードポインタ31は進めない。   The system read pointer 71 and the read pointer 31 are initially in the same position, and even if the system read pointer 71 is advanced by the above processing, the read pointer 31 is not advanced.

上記図9の例を対象として上記の処理を実行した場合、まず、システム用リードポインタ71は、最初はPG9に関するデータの位置を示しており、そのビット情報72が‘0’であるので、ステップS22の判定はNOとなり、ステップS27でシステム用リードポインタ71を1つ進めることで、今度はPG8に関するデータの位置となり、そのビット情報72は‘1’であるので、ステップS23〜S26の処理を実行することになる。これによって、プログラム情報テーブル51は、図9(a)に示す状態ではPG8に対応する格納アドレスはADR3になっていたが、これがADR10へと更新されることになる。そして、再びステップS27でシステム用リードポインタ71を1つ進めると、当該ポインタ71の位置はライトポインタ32の位置と同じになるので、ステップS21の判定はNOとなり、ステップS28の処理へと進む。   When the above processing is executed for the example of FIG. 9 above, first, the system read pointer 71 indicates the position of the data related to PG9 first, and its bit information 72 is “0”. The determination in S22 is NO, and the system read pointer 71 is advanced by 1 in step S27. This time, the position of the data relating to PG8 is obtained, and the bit information 72 is “1”. Therefore, the processing in steps S23 to S26 is performed. Will be executed. As a result, in the program information table 51, in the state shown in FIG. 9A, the storage address corresponding to PG8 is ADR3, but this is updated to ADR10. Then, when the system read pointer 71 is advanced by 1 again in step S27, the position of the pointer 71 becomes the same as the position of the write pointer 32. Therefore, the determination in step S21 is NO, and the process proceeds to step S28.

ステップS28では、リードポインタ31の位置がライトポインタ32の位置と同じであるか否かを判定し、同じであるならば(ステップS28,NO)、ステップS29以降の処理は実行せずに、本処理を終了する。一方、同じではないならば(ステップS28,YES)、リードポインタ31が指すデータのビット情報72が‘0’であるか否かを判定し(ステップS29)、ビット情報72が‘1’であるならば(ステップS29,NO)、ステップS34に進み、リードポインタ31を進めた後、ステップS28に戻る。   In step S28, it is determined whether or not the position of the read pointer 31 is the same as the position of the write pointer 32. If the position is the same (NO in step S28), the process after step S29 is not executed, The process ends. On the other hand, if they are not the same (step S28, YES), it is determined whether or not the bit information 72 of the data pointed to by the read pointer 31 is “0” (step S29), and the bit information 72 is “1”. If so (step S29, NO), the process proceeds to step S34, the read pointer 31 is advanced, and then the process returns to step S28.

一方、ビット情報72が‘0’であるならば(ステップS29,YES)、ステップS30以降の処理に進む。ステップS30〜S34の処理は、図4に示すステップS12〜S16の処理と略同様であるので、ここでは説明しないが、この処理を上記図9の例を対象として実行した場合、プログラム情報テーブル51は、図9(a)に示す状態ではPG9に対応する格納アドレスはADR4になっていたが、これがADR6へと更新されることになる。   On the other hand, if the bit information 72 is “0” (step S29, YES), the process proceeds to step S30 and subsequent steps. The processing of steps S30 to S34 is substantially the same as the processing of steps S12 to S16 shown in FIG. 4 and will not be described here. However, when this processing is executed for the example of FIG. In the state shown in FIG. 9A, the storage address corresponding to PG9 is ADR4, but this is updated to ADR6.

本発明は、上述した実施の形態の例に限らない。例えば、上記プログラム変更要求キュー22を用いることに代えて、支援装置10からコントローラ3に更新版プログラムをダウンロードする際に、“一括で更新したいプログラムのリスト”と更新要求のコマンドも一緒に渡すようにしてもよい。   The present invention is not limited to the example of the embodiment described above. For example, instead of using the program change request queue 22, when downloading an updated program from the support apparatus 10 to the controller 3, a "list of programs to be updated at once" and an update request command are passed together. It may be.

プログラマブルコントローラ・システムの概略構成図である。It is a schematic block diagram of a programmable controller system. (a)はプログラム情報テーブル、(b)はプログラム変更要求キュー、(c)はプログラムメモリの一例である。(A) is an example of a program information table, (b) is an example of a program change request queue, and (c) is an example of a program memory. 図2の例に基づき、RUN中に2つのプログラムの更新要求があった場合のデータ格納例である。FIG. 3 is an example of data storage when there are two program update requests during RUN based on the example of FIG. RUN中更新処理フローチャート図である。It is a RUN update process flowchart. 図3の例に基づき、図4の処理を実行したときのデータ格納状態を示す図である。It is a figure which shows a data storage state when the process of FIG. 4 is performed based on the example of FIG. プログラム格納位置の再配置処理を説明する為の図(その1)である。FIG. 10 is a diagram (part 1) for explaining a program storage position rearrangement process; プログラム格納位置の再配置処理を説明する為の図(その2)である。FIG. 10 is a diagram (part 2) for explaining the program storage position rearrangement process; プログラム格納位置の再配置処理を説明する為の図(その3)である。FIG. 10 is a diagram (No. 3) for explaining the program storage position rearrangement process; 変形例を説明する為の具体例である。It is a specific example for demonstrating a modification. 変形例によるRUN中更新処理フローチャート図である。It is a RUN update process flowchart according to a modification.

符号の説明Explanation of symbols

1 コンパイラ
2 伝送装置
3 コントローラ
10 コントローラ支援装置
11 表示装置
12 入力装置
13 記録媒体
21 プログラム情報テーブル
21a プログラム番号
21b 格納アドレス
22 プログラム変更要求キュー
23 プログラムメモリ
31 リードポインタ
32 ライトポインタ
33 格納アドレス
41,42 領域
51 プログラム情報テーブル
51a プログラム番号
51b 格納アドレス
51c サイズ
52 システム一時メモリ
61 空き領域
DESCRIPTION OF SYMBOLS 1 Compiler 2 Transmission apparatus 3 Controller 10 Controller support apparatus 11 Display apparatus 12 Input apparatus 13 Recording medium 21 Program information table 21a Program number 21b Storage address 22 Program change request queue 23 Program memory 31 Read pointer 32 Write pointer 33 Storage address 41, 42 Area 51 Program information table 51a Program number 51b Storage address 51c Size 52 System temporary memory 61 Free area

Claims (4)

複数の制御プログラムを格納するプログラムメモリと、
該プログラムメモリに格納されている各制御プログラムの格納位置を記憶するテーブルと、
リードポインタとライトポインタを有するプログラム変更要求キューと、
外部から、前記プログラムメモリに格納されている何れかの制御プログラムの更新版が送られてくると、該更新版の制御プログラムを前記プログラムメモリの空き領域に格納すると共に、該格納位置情報を前記プログラム変更要求キューに記憶すると共に前記ライトポインタを進める更新版プログラム受付手段と、
スキャンエンド処理中に前記テーブルを更新するものであって、前記リードポインタの位置と前記ライトポインタの位置が一致しない場合には、更新要求有りと判定し、前記プログラム変更要求キューに格納されている前記更新版プログラムの格納位置情報を用いて、前記テーブルを更新するプログラム更新手段と、
を有することを特徴とするコントローラ。
A program memory for storing a plurality of control programs;
A table for storing the storage position of each control program stored in the program memory;
A program change request queue having a read pointer and a write pointer;
When an updated version of any control program stored in the program memory is sent from the outside, the updated version of the control program is stored in an empty area of the program memory, and the storage location information is Updated version program receiving means for storing the program change request queue and advancing the write pointer;
If the table is updated during the scan end process and the position of the read pointer does not match the position of the write pointer, it is determined that there is an update request and is stored in the program change request queue. Program update means for updating the table using storage location information of the updated version program;
The controller characterized by having.
前記テーブルには各制御プログラムのサイズも格納されており、
前記テーブルにおける各制御プログラムの格納位置とサイズとに基づいて、各制御プログラム間に空き領域が存在するか否かを判定し、空き領域が存在する場合には、前記プログラムメモリにおいて該空き領域の直後に格納されている制御プログラムを前詰めする空き領域調整手段を更に有することを特徴とする請求項1記載のコントローラ。
The table also stores the size of each control program,
Based on the storage position and size of each control program in the table, it is determined whether or not there is a free area between the control programs. If there is a free area, the free space in the program memory 2. The controller according to claim 1, further comprising an empty area adjusting means for pre-packing a control program stored immediately thereafter.
前記プログラムメモリに格納されている制御プログラムを一時的に退避させる退避領域を更に有し、
前記空き領域調整手段は、前記空き領域の直後に格納されている制御プログラムを該退避領域に退避させた後、該退避させた制御プログラムを前記空き領域の先頭から格納し直すことで前記前詰めを実現させることを特徴とする請求項2記載のコントローラ。
A storage area for temporarily storing the control program stored in the program memory;
The empty area adjusting means saves the control program stored immediately after the empty area to the save area, and then stores the saved control program from the beginning of the empty area to re-fill the front end. The controller according to claim 2, wherein:
コンピュータに、
複数の制御プログラムを格納するプログラムメモリと、該プログラムメモリに格納されている各制御プログラムの格納位置を格納するテーブルと、リードポインタとライトポインタを有するプログラム変更要求キューとを用いて、
外部から、前記プログラムメモリに格納されている何れかの制御プログラムの更新版が送られてくると、該更新版の制御プログラムを前記プログラムメモリの空き領域に格納すると共に、該格納位置を前記プログラム変更要求キューに格納すると共に前記ライトポインタを進める機能と、
スキャンエンド処理中に、前記リードポインタの位置と前記ライトポインタの位置が一致しない場合には、更新要求有りと判定し、前記プログラム変更要求キューに格納されている前記更新版プログラムの格納位置により、前記テーブルの格納位置を更新する機能と、
を実現させる為のプログラム。
On the computer,
Using a program memory for storing a plurality of control programs, a table for storing the storage position of each control program stored in the program memory, and a program change request queue having a read pointer and a write pointer,
When an updated version of one of the control programs stored in the program memory is sent from the outside, the updated version of the control program is stored in an empty area of the program memory, and the storage location is set in the program A function to store the change request queue and advance the write pointer;
During the scan end process, if the position of the read pointer and the position of the write pointer do not match, it is determined that there is an update request, and depending on the storage position of the updated version program stored in the program change request queue, A function of updating the storage position of the table;
A program to realize
JP2005016122A 2005-01-24 2005-01-24 Controller and program for same Withdrawn JP2006202233A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005016122A JP2006202233A (en) 2005-01-24 2005-01-24 Controller and program for same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005016122A JP2006202233A (en) 2005-01-24 2005-01-24 Controller and program for same

Publications (1)

Publication Number Publication Date
JP2006202233A true JP2006202233A (en) 2006-08-03

Family

ID=36960155

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005016122A Withdrawn JP2006202233A (en) 2005-01-24 2005-01-24 Controller and program for same

Country Status (1)

Country Link
JP (1) JP2006202233A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008077265A (en) * 2006-09-20 2008-04-03 Fuji Electric Fa Components & Systems Co Ltd Program update method for programmable controller
JP2012027639A (en) * 2010-07-22 2012-02-09 Fuji Electric Co Ltd Programmable controller and debug method of programmable controller
JP2013025347A (en) * 2011-07-15 2013-02-04 Fuji Electric Co Ltd Programmable controller
JP2019194837A (en) * 2018-05-03 2019-11-07 エルエス産電株式会社Lsis Co., Ltd. Plc program processor
WO2020121614A1 (en) * 2018-12-13 2020-06-18 株式会社日立産機システム Industrial controller

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008077265A (en) * 2006-09-20 2008-04-03 Fuji Electric Fa Components & Systems Co Ltd Program update method for programmable controller
JP2012027639A (en) * 2010-07-22 2012-02-09 Fuji Electric Co Ltd Programmable controller and debug method of programmable controller
JP2013025347A (en) * 2011-07-15 2013-02-04 Fuji Electric Co Ltd Programmable controller
JP2019194837A (en) * 2018-05-03 2019-11-07 エルエス産電株式会社Lsis Co., Ltd. Plc program processor
CN110442074A (en) * 2018-05-03 2019-11-12 Ls产电株式会社 The processing unit of programmable logic controller program
KR20190127110A (en) * 2018-05-03 2019-11-13 엘에스산전 주식회사 Apparatus for processing programmable logic controller program
US10824128B2 (en) 2018-05-03 2020-11-03 Lsis Co., Ltd. Device for processing programmable logic controller program
CN110442074B (en) * 2018-05-03 2022-07-22 Ls产电株式会社 Processing device for programmable logic controller program
KR102434126B1 (en) * 2018-05-03 2022-08-18 엘에스일렉트릭(주) Apparatus for processing programmable logic controller program
WO2020121614A1 (en) * 2018-12-13 2020-06-18 株式会社日立産機システム Industrial controller
JP2020095549A (en) * 2018-12-13 2020-06-18 株式会社日立産機システム Industrial controller
JP7141939B2 (en) 2018-12-13 2022-09-26 株式会社日立産機システム industrial controller

Similar Documents

Publication Publication Date Title
JP5422652B2 (en) Avoiding self-eviction due to dynamic memory allocation in flash memory storage
JP2008242944A (en) Integrated memory management device and method
US20050144608A1 (en) Operating system allowing running of real-time application programs, control method therefor, and method of loading dynamic link libraries
KR20190079672A (en) Information processing apparatus, memory access method, and computer program
US20100169546A1 (en) Flash memory access circuit
US20120185682A1 (en) Method and system for post-build modification of firmware binaries to support different hardware configurations
JP2006202233A (en) Controller and program for same
EP2341441A2 (en) Methods and apparatus to perform adaptive pre-fetch operations in managed runtime environments
JP5106147B2 (en) Multiprocessor processing system
US20080031502A1 (en) Program-Controlled Microscope And Method For Externally Controlling Microscopes
US8001314B2 (en) Storing a driver for controlling a memory
JP6292096B2 (en) Programmable controller system and its support device
JP3973129B2 (en) Cache memory device and central processing unit using the same
US20080162783A1 (en) Dynamically updateable and moveable memory zones
US7107407B2 (en) Arithmetic unit with reduced startup time and method of loading data
CN101107591B (en) Computer system and method for activating basic program therein
KR102434126B1 (en) Apparatus for processing programmable logic controller program
JP5471677B2 (en) Virtual disk control system, method and program
JP6295914B2 (en) Programmable controller system, its support device, programmable controller
JP2746189B2 (en) File access control system
US20070150528A1 (en) Memory device and information processing apparatus
JPH11149307A (en) Robot controller provided with secondary storage device
JP6020071B2 (en) Programmable controller system, its support device, programmable controller
KR101039397B1 (en) Method for managing the shared area of a multi-port memory device to raise read operation speed of a memory link architecture and computer readable recording medium storing the program for the method
JP3670162B2 (en) Relocatable add-in software management system

Legal Events

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

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20080401