JP2001229015A - Controller - Google Patents

Controller

Info

Publication number
JP2001229015A
JP2001229015A JP2000041230A JP2000041230A JP2001229015A JP 2001229015 A JP2001229015 A JP 2001229015A JP 2000041230 A JP2000041230 A JP 2000041230A JP 2000041230 A JP2000041230 A JP 2000041230A JP 2001229015 A JP2001229015 A JP 2001229015A
Authority
JP
Japan
Prior art keywords
program
local variable
area
local
control device
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2000041230A
Other languages
Japanese (ja)
Inventor
Junichi Kanbe
淳一 神戸
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2000041230A priority Critical patent/JP2001229015A/en
Publication of JP2001229015A publication Critical patent/JP2001229015A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)
  • Programmable Controllers (AREA)

Abstract

PROBLEM TO BE SOLVED: To solve the problem that a conventional controller is constituted so that only the rewrite of a program can be operated, and that the rewrite of intrinsic variable of the program can not be operated. SOLUTION: An already edited program and local variables to be used only by the program are inputted from an engineering device 9 to a receiving part 21, and a program stored in a program area 11 and local variables stored in a local variable storage area 12 are rewritten into the received program and local variables by a program rewriting part 20 based on program page use information 13 for storing a page in which the program is allocated to the program area 11 and local variable page use information 14 for storing a page in which the local variables are allocated to the local variable area 12.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】この発明は、産業用プラント
を制御するプログラムを実行する制御装置に関するもの
であり、特に動作中のプログラムの変更に関するもので
ある。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a control device for executing a program for controlling an industrial plant, and more particularly to a change of a program during operation.

【0002】[0002]

【従来の技術】図22は、例えば特開平9−24471
7号公報に示された従来の動作中プログラム変更を支援
する機能を有する制御装置を示すブロック図である。図
22において、1はプログラムを編集するエンジニアリ
ング装置で、プログラムの編集を行うサポートツール2
と表示部3を有している。4はエンジニアリング装置1
で編集されたプログラムを実行する制御装置で、プログ
ラムを実行する制御部5及び実行されるプログラムを格
納するメモリ6を有している。
2. Description of the Related Art FIG.
FIG. 7 is a block diagram showing a control device having a function of supporting a conventional program change during operation disclosed in Japanese Patent Publication No. In FIG. 22, reference numeral 1 denotes an engineering device for editing a program, and a support tool 2 for editing the program.
And a display unit 3. 4 is engineering equipment 1
This is a control device that executes the program edited in the above, and has a control unit 5 that executes the program and a memory 6 that stores the program to be executed.

【0003】次に、動作について説明する。図23は、
同じく特開平9−244717号公報に示された従来の
動作中プログラム変更を支援する機能を有する制御装置
を説明する図である。図23において、A、B、Cはメ
モリ6中のプログラムの構成単位であり、BBはBの変
更後のプログラムである。変更前には、A、B、Cのプ
ログラムがメモリ6上に格納されている。Bを BBに
変更する場合、まずエンジニアリング装置1からメモリ
6上にBBをダウンロードする。次にBBの△△の部分
にJUMP Y命令を挿入し、最後にBの**の部分に
JUMP X命令を挿入する。BBをメモリ6に書込む
間には、変更前のプログラムBが実行される。B’の書
込みが終了し、BBの△△の部分にJUMP Y命令が
挿入された時点で、変更後のプログラムBBが実行でき
るようになるため、Bの**の部分にJUMPX命令が
挿入され、変更後のプログラムBBを実行できるように
する。以上の手順で,動作中のプログラムの変更を可能
としている。
Next, the operation will be described. FIG.
FIG. 2 is a diagram illustrating a control device having a function of supporting a conventional program change during operation disclosed in Japanese Patent Application Laid-Open No. 9-244717. In FIG. 23, A, B, and C are structural units of a program in the memory 6, and BB is a program after B is changed. Before the change, the programs A, B, and C are stored in the memory 6. When changing B to BB, BB is first downloaded from the engineering apparatus 1 to the memory 6. Next, a JUMP Y instruction is inserted into the △△ part of BB, and finally a JUMP X instruction is inserted into the ** part of B. While writing BB to the memory 6, the program B before the change is executed. When the writing of B 'is completed and the JUMP Y instruction is inserted into the △△ portion of BB, the changed program BB can be executed. Therefore, the JUMPX instruction is inserted into the ** portion of B. , So that the changed program BB can be executed. With the above procedure, it is possible to change the running program.

【0004】[0004]

【発明が解決しようとする課題】以上のように構成され
た従来の制御装置は、プログラムの書換えを繰り返す
と、メモリ6上の使用領域が断片化してしまい、それ自
体好ましいものではないが、ここでは特にプログラムの
変更のみに特化している例として引用した。このよう
に、プログラムの変更のみで変更処理が完了するのは、
プログラムが扱うデータが複数のプログラムにより参照
可能なグローバル変数であることを意味している。該当
プログラムのみが扱い、他のプログラムからは参照不可
能な変数であるローカル変数は存在していない場合であ
る。
In the conventional control device constructed as described above, when the rewriting of the program is repeated, the used area on the memory 6 becomes fragmented, which is not preferable in itself. I quoted this as an example that specializes only in changing the program. Thus, the change process is completed only by changing the program,
This means that the data handled by the program is a global variable that can be referenced by a plurality of programs. This is a case where only the relevant program is handled, and there is no local variable that is a variable that cannot be referenced from other programs.

【0005】このようなグローバル変数のみを取扱うプ
ログラムは、エンジニアリング装置における使いまわし
が不便である。ローカル変数は、各プログラムの独立性
を高める作用があり、グローバル変数とは区別される。
複数のプログラムが同一の変数にアクセスできる場合、
どのプログラムがどの変数を書き換えたかという問題が
発生し、デバッグに時間を要するなどの問題点を有して
いる。
A program that handles only such global variables is inconvenient to use in an engineering apparatus. Local variables have the effect of increasing the independence of each program, and are distinguished from global variables.
If multiple programs can access the same variable,
There is a problem that which program has rewritten which variable, and it takes time for debugging.

【0006】この発明は、上記のような課題を解決する
ためになされたものであり、ローカル変数を扱うプログ
ラミング言語で作成されたプログラムにおいても、動作
中プログラムの変更が可能な制御装置を提供することを
第一の目的とする。また、ローカル変数について、アド
レス修飾を行う場合やデータ幅が異なる場合にも対応で
きる制御装置を提供することを第二の目的とする。
SUMMARY OF THE INVENTION The present invention has been made to solve the above-described problem, and provides a control device capable of changing a program during operation even in a program written in a programming language that handles local variables. That is the primary purpose. It is a second object of the present invention to provide a control device that can cope with a case where address modification is performed on a local variable or a case where a data width is different.

【0007】また、変更前のプログラムが使用していた
ローカル変数の値を継続して使用することができる制御
装置を提供することを第三の目的とする。また、ローカ
ル変数を扱わない従来のプログラミング言語で作成され
たプログラムと、ローカル変数を扱うプログラミング言
語で作成されたプログラムが混在して使用できる制御装
置を提供することを第四の目的とする。
It is a third object of the present invention to provide a control device capable of continuously using the values of local variables used by the program before the change. It is a fourth object of the present invention to provide a control device that can use a program created in a conventional programming language that does not handle local variables and a program created in a programming language that handles local variables in a mixed manner.

【0008】[0008]

【課題を解決するための手段】この発明に係わる制御装
置においては、プログラムを記憶するプログラム領域
と、プログラムのみが使用するローカル変数を記憶する
ローカル変数領域と、プログラムがプログラム領域に割
付けられたページが記憶されたプログラムページ使用情
報部と、ローカル変数がローカル変数領域に割付けられ
たページが記憶されたローカル変数ページ使用情報部
と、プログラムを編集するエンジニアリング装置から入
力されるプログラム及びこのプログラムのみが使用する
ローカル変数を受信する受信部と、この受信部に受信さ
れたプログラムによって上記プログラム領域を書換える
と共に、上記受信部に受信されたローカル変数によって
上記ローカル変数領域を書換える書換え部を備えたもの
である。
In the control device according to the present invention, a program area for storing a program, a local variable area for storing a local variable used only by the program, and a page in which the program is allocated to the program area. , A local variable page usage information section in which a page in which local variables are allocated to the local variable area is stored, a program input from an engineering device for editing the program, and only this program A receiving unit that receives a local variable to be used, and a rewriting unit that rewrites the program area by a program received by the receiving unit and rewrites the local variable area by the local variable received by the receiving unit. Things.

【0009】また、プログラム中に記述されたローカル
変数の論理アドレスを物理アドレスに変更するときに参
照されるローカル変数ページ管理情報部を備え、書換え
部は、ローカル変数の書換えに合わせてローカル変数ペ
ージ管理情報部を書換えるものである。また、エンジニ
アリング装置から転送されるローカル変数のワード数を
記憶するローカル変数ワード数情報部と、プログラムの
実行時に、ローカル変数ワード数情報部を用いて、ロー
カル変数の論理アドレスの正当性をチェックする不正ア
ドレス検出部を備えたものである。
In addition, a local variable page management information section referred to when a logical address of a local variable described in the program is changed to a physical address is provided, and the rewriting section is adapted to rewrite the local variable page in accordance with the rewriting of the local variable. It rewrites the management information section. Also, the validity of the logical address of the local variable is checked by using the local variable word number information section for storing the number of words of the local variable transferred from the engineering device and the local variable word number information section when executing the program. It has an unauthorized address detection unit.

【0010】さらに、書換え部は、書換え前のローカル
変数の値が引き継がれるように、ローカル変数領域を書
換えるようにしたものである。
Furthermore, the rewriting section rewrites the local variable area so that the value of the local variable before rewriting is inherited.

【0011】また、この制御装置で用いられるプログラ
ムである第一の言語によって記述されたプログラムと、
この第一の言語とは異なる第二の言語によって記述され
たプログラムとを識別する識別部と、第二の言語によっ
て記述されたプログラム中のローカル変数を記憶する第
二のローカル変数領域を備え、書換え部は、識別部によ
って第二の言語であると識別されたプログラムについて
は、第二のローカル変数領域に記憶されたローカル変数
の書換えを行わないものである。
A program described in a first language which is a program used in the control device;
An identification unit that identifies a program described by a second language different from the first language, and a second local variable area that stores a local variable in the program described by the second language, The rewriting unit does not rewrite the local variable stored in the second local variable area for the program identified as the second language by the identification unit.

【0012】[0012]

【発明の実施の形態】実施の形態1.以下、この発明の
実施の形態1を図に基づいて説明する。図1は、この発
明の実施の形態1を示すブロック図である。図1におい
て、8は制御プログラムを実装する制御装置である。9
は制御装置8が実行するプログラムの作成及び制御装置
8の変数のモニタに用いられるエンジニアリング装置で
ある。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Embodiment 1 Hereinafter, a first embodiment of the present invention will be described with reference to the drawings. FIG. 1 is a block diagram showing Embodiment 1 of the present invention. In FIG. 1, reference numeral 8 denotes a control device that implements a control program. 9
Is an engineering device used for creating a program to be executed by the control device 8 and monitoring variables of the control device 8.

【0013】制御装置8は、次ぎのように構成されてい
る。10はプログラムとこのプログラムのみが使用する
変数を格納するプログラム・ローカル変数領域で、プロ
グラムを格納するプログラム領域11と、ローカル変数
を格納するローカル変数領域12と、プログラムの格納
領域の割り当てに用いるプログラム・ページ使用情報1
3と、ローカル変数の格納領域の割り当てに用いるロー
カル変数・ページ使用情報14とを有する。15はプロ
グラムの実行を制御するプログラム実行制御部で、各プ
ログラムがどのページに割り当てられているかを管理す
るプログラム・ページ管理情報16と、各プログラムが
使用するローカル変数が、どのページに割り当てられて
いるかを管理するローカル変数・ページ管理情報17
と、プログラム実行制御部15の制御に従って、プログ
ラム領域11からプログラムを読み出し、これを実行す
る命令実行部18とを有する。19はエンジニアリング
装置9からの要求を処理するエンジニアリング装置要求
処理部で、プログラムの書換えを行うプログラム書換部
20と、エンジニアリング装置9からデータを受信する
受信部21と、エンジニアリング装置9へデータを送信
する送信部22を有する。
The control device 8 is configured as follows. A program / local variable area 10 stores a program and variables used only by the program. A program area 11 stores a program, a local variable area 12 stores a local variable, and a program used to allocate a program storage area.・ Page usage information 1
3 and local variable / page usage information 14 used for allocating a storage area for local variables. Reference numeral 15 denotes a program execution control unit that controls the execution of the program. The program / page management information 16 manages which page each program is assigned to, and the page to which the local variables used by each program are assigned. Variable / page management information 17 for managing
And an instruction execution unit 18 that reads a program from the program area 11 and executes the program under the control of the program execution control unit 15. Reference numeral 19 denotes an engineering device request processing unit that processes a request from the engineering device 9, a program rewriting unit 20 that rewrites a program, a receiving unit 21 that receives data from the engineering device 9, and transmits data to the engineering device 9. It has a transmission unit 22.

【0014】図2は、図1に示す制御装置のローカル変
数・ページ使用情報14の役割を説明する図である。図
2において、ローカル変数・ページ使用情報は、1又は
0の値を持つビットの集まりとして表現される。各ビッ
トは、低位アドレスの最下位ビットから順次、ローカル
変数領域12の各ページに対応づけられる。ここでロー
カル変数のページは、固定長のワード数(1ワードは1
6ビット)を持つブロックであり、これがローカル変数
を割り当てるための単位である。図2に示すように、ロ
ーカル変数・ページ使用情報14のビットの値が1であ
るローカル変数のページは、割当て済み、すなわち使用
中であることを示す。プログラム書換部20は、ローカ
ル変数・ページ使用情報14を検索することにより、ロ
ーカル変数領域12の空き領域を認識することができ
る。また、空き領域を確保する場合は、該当するビット
に1を書き込む。図2では、ローカル変数・ページ使用
情報14と、ローカル変数領域12の関係を説明した
が、プログラム・ページ使用情報13と、プログラム領
域11の関係も同様である。
FIG. 2 is a diagram for explaining the role of the local variable / page usage information 14 of the control device shown in FIG. In FIG. 2, the local variable / page usage information is expressed as a set of bits having a value of 1 or 0. Each bit is associated with each page of the local variable area 12 sequentially from the least significant bit of the lower address. Here, the page of the local variable has a fixed number of words (1 word is 1 word).
6 bits), which is a unit for allocating local variables. As shown in FIG. 2, the page of the local variable in which the value of the bit of the local variable / page usage information 14 is 1 indicates that the page has been allocated, that is, is in use. The program rewriting unit 20 can recognize the free area of the local variable area 12 by searching the local variable / page usage information 14. To secure a free area, 1 is written to the corresponding bit. In FIG. 2, the relationship between the local variable / page usage information 14 and the local variable area 12 has been described, but the relationship between the program page usage information 13 and the program area 11 is also the same.

【0015】図3は、図1に示す制御装置のローカル変
数・ページ管理情報17の役割を説明する図である。図
3において、モジュールとはプログラムの実行単位(し
たがって書換単位でもある)を意味する。ローカル変数
・ページ管理情報17は、各モジュールが使用している
ローカル変数領域12のページを格納しておくためのも
のである。図3には、モジュール0がページ2、3、7
を、モジュール2がページ8、9を使用している様子を
示している。ローカル変数・ページ管理情報17の値が
FF(16進数)の場合は、これ以上ページを使用して
いないことを示す。モジュール1のローカル変数・ペー
ジ管理情報17の値は、全てFFになっているが、これ
はモジュール1が定義されていない場合、あるいはごく
稀れであるがモジュール1が、ローカル変数領域12を
全く使用していないことを示す。図3では、ローカル変
数・ページ管理情報17と、ローカル変数領域12の関
係を説明したが、プログラム・ページ管理情報16と、
プログラム領域11の関係も同様である。
FIG. 3 is a diagram for explaining the role of the local variable / page management information 17 of the control device shown in FIG. In FIG. 3, a module means a program execution unit (and therefore also a rewrite unit). The local variable / page management information 17 is for storing pages of the local variable area 12 used by each module. In FIG. 3, module 0 has pages 2, 3, 7
Shows that the module 2 uses pages 8 and 9. When the value of the local variable / page management information 17 is FF (hexadecimal number), it indicates that the page is not used any more. The values of the local variable / page management information 17 of the module 1 are all FF. This is the case when the module 1 is not defined, or in a very rare case, the module 1 completely stores the local variable area 12. Indicates that it is not used. In FIG. 3, the relationship between the local variable / page management information 17 and the local variable area 12 has been described.
The same applies to the relationship between the program areas 11.

【0016】図4は、図1に示す制御装置のローカル変
数・ページ管理情報17を用いて、論理アドレスから物
理アドレスへの変換を説明する図である。ここで論理ア
ドレスとは、変数を指定するためのもので、実際のプロ
グラムに書き込まれているものである。一方、物理アド
レスとは、メモリ上の実際の変数のアドレスを示すもの
である。例えば、論理アドレスが同一であっても、モジ
ュールが異なれば物理アドレスは異なる。
FIG. 4 is a diagram for explaining the conversion from a logical address to a physical address using the local variable / page management information 17 of the control device shown in FIG. Here, the logical address is used to designate a variable and is written in an actual program. On the other hand, the physical address indicates the address of an actual variable on the memory. For example, even if the logical address is the same, the physical address is different if the module is different.

【0017】図4に示されるように、論理アドレスは、
論理ページ番号と、ページ内オフセットとで構成され
る。ページ内オフセットは、論理アドレスと物理アドレ
スで共通である。論理ページ番号とモジュール番号を組
み合わせると、図3で説明したローカル変数・ページ管
理情報17のベースアドレスからのオフセットが算出で
きる。このオフセットに対応するローカル変数・ページ
管理情報17の値が、アクセスすべきページ番号であ
る。物理アドレスは、上記の手続きで読み出したページ
番号とページ内オフセットにより構成される。図4にお
けるローカル変数の論理アドレスから物理アドレスへの
変換は、ローカル変数へのアクセスが必要になった場合
に、命令実行部18が行う。図4では、ローカル変数に
おける論理アドレスから物理アドレスへの変換を説明し
たが、プログラムにおける論理アドレスから物理アドレ
スへの変換も同様である。
As shown in FIG. 4, the logical address is
It consists of a logical page number and an offset within the page. The intra-page offset is common to the logical address and the physical address. By combining the logical page number and the module number, an offset from the base address of the local variable / page management information 17 described with reference to FIG. 3 can be calculated. The value of the local variable / page management information 17 corresponding to this offset is the page number to be accessed. The physical address is composed of the page number read in the above procedure and the offset within the page. The conversion of the local variable from the logical address to the physical address in FIG. 4 is performed by the instruction execution unit 18 when the local variable needs to be accessed. FIG. 4 illustrates the conversion of a logical address from a physical address to a physical address in a local variable, but the same applies to the conversion of a logical address into a physical address in a program.

【0018】図5は、この発明の実施の形態1による制
御装置にエンジニアリング装置から転送されるデータの
転送フォーマットを示す図である。図5の転送データに
は、プログラムの実行単位であるモジュールの一意性を
示すモジュール番号、転送されるプログラムのワード
数、転送されるローカル変数のワード数、プログラムの
内容、ローカル変数の内容が含まれる。
FIG. 5 is a diagram showing a transfer format of data transferred from the engineering device to the control device according to the first embodiment of the present invention. The transfer data of FIG. 5 includes a module number indicating the uniqueness of a module which is an execution unit of the program, the number of words of the transferred program, the number of words of the transferred local variable, the contents of the program, and the contents of the local variable. It is.

【0019】図6は、この発明の実施の形態1による制
御装置の動作を説明するフローチャートである。図7
は、この発明の実施の形態1による制御装置の動作結果
を説明する図である。図8は、この発明の実施の形態1
による制御装置の効果を説明する図である。
FIG. 6 is a flowchart illustrating the operation of the control device according to the first embodiment of the present invention. FIG.
FIG. 4 is a diagram for explaining an operation result of the control device according to the first embodiment of the present invention. FIG. 8 shows Embodiment 1 of the present invention.
FIG. 6 is a diagram for explaining the effect of the control device according to FIG.

【0020】次に、動作について図6に基づき、説明す
る。図1の受信部21が、図5で示される転送データを
受け取ると、図1のプログラム書換部20が動作する。
図6のフローチャートは、このときのプログラム書換部
20の動作を示すものである。プログラム書換部20
は、転送データのプログラムワード数とローカル変数ワ
ード数から必要となる領域を算出した上で、プログラム
・ページ使用情報13とローカル変数・ページ使用情報
14を検索し、空き領域があるかをチェックする(S1
−1)。空き領域がない場合は、異常終了をエンジニア
リング装置9に通知して処理を終了する(S1−1
1)。空き領域がある場合は、領域を取得し(S1−
2)、プログラム用に取得した領域に転送データのプロ
グラムの内容をコピーする(S1−3)。次にローカル
変数用に取得した領域に、転送データのローカル変数の
内容をコピーする(S1−4)。
Next, the operation will be described with reference to FIG. When the receiving section 21 of FIG. 1 receives the transfer data shown in FIG. 5, the program rewriting section 20 of FIG. 1 operates.
The flowchart of FIG. 6 shows the operation of the program rewriting unit 20 at this time. Program rewriting unit 20
Calculates the required area from the number of program words and the number of local variable words of the transfer data, searches the program page usage information 13 and the local variable / page usage information 14, and checks whether there is an empty area. (S1
-1). If there is no free area, the abnormal end is notified to the engineering apparatus 9 and the processing is terminated (S1-1).
1). If there is a free area, the area is acquired (S1-
2) Copy the contents of the program of the transfer data to the area acquired for the program (S1-3). Next, the contents of the local variables of the transfer data are copied to the area obtained for the local variables (S1-4).

【0021】次に、書換対象となるモジュールの実行状
態を調べる(S1−5)。対象モジュールが実行中の場
合は、実行完了まで待つ。フローチャートは、モジュー
ル状態が実行中の場合は、インループするような記載に
なっているが、実際にはプログラムを実行させるタスク
とプログラム書換部20のタスクには、各々CPU時間
が割り当てられているので、インループすることはな
い。モジュール実行中でない、または実行中のモジュー
ルが実行完了した場合は、モジュール状態を書換中に変
更し(S1−6)、変更前のモジュールが使用していた
プログラム領域11とローカル変数領域12を解放する
処理を行う(S1−7)。ここで領域を開放する処理と
は、対象となるモジュールのページ管理情報を参照して
ページ番号を求め、該当するページ使用情報のビットを
0にする(未使用に戻す)処理であり、プログラムおよ
びローカル変数において各々実施される。
Next, the execution state of the module to be rewritten is checked (S1-5). If the target module is running, wait until the execution is completed. In the flowchart, when the module state is being executed, the description indicates that an in-loop occurs. However, in practice, a CPU time is allocated to each of a task for executing a program and a task of the program rewriting unit 20. So there is no in-loop. If the module is not being executed or the module being executed is completed, the module state is changed to rewriting (S1-6), and the program area 11 and the local variable area 12 used by the module before the change are released. (S1-7). Here, the process of releasing an area is a process of obtaining a page number with reference to the page management information of a target module, and setting a bit of the corresponding page use information to 0 (returning it to unused). Each is performed on a local variable.

【0022】次に、モジュールの実行管理情報を変更す
る(S1−8)。確保した領域のページ番号を、ページ
管理情報に書き込む処理などを行う。次に、書換中とし
たモジュール状態を実行可能に変更する(S1−9)。
これで書換えが完了したことになる。最後に正常終了を
エンジニアリング装置9に伝えて(S1−10)、処理
を終了する。
Next, the execution management information of the module is changed (S1-8). A process of writing the page number of the secured area into the page management information is performed. Next, the state of the module that is being rewritten is changed to executable (S1-9).
This completes the rewriting. Finally, the normal end is transmitted to the engineering apparatus 9 (S1-10), and the process is ended.

【0023】図7は、上記で説明した動作により、プロ
グラム領域11とローカル変数領域12がどのように変
化するかを説明する図である。図7において、書換対象
となるモジュールは、モジュール0であり、書換前に
は、プログラム領域11のページ0とページ1、ローカ
ル変数領域12のページ0を使用している。モジュール
0に相当するプログラムを変更し、プログラム領域11
として3ページ、ローカル変数領域12として2ページ
必要になった場合、転送データをフォーマットに従って
制御装置8にダウンロードする。制御装置8では、図6
のフローチャートにもとづき、書換処理を行う。書換後
には、モジュール0は、プログラム領域11のページ5
とページ6とページ9、ローカル変数領域12のページ
1とページ7を使用しており、書換前に使用していた領
域は解放されている。
FIG. 7 is a diagram for explaining how the program area 11 and the local variable area 12 are changed by the operation described above. In FIG. 7, the module to be rewritten is module 0, and uses page 0 and page 1 of the program area 11 and page 0 of the local variable area 12 before rewriting. The program corresponding to the module 0 is changed, and the program area 11 is changed.
When three pages are required and two pages are required as the local variable area 12, the transfer data is downloaded to the control device 8 according to the format. In the control device 8, FIG.
The rewriting process is performed based on the flowchart of FIG. After rewriting, the module 0 stores page 5 of the program area 11.
And pages 6 and 9 and pages 1 and 7 of the local variable area 12 are used, and the areas used before rewriting are released.

【0024】図8は、この発明の実施の形態1の効果を
説明する図である。実施の形態1では、プログラム書換
部20でローカル変数の書換を行うことにより、各モジ
ュールが固有にアクセスするローカル変数を扱うことが
でき、独立性の高いモジュール(プログラム)を制御装
置で実行させることが可能になった。従来例において
は、各モジュールが共通にアクセスできる変数しか用意
されていないため、モジュール固有の変数のつもりでプ
ログラムを作成しても、他のモジュールがアクセスして
しまい、思わぬ動作をしてしまう可能性がある。これに
対して、実施の形態1のプログラム書換部20を備えた
制御装置8では、モジュール固有のローカル変数に対し
て、他のモジュールがアクセスすることはできない。プ
ログラムの独立性が高いということは、具体的には以上
のようなことであり、デバッグに要する時間を削減する
ことにより、プログラム生産性を向上させることができ
るという効果がある。
FIG. 8 is a diagram for explaining the effect of the first embodiment of the present invention. In the first embodiment, by rewriting the local variables in the program rewriting unit 20, each module can handle a local variable uniquely accessed, and a highly independent module (program) can be executed by the control device. Is now possible. In the conventional example, only variables that can be commonly accessed by each module are prepared, so even if a program is created with the intention of module-specific variables, other modules will access it and unexpected behavior will occur there is a possibility. On the other hand, in the control device 8 including the program rewriting unit 20 according to the first embodiment, other modules cannot access local variables unique to the module. The high independence of the program is specifically as described above, and there is an effect that the program productivity can be improved by reducing the time required for debugging.

【0025】また、ローカル変数は、論理アドレスが同
じであっても、モジュールが異なれば異なる物理アドレ
スにマッピングされるため、プログラムのコピーによる
流用性を高め、プログラム生産性を向上させるという効
果もある。また、従来例では、変数の初期化をプログラ
ムで行う必要があったが、実施の形態1では、初期化さ
れたローカル変数の値を、エンジニアリング装置9から
転送できるので、プログラムの初期化部を作成する必要
がなくなり、生産性を向上させることができる。
Further, even if the logical address is the same, the local variable is mapped to a different physical address if the module is different, so that there is an effect that the diversion by copying the program is improved and the program productivity is improved. . Further, in the conventional example, it was necessary to initialize the variables by a program. However, in the first embodiment, the initialized values of the local variables can be transferred from the engineering device 9. There is no need to create it, and productivity can be improved.

【0026】実施の形態2.図9は、この発明の実施の
形態2による制御装置を示すブロック図であり、図1に
示すブロック図に比較して、不正アドレス検出部とロー
カル変数・ワード数情報が加えられている。図9におい
て、8〜22は図1におけるものと同一のものである。
23は不正アドレス検出部で、命令実行時にアクセスす
る変数の論理アドレスの正当性をチェックする。24は
ローカル変数・ワード数情報で、不正アドレス検出部2
3によるチェックにおいて使用されるものであり、各モ
ジュールについて、図5に示すローカル変数のワード数
の値を保持している。図5の転送データから、ローカル
変数・ワード数情報24に値をコピーする処理は、図6
のフローチャートのS1−8にて実施することができ
る。
Embodiment 2 FIG. FIG. 9 is a block diagram showing a control device according to a second embodiment of the present invention. Compared with the block diagram shown in FIG. 1, an illegal address detection unit and local variable / word number information are added. 9, 8 to 22 are the same as those in FIG.
Reference numeral 23 denotes an illegal address detection unit that checks the validity of a logical address of a variable accessed when executing an instruction. Reference numeral 24 denotes local variable / word number information.
3, and holds the value of the number of words of the local variable shown in FIG. 5 for each module. The process of copying the value from the transfer data of FIG. 5 to the local variable / word number information 24
Can be carried out in S1-8 of the flowchart of FIG.

【0027】図10は、この発明の実施の形態2による
制御装置のアドレス修飾について説明する図である。図
10は、ローカル変数の論理アドレスが、プログラムに
書かれている論理アドレスと修飾要素を加算したものに
なることを示している。修飾要素が相応しいものでなけ
れば、修飾後の論理アドレスが不正なものになる可能性
があるため、チェックが必要である。図11は、この発
明の実施の形態2による制御装置の動作を説明するフロ
ーチャートである。
FIG. 10 is a diagram for explaining address modification of the control device according to the second embodiment of the present invention. FIG. 10 shows that the logical address of the local variable is the sum of the logical address written in the program and the modifier. If the qualifying element is not appropriate, the logical address after the qualification may be incorrect, so a check is required. FIG. 11 is a flowchart illustrating an operation of the control device according to the second embodiment of the present invention.

【0028】次に、動作について図11を用いて説明す
る。図11は、命令実行部18においてローカル変数に
アクセスする必要が生じた場合に、不正アドレス検出部
23にて行う処理を示している。まず、アドレス修飾を
行うか否かをチェックする(S2−1)。アドレス修飾
を行う場合は、修飾された論理アドレスを算出する(S
2−2)。アドレス修飾を行わない場合は、何もせず、
S2−3に移る。次に比較用変数に論理アドレスの値を
コピーする(S2−3)。ここで、比較用変数は、ロー
カル変数・ワード数情報24と比較するための変数であ
る。次に、アクセスするローカル変数のデータ幅を調べ
る(S2−4)。ここでは、16ビット、32ビット、
64ビットのデータ幅を扱っているものとする。データ
幅が16ビット(1ワード)の場合は何もせず、S2−
7に移る。データ幅が32ビットの場合は、2ワードに
なるので比較用変数に1を加算する(S2−5)。デー
タ幅が64ビットの場合は、4ワードになるので比較用
変数に3を加算する(S2−6)。次に、比較用変数と
ローカル変数・ワード数情報24に保持されている該当
モジュールのワード数との比較を行う(S2−7)。こ
こでは論理アドレスが負の数でないことと、比較用変数
が、ローカル変数・ワード数情報24に保持されている
該当モジュールのワード数以上でないことがチェックさ
れる。不正である場合は、不正アドレス検出を記録し
(S2−10)、処理を終了する。正常である場合は、
論理アドレスから物理アドレスに変換し(S2−8)、
ローカル変数にアクセスして(S2−9)、処理を終了
する。
Next, the operation will be described with reference to FIG. FIG. 11 shows a process performed by the illegal address detection unit 23 when the instruction execution unit 18 needs to access a local variable. First, it is checked whether address modification is performed (S2-1). When performing address modification, a qualified logical address is calculated (S
2-2). If you do not do address qualification, do nothing,
Move to S2-3. Next, the value of the logical address is copied to a comparison variable (S2-3). Here, the comparison variable is a variable for comparison with the local variable / word number information 24. Next, the data width of the local variable to be accessed is checked (S2-4). Here, 16 bits, 32 bits,
It is assumed that a data width of 64 bits is handled. If the data width is 16 bits (one word), nothing is performed, and S2-
Move to 7. If the data width is 32 bits, it becomes 2 words, so 1 is added to the comparison variable (S2-5). If the data width is 64 bits, the data length is 4 words, so 3 is added to the comparison variable (S2-6). Next, the comparison variable is compared with the word number of the corresponding module stored in the local variable / word number information 24 (S2-7). Here, it is checked that the logical address is not a negative number and that the comparison variable is not more than the number of words of the corresponding module stored in the local variable / word number information 24. If it is invalid, the detection of the illegal address is recorded (S2-10), and the process is terminated. If normal,
The logical address is converted to the physical address (S2-8),
The local variable is accessed (S2-9), and the process ends.

【0029】次に、実施の形態2の効果について説明す
る。図10に示すようなアドレス修飾は、配列変数への
アクセスに用いられる。ベースとなる論理アドレスに、
修飾要素を加算する、変数にアクセスする、修飾要素を
インクリメントする、論理アドレスに修飾要素を加算す
る、変数にアクセスするという操作を繰り返すことによ
り、ベースとなる論理アドレスを起点とする配列変数に
アクセスすることができる。
Next, the effect of the second embodiment will be described. The address modification as shown in FIG. 10 is used for accessing an array variable. In the base logical address,
Accessing array variables starting from the base logical address by repeating the operations of adding a qualifier, accessing a variable, incrementing a qualifier, adding a qualifier to a logical address, and accessing a variable can do.

【0030】制御装置8が、不正アドレス検出部23を
備えたことにより、モジュール固有のローカル変数とい
う枠組みを維持したまま、配列変数を扱うことができる
という効果がある。また、不正アドレス検出部23は、
データ幅に応じたチェック機構を備えているので、デー
タ幅が異なる場合にも適用できる。
The provision of the illegal address detection section 23 in the control device 8 has an effect that array variables can be handled while maintaining the framework of module-specific local variables. Also, the unauthorized address detection unit 23
Since a check mechanism according to the data width is provided, the present invention can be applied even when the data width is different.

【0031】実施の形態3.図12は、この発明の実施
の形態3による制御装置を示すブロック図である。図9
に示すブロック図に比較して、ローカル変数・引継用テ
ーブルとローカル変数・引継用ページ管理情報が追加さ
れている。図12において、8〜24は図9におけるも
のと同一のものである。25はプログラム実行制御部1
5に設けられたローカル変数・引継用テーブル、26は
プログラム実行制御部15に設けられたローカル変数・
引継用ページ管理情報である。
Embodiment 3 FIG. 12 is a block diagram showing a control device according to Embodiment 3 of the present invention. FIG.
Compared with the block diagram shown in FIG. 7, a local variable / takeover table and local variable / takeover page management information are added. 12, 8 to 24 are the same as those in FIG. 25 is a program execution control unit 1
5 is a local variable / takeover table provided in the program execution control unit 15.
It is takeover page management information.

【0032】図13は、この発明の実施の形態3による
制御装置にエンジニアリング装置から転送されるデータ
のフォーマットを示す図である。図13において、モジ
ュール番号、プログラムのワード数、プログラムの内容
については、図5の転送データフォーマットで説明した
通りである。図13のフォーマットは、変更前のモジュ
ールが使用している全て又は一部のローカル変数の値
を、変更後のプログラムが継続して使用できるようにす
ることを目的としている。また、変更後のプログラム
が、新規にローカル変数を追加することも可能にされて
いる。
FIG. 13 is a diagram showing a format of data transferred from the engineering device to the control device according to the third embodiment of the present invention. In FIG. 13, the module number, the number of words of the program, and the contents of the program are as described in the transfer data format of FIG. The format shown in FIG. 13 is intended to make it possible for the program after the change to continuously use the values of all or some local variables used by the module before the change. Further, the changed program can add a new local variable.

【0033】図14は、この発明の実施の形態3による
制御装置の変更後のローカル変数が、変更前のローカル
変数の一部(又は全て)及び追加されたローカル変数に
より構成される様子を示す図である。図13に戻って、
変更後ローカル変数のワード数は、変更前のローカル変
数の一部(又は全て)のワード数と、追加されるローカ
ル変数のワード数を合計したワード数である。変更前ロ
ーカル変数のワード数は、変更前のモジュールが使用し
ているローカル変数のワード数である。追加ローカル変
数のワード数は、今回追加されるローカル変数のワード
数である。追加ローカル変数の内容は、転送データに含
まれている。コピー元ビット列とコピー先ビット列は、
後述するように変更後ローカル変数を構成するために使
用される。
FIG. 14 shows a state in which the changed local variables of the control device according to the third embodiment of the present invention are constituted by a part (or all) of the local variables before the change and the added local variables. FIG. Returning to FIG.
The number of words of the local variable after change is the total number of words of a part (or all) of the local variable before change and the number of words of the added local variable. The word number of the local variable before the change is the word number of the local variable used by the module before the change. The word number of the added local variable is the word number of the local variable added this time. The contents of the additional local variables are included in the transfer data. The copy source bit string and the copy destination bit string
It is used to configure local variables after modification as described below.

【0034】図15は、この発明の実施の形態3による
制御装置のコピー元ビット列とコピー先ビット列を説明
する図である。図15において、コピー元ビット列の各
ビットは、変更前ローカル変数の各論理アドレスに対応
する。ビットの値が1であれば、変更後のローカル変数
に引継ぐべき変数であることを示し、値が0であれば、
その変数は廃棄される。コピー先ビット列の各ビット
は、変更後ローカル変数の各論理アドレスに対応する。
ビットの値が1であればコピー元が追加ローカル変数で
あることを示し、値が0であればコピー元が変更前ロー
カル変数であることを示す。
FIG. 15 is a diagram illustrating a copy source bit string and a copy destination bit string of the control device according to the third embodiment of the present invention. In FIG. 15, each bit of the copy source bit string corresponds to each logical address of the local variable before change. If the value of the bit is 1, it indicates that the variable should be inherited by the changed local variable. If the value is 0,
The variable is discarded. Each bit of the copy destination bit string corresponds to each logical address of the changed local variable.
A bit value of 1 indicates that the copy source is an additional local variable, and a value of 0 indicates that the copy source is a local variable before change.

【0035】図16は、図12のローカル変数・引継用
テーブル25を説明する図である。図16において、ロ
ーカル変数・引継用テーブル25は、上述したコピー元
ビット列とコピー先ビット列をもとに作成される。変更
前ローカル変数の論理アドレスをオフセットにとり、内
容は変更後ローカル変数の論理アドレスと引継ビットに
なっている。引継ビットが1の場合は、変更前ローカル
変数論理アドレスの内容が、変更後ローカル変数に引継
がれることを示し、変更後ローカル変数論理アドレスが
その行先を指定する。0の場合は、変更前ローカル変数
論理アドレスが廃却されることを示す(この場合は、行
先は無効である)。
FIG. 16 is a diagram for explaining the local variable / takeover table 25 of FIG. In FIG. 16, the local variable / takeover table 25 is created based on the above-described copy source bit string and copy destination bit string. The logical address of the local variable before the change is taken as an offset, and the contents are the logical address of the local variable after the change and the inherited bits. If the takeover bit is 1, it indicates that the contents of the pre-change local variable logical address are to be taken over by the post-change local variable, and the post-change local variable logical address specifies its destination. A value of 0 indicates that the pre-change local variable logical address is discarded (in this case, the destination is invalid).

【0036】図17は、図12のローカル変数・引継用
ページ管理情報26を説明する図である。図17におけ
るフォーマットは、ローカル変数・ページ管理情報17
と同じである。このローカル変数・引継用ページ管理情
報26は、変更後のローカル変数・ページ管理情報17
と同じ内容を持つ。図18は、この発明の実施の形態3
による制御装置のプログラム書換部の動作を示すフロー
チャートである。図19は、この発明の実施の形態3に
よる制御装置のプログラム実行制御部の動作を示すフロ
ーチャートである。
FIG. 17 is a view for explaining the local variable / takeover page management information 26 of FIG. The format in FIG. 17 is the local variable / page management information 17
Is the same as The local variable / takeover page management information 26 includes the changed local variable / page management information 17.
Has the same content as FIG. 18 shows Embodiment 3 of the present invention.
Is a flowchart showing the operation of the program rewriting unit of the control device according to the first embodiment. FIG. 19 is a flowchart showing the operation of the program execution control unit of the control device according to Embodiment 3 of the present invention.

【0037】次に、動作について図18を用いて説明す
る。実施の形態3は、プログラム書換部20とプログラ
ム実行制御部15の協調動作により実現される。図6の
フローチャートに比較すると、S1−4の処理の代わり
に、S3A−1、S3A−2、S3A−3の処理が行わ
れる。また、S3A−4の処理が追加されている。S1
−1からS1−11の処理(S1−4を除く)について
は、実施の形態1と同様であるので、その説明を省略す
る。
Next, the operation will be described with reference to FIG. Embodiment 3 is realized by the cooperative operation of the program rewriting unit 20 and the program execution control unit 15. Compared to the flowchart of FIG. 6, the processing of S3A-1, S3A-2, and S3A-3 is performed instead of the processing of S1-4. Further, the process of S3A-4 is added. S1
The processes from -1 to S1-11 (except for S1-4) are the same as those in the first embodiment, and a description thereof will be omitted.

【0038】S3A−1では、取得した領域に追加ロー
カル変数をコピーする。転送データのローカル変数各々
を、低位の論理アドレスのものから順番にコピーする。
コピー先は、転送データのコピー先ビット列により決定
する。コピー先ビット列の値が1であれば、追加ローカ
ル変数のコピーを行う。S3A−2では、変更中フラグ
をONする。変更中フラグは、プログラム実行制御部1
5が参照する。
In S3A-1, an additional local variable is copied to the obtained area. Each local variable of the transfer data is copied in order from the one at the lower logical address.
The copy destination is determined by the copy destination bit string of the transfer data. If the value of the copy destination bit string is 1, the additional local variable is copied. In S3A-2, the changing flag is turned ON. The changing flag is set in the program execution control unit 1
5 references.

【0039】S3A−3では、取得した領域に、変更前
ローカル変数をコピーする。コピー元の論理アドレス
は、コピー元ビット列の値が1であるものから求める。
コピー先の論理アドレスは、コピー先ビット列の値が0
であるものから求める。処理は変更前ローカル変数の低
位の論理アドレスのものから順番に行う。この処理に並
行して、図12のローカル変数・引継用テーブル25が
作成される。引継ぎが必要なものについては、引継ビッ
トを1にし、変更後ローカル変数論理アドレスを書込
む。引継ぎが不要なものについては、引継ビットを0に
する。引継ビットは0で初期化されるので、コピーが終
了していないものについては、引継ビットは0のままと
なる。S3A−4では、変更中フラグをOFFにする。
このようにして、ローカル変数の書換えを行うと共に、
ローカル変数・引継用テーブル25の作成を行う。
In S3A-3, the local variables before change are copied to the acquired area. The logical address of the copy source is obtained from the copy source bit string whose value is 1.
For the logical address of the copy destination, the value of the copy destination bit string is 0.
Find from what is. Processing is performed in order from the lower logical address of the local variable before change. In parallel with this processing, the local variable / takeover table 25 of FIG. 12 is created. For those that need to be inherited, the inherited bit is set to 1 and the logical address of the local variable is written after the change. For those that do not need takeover, the takeover bit is set to 0. Since the takeover bit is initialized to 0, the takeover bit remains at 0 if the copy has not been completed. In S3A-4, the changing flag is turned off.
In this way, while rewriting the local variables,
The local variable / takeover table 25 is created.

【0040】次に、図19を用いて、プログラム実行制
御部15の動作を説明する。プログラム書換とプログラ
ム実行は、CPU処理上は時分割されている。図19
は、ローカル変数へのストア命令が発生した場合の処理
である。図19において、変更中フラグがONであるか
チェックする(S3B−1)。変更中フラグがOFFの
場合は、通常のストア命令の処理を行い(S3B−
7)、処理を終了する。変更中フラグがONの場合は、
現在実行中のモジュールが書換中のモジュールであるか
チェックする(S3B−2)。実行中モジュールが書換
中モジュールでない場合は、通常のストア命令の処理を
行い(S3B−7)、処理を終了する。
Next, the operation of the program execution control unit 15 will be described with reference to FIG. Program rewriting and program execution are time-divided in CPU processing. FIG.
Is a process when a store instruction to a local variable occurs. In FIG. 19, it is checked whether the changing flag is ON (S3B-1). When the changing flag is OFF, a normal store instruction is processed (S3B-
7), end the processing. When the changing flag is ON,
It is checked whether the module currently being executed is a module being rewritten (S3B-2). If the module being executed is not the module being rewritten, a normal store instruction process is performed (S3B-7), and the process ends.

【0041】実行中モジュールが、書換中モジュールの
場合は、変更前ローカル変数論理アドレスにライトする
(S3B−3)。この場合には、該当するモジュールの
ローカル変数・ページ管理情報17を使用してアクセス
を行う。次にローカル変数・引継用テーブル25を参照
し(S3B−4)、引継ビットの値をチェックする(S
3B−5)。引継ビットの値が0の場合は、変更後ロー
カル変数に反映されないものであるので、処理を終了す
る。引継ビットの値が1の場合は、変更後ローカル変数
論理アドレスにライトする(S3B−6)。この場合に
は、ローカル変数・引継用ページ管理情報26を使用し
てアクセスを行う。
If the module being executed is a module being rewritten, it is written to the pre-change local variable logical address (S3B-3). In this case, access is performed using the local variable / page management information 17 of the corresponding module. Next, the value of the takeover bit is checked with reference to the local variable / takeover table 25 (S3B-4).
3B-5). If the value of the takeover bit is 0, the change is not reflected in the local variable, and the process ends. If the value of the takeover bit is 1, the data is written to the changed local variable logical address (S3B-6). In this case, access is performed using the local variable / takeover page management information 26.

【0042】次に、実施の形態3の効果について説明す
る。実施の形態3は、プログラム変更前のローカル変数
の値を、プログラム変更後にも継続して使用できるとい
う効果がある。例えば、制御プログラムに使用されるタ
イマ命令において、計数中の値がローカル変数に保持さ
れるので、変更前までに計数した値を変更後にも継続し
て使用することができる。ローカル変数の追加も可能で
あるため、変更前のプログラムとローカル変数をそのま
ま流用し、プログラムとローカル変数について、新規に
必要になった部分のみ追加するという使い方もできる。
Next, the effect of the third embodiment will be described. The third embodiment has an effect that the values of the local variables before the program change can be continuously used after the program change. For example, in the timer instruction used in the control program, the value being counted is held in the local variable, so that the value counted before the change can be continuously used after the change. Since local variables can be added, the program and local variables before the change can be used as they are, and only the newly needed parts of the program and local variables can be added.

【0043】実施の形態4.図20は、この発明の実施
の形態4による制御装置の従来のプログラムと混在させ
る場合のローカル変数・ページ使用情報を説明する図で
ある。図2に示すローカル変数・ページ使用情報の説明
では、従来プログラム(第二の言語によるプログラム)
のローカル変数領域については扱っていないが、図20
に示すようにローカル変数・ページ使用情報の指し示す
領域の意味を変えることにより、従来プログラム用のロ
ーカル変数領域(第二のローカル変数領域)を設けるこ
とができる。また、従来プログラムを、この発明のプロ
グラム(第一の言語によるプログラム)と識別するため
の識別部が設けられている。図21は、この発明の実施
の形態4による制御装置のプログラム書換部の動作を示
すフローチャートである。
Embodiment 4 FIG. FIG. 20 is a diagram for explaining local variable / page usage information when the control device according to the fourth embodiment of the present invention is mixed with a conventional program. In the description of the local variable / page usage information shown in FIG. 2, a conventional program (a program in a second language)
20 does not deal with the local variable area of FIG.
By changing the meaning of the area pointed to by the local variable / page usage information as shown in (1), a local variable area (second local variable area) for a conventional program can be provided. Further, an identification unit for identifying a conventional program from the program of the present invention (program in the first language) is provided. FIG. 21 is a flowchart showing the operation of the program rewriting section of the control device according to Embodiment 4 of the present invention.

【0044】次に、動作について図21を用いて説明す
る。図21において、まず、従来言語のプログラムかど
うかを識別部によってチェックする(S4−1)。従来
言語のプログラムの場合は、ローカル変数の割当て処理
は不要であるため、プログラムの書換処理のみ行い(S
4−4)、処理を終了する。従来言語でない場合は、実
施の形態1で説明したように、プログラムの書換処理
(S4−2)と、ローカル変数の書換処理(S4−3)
を行い、処理を終了する。
Next, the operation will be described with reference to FIG. In FIG. 21, first, the identification unit checks whether the program is a conventional language program (S4-1). In the case of a conventional language program, since local variable assignment processing is unnecessary, only program rewriting processing is performed (S
4-4), the process ends. If the language is not the conventional language, as described in the first embodiment, the program rewriting process (S4-2) and the local variable rewriting process (S4-3)
Is performed, and the process ends.

【0045】次に、実施の形態4の効果について説明す
る。ローカル変数・ページ使用情報14は、従来言語で
書かれたプログラムのローカル変数の領域を対象外とし
ているため、従来言語のプログラムとの共存ができると
いう効果がある。例えば、従来言語で書かれた部分はそ
のまま流用し、新規に機能を追加するものについては、
ローカル変数を扱う言語にて、プログラムを記述するこ
とができるようになる。
Next, effects of the fourth embodiment will be described. Since the local variable / page usage information 14 excludes the area of the local variable of the program written in the conventional language, there is an effect that it can coexist with the program in the conventional language. For example, if a part written in a conventional language is used as it is and new functions are added,
You can write programs in languages that handle local variables.

【0046】[0046]

【発明の効果】この発明は、以上説明したように構成さ
れているので、以下に示すような効果を奏する。プログ
ラムを記憶するプログラム領域と、プログラムのみが使
用するローカル変数を記憶するローカル変数領域と、プ
ログラムがプログラム領域に割付けられたページが記憶
されたプログラムページ使用情報部と、ローカル変数が
ローカル変数領域に割付けられたページが記憶されたロ
ーカル変数ページ使用情報部と、プログラムを編集する
エンジニアリング装置から入力されるプログラム及びこ
のプログラムのみが使用するローカル変数を受信する受
信部と、この受信部に受信されたプログラムによって上
記プログラム領域を書換えると共に、上記受信部に受信
されたローカル変数によって上記ローカル変数領域を書
換える書換え部を備えたので、プログラムの動作中にプ
ログラム及びローカル変数の書換えを可能にしている。
Since the present invention is configured as described above, it has the following effects. A program area for storing the program, a local variable area for storing local variables used only by the program, a program page usage information section for storing pages allocated to the program area in the program, and a local variable for the local variable area. A local variable page use information section in which the allocated pages are stored, a program input from an engineering device for editing the program and a receiving section for receiving a local variable used only by the program, and a receiving section for receiving the program. Since the program area is rewritten by the program and the local variable area is rewritten by the local variable received by the receiving section, the rewriting section is provided, so that the program and the local variables can be rewritten during the operation of the program. .

【0047】また、プログラム中に記述されたローカル
変数の論理アドレスを物理アドレスに変更するときに参
照されるローカル変数ページ管理情報部を備え、書換え
部は、ローカル変数の書換えに合わせてローカル変数ペ
ージ管理情報部を書換えるので、書換え後のプログラム
の実行中、ローカル変数の物理アドレスにアクセスする
ことができる。また、エンジニアリング装置から転送さ
れるローカル変数のワード数を記憶するローカル変数ワ
ード数情報部と、プログラムの実行時に、ローカル変数
ワード数情報部を用いて、ローカル変数の論理アドレス
の正当性をチェックする不正アドレス検出部を備えたの
で、ローカル変数の論理アドレスの正当性がチェックで
きる。
The local variable page management information section referred to when a logical address of a local variable described in a program is changed to a physical address is provided. Since the management information section is rewritten, the physical address of the local variable can be accessed during the execution of the rewritten program. Also, the validity of the logical address of the local variable is checked by using the local variable word number information section for storing the number of words of the local variable transferred from the engineering device and the local variable word number information section when executing the program. With the provision of the illegal address detection unit, the validity of the logical address of the local variable can be checked.

【0048】さらに、書換え部は、書換え前のローカル
変数の値が引き継がれるように、ローカル変数領域を書
換えるようにしたので、書換え前の変数値を書換え後に
も引き継ぎ使用することができる。
Further, since the rewriting unit rewrites the local variable area so that the value of the local variable before rewriting is inherited, the variable value before rewriting can be used after rewriting.

【0049】また、この制御装置で用いられるプログラ
ムである第一の言語によって記述されたプログラムと、
この第一の言語とは異なる第二の言語によって記述され
たプログラムとを識別する識別部と、第二の言語によっ
て記述されたプログラム中のローカル変数を記憶する第
二のローカル変数領域を備え、書換え部は、識別部によ
って第二の言語であると識別されたプログラムについて
は、第二のローカル変数領域に記憶されたローカル変数
の書換えを行わないので、言語の異なるプログラムが混
在していてもよい。
A program described in a first language, which is a program used in the control device,
An identification unit that identifies a program described by a second language different from the first language, and a second local variable area that stores a local variable in the program described by the second language, The rewriting unit does not rewrite the local variable stored in the second local variable area for the program identified by the identification unit as being in the second language, so that programs in different languages are mixed. Good.

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

【図1】 この発明の実施の形態1による制御装置を示
すブロック図である。
FIG. 1 is a block diagram showing a control device according to a first embodiment of the present invention.

【図2】 図1に示す制御装置のローカル変数・ページ
使用情報を説明する図である。
FIG. 2 is a diagram illustrating local variable / page usage information of the control device shown in FIG.

【図3】 図1に示す制御装置のローカル変数・ページ
管理情報を説明する図である。
FIG. 3 is a diagram for explaining local variable / page management information of the control device shown in FIG. 1;

【図4】 図1に示す制御装置のローカル変数・ページ
管理情報を用いた論理アドレスから物理アドレスへの変
換を説明する図である。
FIG. 4 is a view for explaining conversion from a logical address to a physical address using local variable / page management information of the control device shown in FIG. 1;

【図5】 この発明の実施の形態1による制御装置にエ
ンジニアリング装置から転送される転送データのフォー
マットを示す図である。
FIG. 5 is a diagram showing a format of transfer data transferred from the engineering device to the control device according to the first embodiment of the present invention.

【図6】 この発明の実施の形態1による制御装置の動
作を説明するフローチャートである。
FIG. 6 is a flowchart illustrating an operation of the control device according to the first embodiment of the present invention.

【図7】 この発明の実施の形態1による制御装置の動
作結果を説明する図である。
FIG. 7 is a diagram illustrating an operation result of the control device according to the first embodiment of the present invention.

【図8】 この発明の実施の形態1による制御装置の効
果を説明する図である。
FIG. 8 is a diagram illustrating the effect of the control device according to the first embodiment of the present invention.

【図9】 この発明の実施の形態2による制御装置を示
すブロック図である。
FIG. 9 is a block diagram showing a control device according to a second embodiment of the present invention.

【図10】 この発明の実施の形態2による制御装置の
アドレスの修飾を説明する図である。
FIG. 10 is a diagram illustrating modification of an address of a control device according to a second embodiment of the present invention.

【図11】 この発明の実施の形態2による制御装置の
動作を説明するフローチャートである。
FIG. 11 is a flowchart illustrating an operation of the control device according to the second embodiment of the present invention.

【図12】 この発明の実施の形態3による制御装置を
示すブロック図である。
FIG. 12 is a block diagram showing a control device according to a third embodiment of the present invention.

【図13】 この発明の実施の形態3による制御装置に
エンジニアリング装置から転送される転送データのフォ
ーマットを示す図である。
FIG. 13 is a diagram showing a format of transfer data transferred from an engineering device to a control device according to a third embodiment of the present invention.

【図14】 この発明の実施の形態3による制御装置の
変更後ローカル変数の構成を説明する図である。
FIG. 14 is a diagram illustrating a configuration of a changed local variable of a control device according to a third embodiment of the present invention.

【図15】 この発明の実施の形態3による制御装置の
コピー元ビット列とコピー先ビット列を説明する図であ
る。
FIG. 15 is a diagram illustrating a copy source bit string and a copy destination bit string of the control device according to the third embodiment of the present invention.

【図16】 この発明の実施の形態3による制御装置の
ローカル変数・引継用テーブルを説明する図である。
FIG. 16 is a diagram illustrating a local variable / takeover table of a control device according to a third embodiment of the present invention.

【図17】 この発明の実施の形態3による制御装置の
ローカル変数・引継用ページ管理情報を説明する図であ
る。
FIG. 17 is a diagram illustrating local variable / takeover page management information of the control device according to the third embodiment of the present invention.

【図18】 この発明の実施の形態3による制御装置の
プログラム書換部の動作を示すフローチャートである。
FIG. 18 is a flowchart showing an operation of a program rewriting unit of the control device according to Embodiment 3 of the present invention.

【図19】 この発明の実施の形態3による制御装置の
プログラム実行制御部の動作を示すフローチャートであ
る。
FIG. 19 is a flowchart showing an operation of a program execution control unit of the control device according to the third embodiment of the present invention.

【図20】 この発明の実施の形態4による制御装置の
従来プログラムと混在させる場合のローカル変数・ペー
ジ使用情報をの説明する図である。
FIG. 20 is a diagram for explaining local variable / page usage information in the case where the control device according to the fourth embodiment of the present invention is mixed with a conventional program.

【図21】 この発明の実施の形態4による制御装置の
動作を説明するフローチャートである。
FIG. 21 is a flowchart illustrating an operation of the control device according to the fourth embodiment of the present invention.

【図22】 従来の制御装置を示すブロック図である。FIG. 22 is a block diagram showing a conventional control device.

【図23】 従来の制御装置を説明する図である。FIG. 23 is a diagram illustrating a conventional control device.

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

8 制御装置、9 エンジニアリング装置、10 プロ
グラム・ローカル変数領域、11 プログラム領域、1
2 ローカル変数領域、13 プログラム・ページ使用
情報、14 ローカル変数・ページ使用情報、15 プ
ログラム実行制御部、16 プログラム・ページ管理情
報、17 ローカル変数・ページ管理情報、18 命令
実行部、19 エンジニアリング装置要求処理部、20
プログラム書換え部、21 受信部、22 送信部、
23 不正アドレス検出部、24 ローカル変数・ワー
ド数情報、25 ローカル変数・引継用テーブル、26
ローカル変数・引継用ページ管理情報。
8 control device, 9 engineering device, 10 program / local variable area, 11 program area, 1
2 Local variable area, 13 Program page usage information, 14 Local variable / page usage information, 15 Program execution control unit, 16 Program page management information, 17 Local variable / page management information, 18 Instruction execution unit, 19 Engineering equipment request Processing unit, 20
Program rewriting unit, 21 receiving unit, 22 transmitting unit,
23 illegal address detection unit, 24 local variable / word number information, 25 local variable / takeover table, 26
Local variable / takeover page management information.

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 プログラムの実行によって被制御装置の
制御を行うと共に動作中のプログラムの変更を行うよう
構成された制御装置において、プログラムを記憶するプ
ログラム領域、上記プログラムのみが使用するローカル
変数を記憶するローカル変数領域、上記プログラムが上
記プログラム領域に割付けられたページが記憶されたプ
ログラムページ使用情報部、上記ローカル変数が上記ロ
ーカル変数領域に割付けられたページが記憶されたロー
カル変数ページ使用情報部、プログラムを編集するエン
ジニアリング装置から入力されるプログラム及びこのプ
ログラムのみが使用するローカル変数を受信する受信
部、この受信部に受信されたプログラムによって上記プ
ログラム領域を書換えると共に、上記受信部に受信され
たローカル変数によって上記ローカル変数領域を書換え
る書換え部を備えたことを特徴とする制御装置。
In a control device configured to control a controlled device by executing a program and to change a program in operation, a program area for storing a program and a local variable used only by the program are stored. A local variable area, a program page use information section storing a page in which the program is allocated to the program area, a local variable page use information section storing a page in which the local variable is allocated to the local variable area, A receiving unit that receives a program input from an engineering device that edits a program and a local variable used only by the program, rewrites the program area by the program received by the receiving unit, and receives the program by the receiving unit. Local variables A rewriting unit for rewriting the local variable area.
【請求項2】 プログラム中に記述されたローカル変数
の論理アドレスを物理アドレスに変更するときに参照さ
れるローカル変数ページ管理情報部を備え、書換え部
は、ローカル変数の書換えに合わせて上記ローカル変数
ページ管理情報部を書換えることを特徴とする請求項1
記載の制御装置。
2. A local variable page management information section referred to when a logical address of a local variable described in a program is changed to a physical address, wherein the rewriting section is adapted to rewrite the local variable in accordance with the rewriting of the local variable. 2. The page management information section is rewritten.
The control device as described.
【請求項3】 エンジニアリング装置から転送されるロ
ーカル変数のワード数を記憶するローカル変数ワード数
情報部、プログラムの実行時に、上記ローカル変数ワー
ド数情報部を用いて、ローカル変数の論理アドレスの正
当性をチェックする不正アドレス検出部を備えたことを
特徴とする請求項1または請求項2記載の制御装置。
3. A local variable word number information section for storing the number of words of a local variable transferred from an engineering apparatus. When executing a program, the local variable word number information section is used to validate a logical address of a local variable. The control device according to claim 1, further comprising an unauthorized address detection unit that checks the address.
【請求項4】 書換え部は、書換え前のローカル変数の
値が引き継がれるように、ローカル変数領域を書換える
ことを特徴とする請求項1〜請求項3のいずれか一項記
載の制御装置。
4. The control device according to claim 1, wherein the rewriting unit rewrites the local variable area so that the value of the local variable before the rewriting is inherited.
【請求項5】 請求項1〜請求項4のいずれか一項記載
の制御装置で用いられるプログラムである第一の言語に
よって記述されたプログラムと、この第一の言語とは異
なる第二の言語によって記述されたプログラムとを識別
する識別部、上記第二の言語によって記述されたプログ
ラム中のローカル変数を記憶する第二のローカル変数領
域を備え、書換え部は、上記識別部によって第二の言語
であると識別されたプログラムについては、第二のロー
カル変数領域に記憶されたローカル変数の書換えを行わ
ないことを特徴とする制御装置。
5. A program described in a first language that is a program used in the control device according to claim 1, and a second language different from the first language. An identification unit for identifying a program described by the second language, a second local variable area for storing a local variable in the program described by the second language, the rewriting unit, the second language by the identification unit The control device according to claim 1, wherein the local variable stored in the second local variable area is not rewritten for the program identified as.
JP2000041230A 2000-02-18 2000-02-18 Controller Pending JP2001229015A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2000041230A JP2001229015A (en) 2000-02-18 2000-02-18 Controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2000041230A JP2001229015A (en) 2000-02-18 2000-02-18 Controller

Publications (1)

Publication Number Publication Date
JP2001229015A true JP2001229015A (en) 2001-08-24

Family

ID=18564496

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2000041230A Pending JP2001229015A (en) 2000-02-18 2000-02-18 Controller

Country Status (1)

Country Link
JP (1) JP2001229015A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008102426A1 (en) * 2007-02-19 2008-08-28 Mitsubishi Electric Corporation Peripheral device for programmable controller, replacement method, and program

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008102426A1 (en) * 2007-02-19 2008-08-28 Mitsubishi Electric Corporation Peripheral device for programmable controller, replacement method, and program
CN101365994A (en) * 2007-02-19 2009-02-11 三菱电机株式会社 Peripheral device of programmable controller, replacing method and program
JPWO2008102426A1 (en) * 2007-02-19 2010-05-27 三菱電機株式会社 Programmable controller peripheral device, replacement method and program
JP4541418B2 (en) * 2007-02-19 2010-09-08 三菱電機株式会社 Programmable controller peripheral device, replacement method and program

Similar Documents

Publication Publication Date Title
JPS6376034A (en) Multiple address space control system
JP3663617B2 (en) PLC tool device and program recording medium
JP2001229015A (en) Controller
JP3489153B2 (en) File system
JPH06110741A (en) Computer device
JP3130798B2 (en) Bus transfer device
JPH05224707A (en) Program changing method for programmable controller
JP3085309B2 (en) Debug system
JPH0256666A (en) System for dynamically updating job network unitary control system generating information
KR100308251B1 (en) Integrated management method of runtime backup information and its system
JP3341061B2 (en) Programmable controller
JP3693311B2 (en) Distributed processing system
JP2000200210A (en) Memory managing device
JPH1165884A (en) Microcomputer and debugging method therefor
JPH05324291A (en) Information management device
JPH09106377A (en) Memory managing device
JPS6144339B2 (en)
JPH0659959A (en) File protection system
JPH03255533A (en) Symbol managing system in programming language processing system
JPS5818761A (en) Storage controlling system
JPS63308655A (en) System for built-in input/output device driver
JP2000227861A (en) Method and device for debugging
JP2006099650A (en) Network system and node for the same
JPH0798670A (en) Direct formation data set access system
JP2000194549A (en) Line number management system for text editing

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20060605

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20060620

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20061017