JPH05257510A - Programmable controller and its control method - Google Patents

Programmable controller and its control method

Info

Publication number
JPH05257510A
JPH05257510A JP5501492A JP5501492A JPH05257510A JP H05257510 A JPH05257510 A JP H05257510A JP 5501492 A JP5501492 A JP 5501492A JP 5501492 A JP5501492 A JP 5501492A JP H05257510 A JPH05257510 A JP H05257510A
Authority
JP
Japan
Prior art keywords
program
cpu
programmable controller
address
scanning
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
JP5501492A
Other languages
Japanese (ja)
Inventor
Yasusuke Sakurai
保輔 桜井
Takashi Kuwano
孝 桑野
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.)
Hitachi Ltd
Original Assignee
Hitachi Techno Engineering Co Ltd
Hitachi 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 Hitachi Techno Engineering Co Ltd, Hitachi Ltd filed Critical Hitachi Techno Engineering Co Ltd
Priority to JP5501492A priority Critical patent/JPH05257510A/en
Publication of JPH05257510A publication Critical patent/JPH05257510A/en
Pending legal-status Critical Current

Links

Landscapes

  • Programmable Controllers (AREA)

Abstract

(57)【要約】 【目的】 スキャンニングとブロック転送を同時に行な
うことにより、運転中にプログラムを変更(RUN中変
更)可能なプログラマブル・コントローラとその制御方
法を提供する。 【構成】 状態(a)から、状態(b)〜状態(d)を
経てプログラムC中のC4、C5を矢印Yのように逐次
転送し、ブロック転送途中の状態(e)において、TR
レジスタ4で指定したアドレスC4から、C5を含むS
Rレジスタ5で指定した分に相当するプログラムを実行
せずに飛び越えることにより、矢印Xに示すようにA→
B→C1→C2→C3→C4′→C5′なるスキャンニ
ングを実行する。
(57) [Summary] [Object] To provide a programmable controller capable of changing a program during operation (changing during RUN) by simultaneously performing scanning and block transfer, and a control method thereof. [Structure] From state (a), through states (b) to (d), C4 and C5 in program C are sequentially transferred as indicated by arrow Y, and TR is set in state (e) during block transfer.
S including address C4 to C5 specified by register 4
By jumping over without executing the program corresponding to the amount specified by the R register 5, as shown by arrow X, A →
The scanning of B → C1 → C2 → C3 → C4 ′ → C5 ′ is executed.

Description

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

【0001】[0001]

【産業上の利用分野】本発明はプログラマブル・コント
ローラに係り、特にプログラマブル・コントローラの運
転中にプログラムを変更するRUN中変更の技術であっ
て、電気的に消去可能なROMなど、読み出し時間に比
べて書き込み時間が多くかかるメモリの使用に好適なプ
ログラマブル・コントローラに関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a programmable controller, and more particularly to a RUN change technique for changing a program while the programmable controller is in operation. The present invention relates to a programmable controller suitable for use in a memory that requires a long writing time.

【0002】[0002]

【従来の技術】プログラマブル・コントローラの一般構
成は、外部機器からの信号を入力部に入力し、プログラ
ムメモリに記憶された制御プログラムを出力部を介して
外部機器に出力するもので、CPU(中央演算処理装
置)はプログラムメモリの読み出しを実行すると共に、
入力部、出力部の制御を行なう。
2. Description of the Related Art A general configuration of a programmable controller is one in which a signal from an external device is input to an input unit and a control program stored in a program memory is output to the external device via an output unit. The arithmetic processing unit) reads the program memory and
It controls the input and output sections.

【0003】生産ラインに組み込まれて稼働しているプ
ログラマブル・コントローラは、前記稼動を開始する
と、一般に連続運転となるため停止させることが困難な
ことが多い。このような状況の下で、デバッグ、いわゆ
るミスプログラムの修正、または仕様変更に伴ってシー
ケンスプログラムの内容を変更する必要が生じた場合、
プログラマブル・コントローラを運転したままプログラ
ムを変更する機能(以下、RUN中変更機能と記す)が
必要となってくる。
It is often difficult to stop a programmable controller that is installed in a production line and is operating because it is generally operated continuously when the operation is started. Under such circumstances, if it becomes necessary to change the contents of the sequence program due to debugging, correction of so-called mistake programs, or specification changes,
A function for changing the program while the programmable controller is operating (hereinafter, referred to as RUN change function) is required.

【0004】従来、RUN中変更機能の技術としては、
特開昭60−229106号公報に開示されている。す
なわち、図5に示すように、A→B→Cなるプログラム
を実行中、Bの部分を変更したいとき、変更部分Bに相
当するプログラムを、あらかじめ修正用のバッファメモ
リにB′を作成しておき、プログラムメモリ上のB部分
をB′部分にRUN中変更した後に、CPUがシーケン
スプログラムを読み出し実行(以下スキャンニングと呼
ぶ)し、A→B′→Cのように制御をジャンプさせる処
理制御を行なうものであった。以下、図中の矢印Xはス
キャンニングの流れを示す。
Conventionally, the technology of the change function during RUN is as follows.
It is disclosed in JP-A-60-229106. That is, as shown in FIG. 5, when a program A → B → C is being executed and the user wants to change the portion B, the program corresponding to the changed portion B is created in advance in the buffer memory for correction with B ′. Every time, the B part on the program memory is changed to the B'part during the RUN, and then the CPU reads and executes the sequence program (hereinafter referred to as scanning) and jumps the control as A → B ′ → C. Was to do. Hereinafter, the arrow X in the figure shows the flow of scanning.

【0005】この処理制御によって、RUN中変更が実
現するが、変更部分のプログラムが本来のプログラムメ
モリと別の修正用バッファメモリに形成されることにな
るから、したがって、このようなRUN中変更をたびた
び繰り返してゆくと、第1に、必要な修正用バッファメ
モリの容量が増え、逆にプログラムメモリは使用してい
ない部分が次第に増えてゆくから、小規模のプログラマ
ブル・コントローラでは、プログラムメモリ容量に制約
があるためその影響は極めて大きく、第2に、プログラ
ムメモリとバッファメモリの併用によって、プログラム
がつぎはぎになって、同一プログラムに対して複数のビ
ットパターン表現を許してしまうという問題点があっ
た。
This processing control realizes the change during RUN. However, since the program of the changed portion is formed in the modification buffer memory different from the original program memory, such a change during RUN is performed. If you repeat it often, firstly, the capacity of the necessary correction buffer memory will increase, and conversely, the unused part of the program memory will gradually increase. The influence is extremely large due to the restriction. Secondly, there is a problem that the program is patched due to the combined use of the program memory and the buffer memory, which allows a plurality of bit pattern expressions for the same program. It was

【0006】上記2つの問題点を解決するためには、R
UN中変更を行った後、修正用バッファメモリの内容を
元のプログラムメモリに戻すことが考えられる。RUN
中変更前とRUN中変更後で、変更を行なった部分のプ
ログラムの大きさが変わった場合には、修正用バッファ
メモリの内容を元のプログラムに戻す前に、プログラム
メモリのRUN中変更を行った部分以降のプログラムを
大きさが変わったステップ分だけずらす操作を行なう必
要がある。この操作は通常、CPUのレジスタを経由す
るか、あるいはDMAC(ダイレクト・メモリ・アクセ
ス・コントローラ)によって、CPUが直接プログラム
を転送(以下、ブロック転送と呼ぶ)することによって
実行される。
In order to solve the above two problems, R
It is possible to return the contents of the correction buffer memory to the original program memory after making the change during UN. RUN
If the size of the changed program changes before and after the mid-change and before the RUN mid-change, change the program memory during the RUN before changing the contents of the correction buffer memory back to the original program. It is necessary to perform the operation to shift the program after the part marked by the amount corresponding to the step whose size has changed. This operation is normally executed by the CPU directly transferring a program (hereinafter referred to as a block transfer) via a register of the CPU or by a DMAC (Direct Memory Access Controller).

【0007】図6(a)、(b)、(c)は、このスキ
ャンニングの流れを示した図であって、(a)は、変更
前のプログラムメモリの状態を示している。プログラム
は説明のためA、B、Cの部分に分かれているものとす
る。(b)はBの部分をB′となるようにRUN中変更
した直後の状態を示している。この段階では、B′は修
正用バッファメモリ上に存在している。(c)は(b)
の状態から修正用バッファメモリ上のB′を再びプログ
ラムメモリ上に戻した状態を示している。(c)は
(b)の状態と比較して、修正用バッファメモリを必要
としないシーケンスプログラムがスキャンニングの実行
順に並んでいる、という2つのことからRUN中変更後
のシーケンスプログラムの理想的なメモリ上の配置とい
える。
FIGS. 6A, 6B and 6C are views showing the flow of this scanning, and FIG. 6A shows the state of the program memory before the change. For the sake of explanation, the program is divided into A, B, and C parts. (B) shows the state immediately after the portion B is changed during RUN to become B '. At this stage, B'exists in the correction buffer memory. (C) is (b)
The state in which B'on the correction buffer memory is returned to the program memory from the state of FIG. Compared to the state of (b), (c) shows that the sequence programs that do not require the correction buffer memory are arranged in the order of execution of scanning. It can be said to be an arrangement on memory.

【0008】(b)の状態から(c)の状態にするため
には、修正用バッファメモリ上にあるB′を元のプログ
ラムメモリ上に戻す前に、シーケンスプログラム上のC
を、修正したメモリの差、すなわちB′とBの差だけR
UN中変更によってブロック転送してやればよい。
In order to change the state of (b) to the state of (c), C on the sequence program is restored before returning B'in the correction buffer memory to the original program memory.
To the corrected memory difference, that is, R by the difference between B ′ and B.
A block transfer may be performed by changing during UN.

【0009】[0009]

【発明が解決しようとする課題】しかし、一般に上記の
ようなブロック転送処理には時間を要し、特に読出しに
比べて書込みに時間を必要とする低速メモリを使用して
いた場合、ブロック転送の開始から終了までに要する時
間の長さは、スキャンニングの時間に比べて無視できな
い大きな時間のロスとなる。例えば、スキャンニング時
間10msで運転しているプログラマブル・コントロー
ラでRUN中変更を行ない、上記のプログラムのブロッ
ク転送に2秒を要したとすると、一般にブロック転送の
途中段階ではシーケンスプログラムの一部分が重複して
いるため、ブロック転送を開始してから終了するまでの
間、スキャンニングを行なうことができない。したがっ
て、この例では、通常スキャンニング時間10msで運
転しているプログラマブル・コントローラが、RUN中
変更を行なった直後に2秒間もブロック転送のためにス
キャンニングを行なわない状態になる。これは高速応答
を要求される技術分野では許容し難いロス時間とみなさ
れることから、結果的にRUN中変更は、図6に於ける
(b)に止めておくことが好ましい。
However, the block transfer processing as described above generally takes time, and particularly when a low-speed memory that requires time for writing as compared with reading is used, The length of time required from the start to the end is a considerable time loss that cannot be ignored compared to the scanning time. For example, if a programmable controller operating with a scanning time of 10 ms makes a change during RUN and it takes 2 seconds to transfer the block of the above program, in general, a part of the sequence program will be duplicated in the middle of the block transfer. Therefore, scanning cannot be performed from the start to the end of the block transfer. Therefore, in this example, the programmable controller, which normally operates with a scanning time of 10 ms, is in a state in which it does not perform scanning for block transfer even for 2 seconds immediately after the change during RUN. Since this is regarded as a loss time that is unacceptable in a technical field requiring a high-speed response, it is preferable to stop the change during RUN in (b) in FIG. 6 as a result.

【0010】図7(a)、(b)、(c)、(d)、
(e)は、ブロック転送の途中段階でシーケンスプログ
ラムの一部分が異常または重複することを示した図であ
る。図7ではシーケンスプログラムのC部分がC1、C
2、C3、C4から構成されている。(a)はブロック
転送直前の状態である。いまC部分全体を2番地分だけ
アドレスの大きい方向へブロック転送することを考える
と、(a)の状態からC4を2番地分だけアドレスの大
きい方向へ転送すると(b)になる。この(b)の状態
からC3を2番地分だけアドレスの大きい方向へ転送す
ると(c)になる。以下、同様にC2を転送しさらにC
1まで転送を行なった状態を(e)に示す。図中、矢印
Yは転送を示す。
7 (a), (b), (c), (d),
(E) is a diagram showing that a part of the sequence program is abnormal or overlaps in the middle of block transfer. In FIG. 7, C part of the sequence program is C1, C
It is composed of 2, C3 and C4. (A) shows the state immediately before the block transfer. Considering that the entire C portion is block-transferred in the direction in which the address is large by 2 addresses, when C4 is transferred in the direction in which the address is large by 2 addresses in the state of (a), it becomes (b). When C3 is transferred from the state of (b) by 2 addresses in the direction in which the address is large, it becomes (c). After that, C2 is transferred in the same manner and C is further transferred.
(E) shows a state in which the transfer is performed up to 1. In the figure, arrow Y indicates transfer.

【0011】ここでブロック転送の途中段階である
(b)から(d)を詳細に検討すると、ブロック転送の
途中段階で、太線で囲った部分Zはシーケンスプログラ
ムが異常または重複していることがわかる。従って、こ
のZ部分が問題であって、このためにブロック転送の途
中ではスキャンニングを行なうことができなかった。
Here, when the steps (b) to (d), which are the intermediate stages of the block transfer, are examined in detail, the sequence program may be abnormal or overlapped in the portion Z surrounded by a bold line during the intermediate stages of the block transfer. Recognize. Therefore, the Z portion is a problem, and for this reason, scanning cannot be performed during the block transfer.

【0012】本発明は、シーケンスプログラムをブロッ
ク転送している途中でスキャンニングが行なわれても、
正常状態でシーケンスプログラムを実行するプログラマ
ブル・コントローラとその制御方法を提供することを目
的としている。
According to the present invention, even if scanning is performed during the block transfer of the sequence program,
An object of the present invention is to provide a programmable controller that executes a sequence program in a normal state and a control method thereof.

【0013】[0013]

【課題を解決するための手段】上記の目的を達成するた
めには、プログラマブル・コントローラを構成するCP
Uが、プログラムメモリをアクセスするアドレス信号を
監視する手段を備え、この監視によって、CPUがあら
かじめ第1のレジスタに設定しておいたアドレス(L番
地とする)になったことを検知したとき、CPUが第2
のレジスタに設定しておいたオフセット値nをCPUの
プログラムカウンタに加算する手段を備えることによっ
て、プログラムメモリ上のL番地からL+n番地の間の
指定範囲を実行しないプログラマブル・コントローラを
用いて、ブロック転送の途中段階で発生するシーケンス
プログラムの異常または重複部分に、前記CPUが実行
しないシーケンスプログラム範囲をあてはめることによ
り、ブロック転送途中でスキャンニングを行ってもシー
ケンスプログラムを正しく実行させることができ、前記
CPUが処理を実行しないL番地からL+n番地の間を
ずらしながら、スキャンニングとブロック転送の両方を
行なうことで可能となる。すなわち、本発明の第1は、
外部機器からの信号を取り込む入力部と、外部機器を駆
動する出力部と、制御プログラムを記憶するプログラム
メモリと、前記制御プログラムにしたがって演算を実行
するCPUと、前記プログラムメモリから制御プログラ
ムを順次読み出して繰返し実行するプログラマブル・コ
ントローラにおいて、前記プログラマブル・コントロー
ラ内部のCPUが出力するアドレス信号を監視する手段
と、前記CPUのプログラムカウンタを書き換える手段
と、シーケンスプログラムの指定区間の命令をとばして
実行する制御手段を有することを特徴とするプログラマ
ブル・コントローラである。また、第2の発明は、外部
機器からの信号を入力部に取り込み、出力部において外
部機器を駆動し、プログラムメモリにおいて制御プログ
ラムを記憶し、前記制御プログラムにしたがってCPU
が演算を実行し、前記プログラムメモリから制御プログ
ラムを順次読み出して繰返し実行するプログラマブル・
コントローラの制御方法において、シーケンスプログラ
ムのスキャンニングと、前記CPUがプログラムを直接
転送する、いわゆるブロック転送とを同時に行なうこと
を特徴とするプログラマブル・コントローラの制御方法
である。
In order to achieve the above-mentioned object, a CP constituting a programmable controller
When U has a means for monitoring an address signal for accessing the program memory, and by this monitoring, it is detected that the CPU has reached the address (address L) previously set in the first register, CPU is second
Block is provided by using a programmable controller that does not execute a specified range between addresses L and L + n on the program memory by providing a means for adding the offset value n set in the register of the CPU to the program counter of the CPU. By applying the range of the sequence program that the CPU does not execute to the abnormal or overlapping portion of the sequence program that occurs in the middle of the transfer, the sequence program can be correctly executed even if scanning is performed during the block transfer. This is possible by performing both scanning and block transfer while shifting the address L where the CPU does not execute processing from the address L + n. That is, the first aspect of the present invention is
An input unit that takes in signals from an external device, an output unit that drives the external device, a program memory that stores a control program, a CPU that executes calculations according to the control program, and a control program that is sequentially read from the program memory. In a programmable controller which is repeatedly executed by a CPU, a means for monitoring an address signal output from a CPU inside the programmable controller, a means for rewriting a program counter of the CPU, and a control for executing an instruction in a designated section of a sequence program It is a programmable controller characterized by having a means. A second aspect of the invention is that a signal from an external device is input to an input unit, an external device is driven by an output unit, a control program is stored in a program memory, and a CPU is operated according to the control program.
Is a programmable program that executes arithmetic operations and sequentially reads control programs from the program memory and repeatedly executes them.
In the controller control method, the scanning of the sequence program and the so-called block transfer in which the CPU directly transfers the program are simultaneously performed, which is a control method of the programmable controller.

【0014】[0014]

【作用】図1は、本発明のプログラマブル・コントロー
ラのブロック構成を示す図であって、CPU1はアドレ
スバス7上に乗せたアドレス信号によってプログラムメ
モリ2上のアドレスを指定し、データバス8を通じてシ
ーケンスプログラムの読み出しを実行する。CPU1か
ら出ているアドレスバス7はアドレス監視部3にも接続
されており、CPU1が出力するアドレス信号はアドレ
ス監視部3の内部にある第1のレジスタ4に記憶されて
いる値と常に比較することができる。
1 is a block diagram of a programmable controller according to the present invention, in which a CPU 1 designates an address on a program memory 2 by an address signal placed on an address bus 7, and a sequence is performed through a data bus 8. Read the program. The address bus 7 output from the CPU 1 is also connected to the address monitoring unit 3, and the address signal output by the CPU 1 is constantly compared with the value stored in the first register 4 inside the address monitoring unit 3. be able to.

【0015】CPU1がプログラムメモリ2上のL番地
を読み出そうとして、アドレスバス7にアドレス信号L
を出力したとき、アドレス監視部3は範囲の先頭を指定
する第1のレジスタ4の値L番地と一致したことを検出
し、CPU1につながっている一致信号線9を通じて一
致信号をCPU1に伝える。CPU1はこの一致信号を
CPU1内にあるプログラムカウンタ6の加算命令と解
釈し、CPU1内の範囲のサイズを指定する第2のレジ
スタ5に記憶されている値nがプログラムカウンタ6に
加算される。その結果、CPU1は次の実行命令をL+
n番地から順に行なうものである。
When the CPU 1 tries to read the address L on the program memory 2, the address signal L is sent to the address bus 7.
When the address is output, the address monitoring unit 3 detects that the address L matches the value L of the first register 4 designating the beginning of the range, and transmits a match signal to the CPU 1 through the match signal line 9 connected to the CPU 1. The CPU 1 interprets this coincidence signal as an addition instruction of the program counter 6 in the CPU 1, and the value n stored in the second register 5 designating the size of the range in the CPU 1 is added to the program counter 6. As a result, the CPU 1 issues the next execution instruction L +
It is carried out in order from the address n.

【0016】以上の仕組みによって、CPU1は第1の
レジスタ4で指定されたL番地からL+n番地の命令を
飛ばしてスキャンニングを行うことができる。なお、こ
れら2つのレジスタはCPU1によって書き換えができ
るものである。
With the above-described mechanism, the CPU 1 can perform scanning by skipping the instruction at the address L + n from the address L designated by the first register 4. Note that these two registers can be rewritten by the CPU 1.

【0017】[0017]

【実施例】図2は、プログラムメモリ上の指定範囲を飛
ばしてスキャンニングすることのできるプログラマブル
・コントローラを用いてスキャンニングを行いながらシ
ーケンスプログラムを少しずつブロック転送する一実施
例のアルゴリズムを示す図であって、図中で矢印Xはス
キャンニングの流れを示し、CPUは、第1のレジス
タ、すなわち、実施例の範囲先頭指定レジスタ4(以下
TR4と略記す)が示すアドレスから、第2のレジス
タ、すなわち、実施例の範囲サイズ指定レジスタ5(以
下SR5と略記す)が示す番地の範囲に相当するシーケ
ンスプログラムを実行しない機能を有するものとする。
矢印Yは転送を示す。また、転送先のデータには「′」
記号を付け、転送元のデータと区別する。また図3は、
図2に示す実施例の主要フローを示す図である。本実施
例を図2、図3を用いて説明する。
FIG. 2 is a diagram showing an algorithm of one embodiment in which a sequence program is gradually transferred in blocks while scanning is performed using a programmable controller capable of skipping a designated range on a program memory for scanning. In the figure, the arrow X indicates the flow of scanning, and the CPU selects the second register from the address indicated by the first register, that is, the range head designating register 4 (hereinafter abbreviated as TR4) of the embodiment. It has a function of not executing the sequence program corresponding to the range of the address indicated by the register, that is, the range size designation register 5 (hereinafter abbreviated as SR5) of the embodiment.
Arrow Y indicates transfer. In addition, "'" is added to the transfer destination data.
Add a symbol to distinguish it from the source data. Also, in FIG.
It is a figure which shows the main flow of the Example shown in FIG. This embodiment will be described with reference to FIGS.

【0018】図2において、状態(a)では1スキャン
ニング目が矢印XにしたがってA→B→C1→C2→C
3→C4→C5の順に実行される。状態(b)でC5を
n番地離れたアドレスへ矢印Yのように転送される。状
態(c)ではTR4がC5を指定しているためにC5は
実行されないが、SR5の内容がnであるため、C5の
代わりに状態(b)でn番地離れたアドレスに転送した
C5′が実行される。従って2スキャンニング目の実行
順序はA→B→C1→C2→C3→C4→C5′であ
る。状態(d)ではC4がn番地離れたアドレスへ転送
される。状態(e)ではTR4の値をディクリメント
(1を減ずる)すると、TR4がC4を指定するため、
C4以降のC4、C5は実行されないが、SR5の内容
がnであるためにC4、C5の代わりにn番地離れたア
ドレスのC4′、C5′が実行される。以下、同様の操
作を繰り返すことにより、 1スキャンニング目 A→B→C1→C2→C3→C
4→C5 2スキャンニング目 A→B→C1→C2→C3→C
4→C5′ 3スキャンニング目 A→B→C1→C2→C3→C
4′→C5′ 4スキャンニング目 A→B→C1→C2→C3′→
C4′→C5′ 5スキャンニング目 A→B→C1→C2′→C3′
→C4′→C5′ 6スキャンニング目 A→B→C1′→C2′→C
3′→C4′→C5′ のようにスキャンニングが実行され、C部分のスキャン
ニングは順次ブロック転送後の命令を実行するように変
化してゆく。
In FIG. 2, in the state (a), the first scanning follows the arrow X and is A → B → C1 → C2 → C.
It is executed in the order of 3 → C4 → C5. In the state (b), C5 is transferred to the address separated by the address n as shown by the arrow Y. In state (c), C5 is not executed because TR4 specifies C5, but since the content of SR5 is n, C5 'transferred to the address n apart in state (b) instead of C5 is Executed. Therefore, the execution order of the second scanning is A → B → C1 → C2 → C3 → C4 → C5 ′. In the state (d), C4 is transferred to the address n addresses away. In state (e), when the value of TR4 is decremented (decremented by 1), TR4 specifies C4.
Although C4 and C5 after C4 are not executed, since the contents of SR5 are n, C4 'and C5' at addresses n apart are executed instead of C4 and C5. After that, by repeating the same operation, the first scanning A → B → C1 → C2 → C3 → C
4 → C5 2nd scanning A → B → C1 → C2 → C3 → C
4 → C5 ′ 3rd scanning A → B → C1 → C2 → C3 → C
4 '→ C5' 4th scanning A → B → C1 → C2 → C3 '→
C4 ′ → C5 ′ 5th scanning A → B → C1 → C2 ′ → C3 ′
→ C4 '→ C5' 6th scanning A → B → C1 '→ C2' → C
Scanning is executed in the order of 3 '→ C4' → C5 ', and the scanning of the C portion is sequentially changed to execute the instructions after the block transfer.

【0019】図2の説明では1スキャンニングに対して
転送を1回行ったが、一般にはプログラマブル・コント
ローラのスキャンニング周期の低下が許容される範囲内
ならば1スキャンニングに対して転送を複数回行うこと
が可能である。
In the description of FIG. 2, the transfer is performed once for each scanning, but generally, if the scanning cycle of the programmable controller is within a range in which the reduction of the scanning cycle is allowed, a plurality of transfers are performed for one scanning. It is possible to do it once.

【0020】また、図2の説明ではC部分をアドレスの
大きい方向へブロック転送したが、C部分をアドレスの
小さい方向へブロック転送するには、C1から転送を開
始して転送のたびにTRレジスタ4の内容をインクリメ
ント(1を加える)ことにより図2と同様の操作で実行
することができる。
In the description of FIG. 2, the C portion is block-transferred in the direction of the larger address, but in order to block-transfer the C portion in the direction of the smaller address, the transfer is started from C1 and the TR register is transferred each time. By incrementing (adding 1) the contents of 4, the same operation as in FIG. 2 can be executed.

【0021】一般にCPU1が指定の範囲のシーケンス
プログラムを実行しない機能を備えていればこのアルゴ
リズムは適用することが可能である。
Generally, if the CPU 1 has a function of not executing the sequence program in the designated range, this algorithm can be applied.

【0022】なお、CPU1の構成としては、第1のレ
ジスタが指定したアドレスLから第2のレジスタが指定
したアドレスnまでの命令を飛ばしてスキャンニングを
行なうプログラマブル・コントローラもある。これは、
図1においてSR5の値をnとし、CPU1が一致信号
を受信したらプログラムカウンタ6にSR5の値nを加
算せずにそのまま転送すればよい。
As a configuration of the CPU 1, there is also a programmable controller which skips an instruction from an address L designated by the first register to an address n designated by the second register for scanning. this is,
In FIG. 1, the value of SR5 is n, and when the CPU 1 receives the coincidence signal, the value n of SR5 may be transferred to the program counter 6 without being added.

【0023】図4は、本発明の一実施例のプログラマブ
ル・コントローラの構成を示す図である。図4において
プログラマブル・コントローラの概要構成は、CPU
1、プログラムメモリ2、アドレス監視部3からなって
いて、アドレス監視部3から出ている一致信号線9はC
PU1に接続されており、本実施例はCPU1とアドレ
ス監視部3の構成の一実施例を示し、その他は概ね図1
に示した構成と同一の構成を備えている。CPU1の内
部はマイクロプロセッサ10とその周辺回路で構成され
ている。マイクロプロセッサ10はアドレスバス7上に
乗せたアドレス信号によってプログラムメモリ2上のア
ドレスを指定し、データバス8を通じてシーケンスプロ
グラムを読み出し実行している。データバス8上にある
データセレクタ11は、通常プログラムメモリ2側のデ
ータバス8を選択しているため、マイクロプロセッサ1
0はデータバス8を通じてプログラムメモリ2上のシー
ケンスプログラムを読み出し実行する。すなわちスキャ
ンニングを行なうことができる。
FIG. 4 is a diagram showing the configuration of a programmable controller according to an embodiment of the present invention. The schematic configuration of the programmable controller in FIG.
1, the program memory 2, and the address monitoring unit 3, and the match signal line 9 extending from the address monitoring unit 3 is C
This embodiment shows one embodiment of the configuration of the CPU 1 and the address monitoring unit 3, which is connected to the PU 1.
It has the same configuration as that shown in FIG. The inside of the CPU 1 is composed of the microprocessor 10 and its peripheral circuits. The microprocessor 10 specifies an address on the program memory 2 by an address signal placed on the address bus 7, and reads out and executes the sequence program through the data bus 8. Since the data selector 11 on the data bus 8 normally selects the data bus 8 on the program memory 2 side, the microprocessor 1
0 reads out and executes the sequence program on the program memory 2 through the data bus 8. That is, scanning can be performed.

【0024】CPU1がプログラムメモリ2上のアドレ
スL番地の命令を読み出そうとしてアドレスバス7にア
ドレス信号Lを出力したとき、そのアドレス信号はアド
レス監視部3の内部にあるディジタルコンパレータ13
にも入力されていて、常にTR4の値Lと比較されてい
るため、一致信号線9を通じてCPU1に一致信号が伝
えられる。この一致信号線9はCPU1内部のデータセ
レクタ11の選択入力端子につながっていて一致信号が
入力されたときだけは、現在のプログラムカウンタの値
を基準とする相対ジャンプ命令のオペコードのビットパ
ターンが記憶されているジャンプオペコードROM12
の内容とSR5の値nが選択され、マイクロプロセッサ
10に取り込まれる。したがって、マイクロプロセッサ
10はプログラムメモリ2上のL番地の命令を読み出そ
うとしたとき、プログラムメモリ2上の命令の代わりに
JUMPnという命令を与えられ、その結果としてマイ
クロプロセッサ10はプログラムカウンタをL+nの値
に書き換える。すなわちL番地からL+n番地へジャン
プしたことになる。以上の仕組みによってTR4、SR
5に設定した値L、nに対し、アドレスLからL+nの
範囲を実行しないプログラマブル・コントローラを実現
することができる。
When the CPU 1 outputs the address signal L to the address bus 7 in an attempt to read the instruction at the address L on the program memory 2, the address signal is sent to the digital comparator 13 inside the address monitoring unit 3.
Since it is also input to, and is always compared with the value L of TR4, the match signal is transmitted to the CPU 1 through the match signal line 9. The match signal line 9 is connected to the selection input terminal of the data selector 11 inside the CPU 1 and only when the match signal is input, the bit pattern of the operation code of the relative jump instruction based on the current value of the program counter is stored. Jump opcode ROM 12
And the value n of SR5 are selected and loaded into the microprocessor 10. Therefore, when the microprocessor 10 tries to read the instruction at the address L on the program memory 2, it is given the instruction JUMPn instead of the instruction on the program memory 2, and as a result, the microprocessor 10 sets the program counter to L + n. To the value of. That is, it means jumping from the address L to the address L + n. TR4, SR by the above mechanism
It is possible to realize a programmable controller that does not execute the range of addresses L to L + n for the values L and n set to 5.

【0025】また、図4において、ジャンプオペコード
ROM12に絶対アドレスジャンプ命令のビットパター
ンを記憶しておけば、L番地からn番地の範囲を実行し
ないプログラマブル・コントローラを実現することがで
きる。
Further, in FIG. 4, if the bit pattern of the absolute address jump instruction is stored in the jump operation code ROM 12, it is possible to realize a programmable controller which does not execute the range from L address to n address.

【0026】前記プログラマブル・コントローラに対し
て、図2に示すスキャンニングと転送を交互に繰り返す
方法を適用すれば、RUN中変更後の処理に必要なブロ
ック転送をスキャンニングを行いながら実行することが
可能である。
If the method of alternately repeating scanning and transfer shown in FIG. 2 is applied to the programmable controller, it is possible to execute the block transfer necessary for the processing after the change during RUN while performing the scanning. It is possible.

【0027】上記実施例によりスキャンニングを行いな
がらブロック転送を行ってもプログラムを正しく実行す
ることが可能なCPU1が構成され、このCPU1を使
用したアルゴリズムを提示することができる。
According to the above-described embodiment, the CPU 1 that can correctly execute the program even if the block transfer is performed while performing the scanning is constructed, and the algorithm using the CPU 1 can be presented.

【0028】[0028]

【発明の効果】本発明の実施により、RUN中変更を実
施した後修正用バッファメモリの内容を元のプログラム
メモリに戻すことができるため、RUN中変更を行って
も修正用バッファメモリは増大しない。また、ブロック
転送途中でもスキャンニングを行なうことができるた
め、特に書込みに時間を要する低速メモリをプログラム
メモリに使用したプログラマブル・コントローラによっ
てRUN中変更を行なう場合に極めて有用である。
According to the present invention, since the contents of the correction buffer memory can be returned to the original program memory after the change during RUN, the correction buffer memory does not increase even if the change during RUN is performed. .. Further, since scanning can be performed even during block transfer, it is extremely useful especially when performing change during RUN by a programmable controller using a low-speed memory as a program memory, which requires a long time for writing.

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

【図1】本発明のプログラマブル・コントローラのブロ
ック構成図である。
FIG. 1 is a block diagram of a programmable controller of the present invention.

【図2】本発明の一実施例のアルゴリズムを説明する図
である。
FIG. 2 is a diagram illustrating an algorithm of an embodiment of the present invention.

【図3】図2に示す実施例の主要フローを示す図であ
る。
FIG. 3 is a diagram showing a main flow of the embodiment shown in FIG.

【図4】本発明の一実施例のプログラマブル・コントロ
ーラの構成を示す図である。
FIG. 4 is a diagram showing a configuration of a programmable controller according to an embodiment of the present invention.

【図5】従来技術におけるプログラムのRUN中変更を
示し変更部分のプログラムを元のプログラムメモリに戻
さない処理図である。
FIG. 5 is a processing diagram showing a change in a RUN of a program in the related art and not returning the changed part of the program to the original program memory.

【図6】従来技術におけるプログラムのRUN中変更を
示し変更部分のプログラムを元のプログラムメモリに戻
す処理図である。
FIG. 6 is a processing diagram showing a change during RUN of a program in the related art and returning the changed part of the program to the original program memory.

【図7】従来技術におけるプログラムのRUN中変更を
示しブロック転送の途中でシーケンスプログラムの一部
分が異常または重複する処理図である。
FIG. 7 is a processing diagram showing a change during RUN of a program in the related art, and a part of the sequence program is abnormal or overlaps during block transfer.

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

1…CPU 2…プログラムメ
モリ 3…アドレス監視部 4…範囲先頭指定
レジスタ(TR) 5…範囲サイズ指定レジスタ(SR)6…プログラムカ
ウンタ 7…アドレスバス 8…データバス 9…一致信号線 10…マイクロプロ
セッサ 11…データセレクタ 12…ジャンプオ
ペコードROM 13…ディジタルコンパレータ
1 ... CPU 2 ... Program memory 3 ... Address monitoring unit 4 ... Range start designation register (TR) 5 ... Range size designation register (SR) 6 ... Program counter 7 ... Address bus 8 ... Data bus 9 ... Match signal line 10 ... Micro Processor 11 ... Data selector 12 ... Jump opcode ROM 13 ... Digital comparator

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 外部機器からの信号を取り込む入力部
と、外部機器を駆動する出力部と、制御プログラムを記
憶するプログラムメモリと、前記制御プログラムにした
がって演算を実行するCPUと、前記プログラムメモリ
から制御プログラムを順次読み出して繰返し実行するプ
ログラマブル・コントローラにおいて、 前記プログラマブル・コントローラ内部のCPUが出力
するアドレス信号を監視する手段と、 前記CPUのプログラムカウンタを書き換える手段と、 シーケンスプログラムの指定区間の命令をとばして実行
する制御手段を有することを特徴とするプログラマブル
・コントローラ。
1. An input unit for receiving a signal from an external device, an output unit for driving the external device, a program memory for storing a control program, a CPU for executing an operation according to the control program, and a program memory. In a programmable controller that sequentially reads out a control program and repeatedly executes the control program, means for monitoring an address signal output by a CPU inside the programmable controller, means for rewriting a program counter of the CPU, and instructions for a specified section of a sequence program A programmable controller having control means for skipping execution.
【請求項2】 外部機器からの信号を入力部に取り込
み、出力部において外部機器を駆動し、プログラムメモ
リにおいて制御プログラムを記憶し、前記制御プログラ
ムにしたがってCPUが演算を実行し、前記プログラム
メモリから制御プログラムを順次読み出して繰返し実行
するプログラマブル・コントローラの制御方法におい
て、 シーケンスプログラムのスキャンニングと、前記CPU
がプログラムを直接転送する、いわゆるブロック転送と
を同時に行なうことを特徴とするプログラマブル・コン
トローラの制御方法。
2. A signal from an external device is taken into an input part, an external device is driven at an output part, a control program is stored in a program memory, a CPU executes an operation in accordance with the control program, and the program is stored in the program memory. In a control method of a programmable controller that sequentially reads a control program and repeatedly executes the same, the scanning of a sequence program and the CPU
A method for controlling a programmable controller, characterized in that a program is directly transferred, that is, a so-called block transfer is simultaneously performed.
JP5501492A 1992-03-13 1992-03-13 Programmable controller and its control method Pending JPH05257510A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5501492A JPH05257510A (en) 1992-03-13 1992-03-13 Programmable controller and its control method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5501492A JPH05257510A (en) 1992-03-13 1992-03-13 Programmable controller and its control method

Publications (1)

Publication Number Publication Date
JPH05257510A true JPH05257510A (en) 1993-10-08

Family

ID=12986810

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5501492A Pending JPH05257510A (en) 1992-03-13 1992-03-13 Programmable controller and its control method

Country Status (1)

Country Link
JP (1) JPH05257510A (en)

Similar Documents

Publication Publication Date Title
EP0622732A1 (en) Microcomputer
US5600807A (en) Programmable controller capable of updating a user program during operation by switching between user program memories
JPH01147627A (en) Question answering device
KR20030087963A (en) Motor control apparatus and motor control method
JPH05257510A (en) Programmable controller and its control method
JP2526686B2 (en) Method of modifying program contents in control program of programmable controller
US7076641B2 (en) Programmable controller
JP3462245B2 (en) Central processing unit
JPS59114602A (en) Programmable controller
JP2526703B2 (en) Programmable controller
US6718459B1 (en) Device and method for arithmetic processing
JP3207333B2 (en) Programmable controller
JP2731166B2 (en) Programmable controller
KR100290280B1 (en) Microcontroller with Programmable Flash Memory
JPH0830453A (en) Programmable controller
JPH11167409A (en) Programmable controller running on parallel execution language
JP3358113B2 (en) Program creation device for programmable controller
JPH11288371A (en) In-circuit emulator
JPH03158940A (en) Data dump control system
JPH06202718A (en) Debug method
JPH0695710A (en) Method for changing sequence program of programmable controller
JPH0821027B2 (en) Microcomputer with built-in A / D converter
JP2007323491A (en) Direct memory access control device and control method
JPH09160786A (en) Microprocessor
JPH01295347A (en) Microcomputer device