JP2009181443A - Equipment for industrial controller - Google Patents

Equipment for industrial controller Download PDF

Info

Publication number
JP2009181443A
JP2009181443A JP2008021333A JP2008021333A JP2009181443A JP 2009181443 A JP2009181443 A JP 2009181443A JP 2008021333 A JP2008021333 A JP 2008021333A JP 2008021333 A JP2008021333 A JP 2008021333A JP 2009181443 A JP2009181443 A JP 2009181443A
Authority
JP
Japan
Prior art keywords
interlock
state
instruction
area
mpu
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.)
Granted
Application number
JP2008021333A
Other languages
Japanese (ja)
Other versions
JP4993208B2 (en
Inventor
Takamasa Mioki
孝昌 見置
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.)
Omron Corp
Original Assignee
Omron Corp
Omron Tateisi Electronics Co
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 Omron Corp, Omron Tateisi Electronics Co filed Critical Omron Corp
Priority to JP2008021333A priority Critical patent/JP4993208B2/en
Publication of JP2009181443A publication Critical patent/JP2009181443A/en
Application granted granted Critical
Publication of JP4993208B2 publication Critical patent/JP4993208B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Programmable Controllers (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide equipment capable of responding to interlock even in a compile type program, and changing an interlock algorithm according to characteristics of an object program. <P>SOLUTION: The equipment includes an MPU 21 which arithmetically executes a user program containing a function block FB; and an FB instance storage area 23a which stores an interlock operation flag which specifies whether or not to execute a program in the FB in an interlock state. The section between an interlock start instruction and an interlock termination instruction described in the user program corresponds to the interlock area, and this area is laid in the interlock state when input corresponding to the start instruction is NO. The MPU determines, when an OUT instruction is executed, whether the interlock state or not, and sets the output OFF in the interlock state. The FB present in the interlock area of the interlock state performs execution/non-execution of the program based on the interlock operation flag. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

この発明は、PLCやPAC等の産業用コントローラ並びにその産業用コントローラを構成するCPUユニット等の産業用コントローラ用機器に関するものである。   The present invention relates to industrial controllers such as PLCs and PACs and industrial controller equipment such as CPU units constituting the industrial controllers.

FA(Factory Automation)におけるネットワークシステムは、生産設備内の入力機器及び出力機器の制御を司る1または複数のPLC(Programmable Logic Controller)と、そのPLCにより動作が制御される機器とが、制御系のネットワークに接続される。それらPLCと機器は、その制御系のネットワークを介してサイクリックに通信を行なうことで、INデータ及びOUTデータ(以下I/Oデータという)の送受を行ない、生産設備を制御する。   A network system in FA (Factory Automation) includes one or more PLCs (Programmable Logic Controllers) that control input devices and output devices in a production facility, and devices whose operations are controlled by the PLCs. Connected to the network. These PLCs and devices communicate with each other cyclically via the network of the control system, thereby sending and receiving IN data and OUT data (hereinafter referred to as I / O data) to control production facilities.

また、最近では、次世代の産業用コントローラとして、PAC(Programmable Automation Controller)と称されるコントローラが開発されている。このPACは、パーソナルコンピュータが持つ高速性や高機能や機能拡張性に加え、PLCが持つ高精度や耐久性を備えている。そのPACもPLCと同様に、ネットワークを介して生産設備の機器と通信を行なうことで、I/Oデータの送受を行ない、生産設備を制御する。   Recently, a controller called PAC (Programmable Automation Controller) has been developed as a next-generation industrial controller. This PAC has the high accuracy and durability of a PLC in addition to the high speed, high functionality, and function expandability of a personal computer. The PAC, like the PLC, communicates with the equipment of the production facility via the network to transmit / receive I / O data and control the production facility.

上記のPLCやPAC等の産業用コントローラは、複数のユニットを連結して構成されるタイプのものがある。そのユニットの1つである産業用コントローラの制御を統括するCPUユニットは、ラダー言語等で作製されたユーザプログラムを実行する。このCPUユニットは例えば、INデータである入力機器のON信号またはOFF信号を入力し、入力したON/OFF情報をユーザプログラムによって論理演算し、演算結果であるOUTデータを出力機器へ出力する。その出力が出力機器に対する動作指示となって出力機器が動作することにより、生産設備を制御する。このユーザプログラムの実行命令の一つとして、インターロックがある。このインターロックは、INデータの対象のひとつとなる所定の接点がOFFになった場合、インターロック領域の対象となるOUTデータとなる所定の接点はOFFに固定されるものである。
国際公開番号WO97/23812
Some industrial controllers such as PLC and PAC are configured by connecting a plurality of units. A CPU unit that supervises the control of an industrial controller, which is one of the units, executes a user program created in a ladder language or the like. For example, the CPU unit inputs an ON signal or an OFF signal of the input device as IN data, performs a logical operation on the input ON / OFF information by a user program, and outputs OUT data as a calculation result to the output device. The output becomes an operation instruction for the output device, and the output device operates to control the production facility. One of execution instructions of this user program is an interlock. In this interlock, when a predetermined contact that is one of the targets of IN data is turned OFF, the predetermined contact that is OUT data that is the target of the interlock area is fixed to OFF.
International Publication Number WO97 / 23812

従来のインターロックは、通常、専用のハードウェア、例えばASICチップ等により実現されるため、ASICのゲート数の観点からインターロックへの処理対応の柔軟性が低かった。例えばインターロック領域のプログラム中にファンクションブロックが存在する場合、ファンクションブロックのプログラムは実行されないように固定されていた。そのため、ファンクションブロックを呼び出してプログラムを実行し、内部の接点をON/OFF動作させたい等の要求があっても、対応できない場合があった。もちろん、インターロック領域内にあるOUT接点はOFFにするのがインターロックの本来の機能であるので、ファンクションブロックを実行したとして最終的な出力接点はOFFになることもあり、インターロック中は、ファンクションブロックも実行させないで良い(実行させたくない)という考えも当然あるが、実行させたい場合もある。しかし、従来の専用ハードウェアによるインターロックの実行では、インターロック領域内に存在するファンクションブロックの実行/非実行に対するユーザの要求に対応できない。   Since the conventional interlock is usually realized by dedicated hardware such as an ASIC chip, the flexibility of processing corresponding to the interlock is low from the viewpoint of the number of gates of the ASIC. For example, when a function block exists in the program in the interlock area, the function block program is fixed so as not to be executed. For this reason, even if there is a request such as calling a function block and executing a program to turn an internal contact ON / OFF, there are cases where it cannot be handled. Of course, since the original function of the interlock is to turn off the OUT contact in the interlock region, the final output contact may be turned off even if the function block is executed. Of course, there is an idea that it is not necessary to execute a function block (it is not desired to execute it), but there are cases where it is desired to execute it. However, the execution of the interlock by the conventional dedicated hardware cannot respond to the user's request for the execution / non-execution of the function block existing in the interlock area.

この発明は、ユーザプログラム中のインターロックに柔軟に対応ができ、対象プログラムの特徴にあわせたインターロックアルゴリズムの変更が可能な産業用コントローラ用機器を提供することを目的とする。   An object of the present invention is to provide an industrial controller device that can flexibly cope with an interlock in a user program and can change an interlock algorithm in accordance with the characteristics of a target program.

従来のインターロックは専用ハードウェアで実現されており、コンパイル型のプログラムを前提としていなかった。本発明ではソフトウェアによるインターロックを実現することにより、柔軟なファンクションブロックその他のPOUを含むユーザプログラムの設計が可能となる。例えば、ファンクションブロック(FB)等のPOUに対してインターロック有効か無効かの選択をユーザが個々に行なうことで、そのPOUが存在するインターロック領域がインターロック状態であっても、POU内の命令を実行したり、非実行としたりすることができる。具体的には、下記のよう構成する。   Conventional interlocks are implemented with dedicated hardware and do not assume compiled programs. In the present invention, the user program including flexible function blocks and other POUs can be designed by realizing the interlock by software. For example, when the user individually selects whether the interlock is valid or invalid for a POU such as a function block (FB), even if the interlock area where the POU exists is in the interlock state, Instructions can be executed or not executed. Specifically, the configuration is as follows.

(1)本発明に係る産業用コントローラ用機器は、複数の命令語から構成されるプログラム構成単位であるPOUを含むユーザプログラムを演算実行する演算部と、
インターロック状態の時、POU内の命令を実行するか否かを特定するインターロック時動作情報を格納する記憶部と、を備える。そして、ユーザプログラムは、対となるインターロック開始命令とインターロック終了命令が記述された場合、その両命令で囲んだ区間がインターロック領域となり、インターロック開始命令に対応する入力がインターロック状態を示す値の場合、インターロック領域をインターロック状態となるようにする。演算部は、ユーザプログラム中のOUT命令を実行するに際し、そのOUT命令が含まれるインターロック領域がインターロック状態か否かを判断し、インターロック状態の場合には設定されたインターロック処理を実行する機能と、インターロック状態のインターロック領域内に存在するPOUを実行するに際し、記憶部のインターロック時動作情報を確認し、その確認結果に基づきそのPOU内の命令の実行/非実行をする機能と、を備えるようにした。
(1) An industrial controller device according to the present invention includes an arithmetic unit that executes a user program including a POU that is a program constituent unit composed of a plurality of instruction words;
A storage unit that stores operation information at the time of interlocking that specifies whether or not to execute an instruction in the POU in the interlock state. When the interlock start instruction and the interlock end instruction that are paired are described, the user program has an interlock area between the two instructions, and the input corresponding to the interlock start instruction is in the interlock state. In the case of the indicated value, the interlock area is set to the interlock state. When executing the OUT instruction in the user program, the arithmetic unit determines whether or not the interlock area including the OUT instruction is in an interlock state, and executes the set interlock process in the case of the interlock state. When the POU existing in the interlock area in the interlock state is executed, the operation information at the time of interlock of the storage unit is confirmed, and the instruction in the POU is executed / not executed based on the confirmation result And a function.

産業用コントローラ用機器は、実施形態のCPUユニット2単体でも良いし、それを含むPACのように産業用コントローラ自体も含む概念である。産業用コントローラの場合、実施形態のように複数のユニットを連結して構成されるものはもちろん、必要な機能が1つの筐体に組み込まれた一体型のものも含む。   The industrial controller device may be a single CPU unit 2 according to the embodiment, or a concept including an industrial controller itself such as a PAC including the CPU unit 2. In the case of an industrial controller, not only those configured by connecting a plurality of units as in the embodiment, but also an integrated controller in which necessary functions are incorporated in one housing.

POUは、“Program Organization Unit”の略であり、プログラム構成単位とも称される。このPOUは複数の命令語から構成されるプログラム管理上の最小単位で、プログラム,ファンクション,ファンクションブロックと呼ばれるものである。このPOU単位でプログラム再利用ができる。   POU is an abbreviation for “Program Organization Unit” and is also referred to as a program configuration unit. This POU is a minimum unit in program management composed of a plurality of instruction words, and is called a program, function, or function block. The program can be reused in this POU unit.

演算部は、実施形態ではMPU21に対応する。そのインターロック領域がインターロック状態か否かは、実施形態では、“isInterLock”の値を参照することでわかる。このように、インターロック状態/通常状態を識別する識別情報を適宜設定・更新するようにすると、演算部は、OUT命令を実行するに際し、対応する識別情報を参照するだけで、通常処理をするかインターロック処理をするかを認識できる。インターロック時動作情報は、実施形態では、インターロック時動作フラグに対応する。   The calculation unit corresponds to the MPU 21 in the embodiment. In the embodiment, whether or not the interlock area is in the interlock state can be known by referring to the value of “isInterLock”. As described above, when the identification information for identifying the interlock state / normal state is appropriately set and updated, the arithmetic unit performs normal processing only by referring to the corresponding identification information when executing the OUT instruction. Or whether to perform interlock processing. In the embodiment, the interlock operation information corresponds to an interlock operation flag.

本発明によれば、OUT命令を実行するに際し、その都度、インターロック状態か否かを確認し、インターロック状態の場合にはそれに応じた処理(出力OFFや命令非実行等)を行ない、通常状態であれば通常の演算処理をする。これにより、ソフトウェアによるインターロックを実現することができる。そして、インターロック時動作情報を適宜に設定することにより、インターロック状態のインターロック領域中に存在するPOUを実行させたり、従来通り実行させないようにしたりすることが個別に設定可能となる。特に、POUがファンクションブロックのように内部変数を持つものの場合、インターロック状態であってもプログラムを実行させることで内部変数の更新を行なうことができるので好ましい。   According to the present invention, each time an OUT instruction is executed, it is checked whether or not it is in an interlock state, and if it is in an interlock state, processing corresponding to that (such as output OFF or instruction non-execution) is performed. If it is in the state, normal arithmetic processing is performed. Thereby, the interlock by software is realizable. Then, by appropriately setting the operation information at the time of interlock, it is possible to individually set whether or not to execute the POU existing in the interlock area in the interlock state. In particular, when the POU has an internal variable such as a function block, it is preferable because the internal variable can be updated by executing the program even in the interlock state.

(2)ユーザプログラムは、インターロック開始命令とインターロック終了命令とで囲んだインターロック領域内に別のインターロック開始命令とインターロック終了命令とを配置するインターロック領域のネストが許容され、インターロック開始命令に対応する入力が、インターロック状態か通常状態かを示す状態判定用フラグを格納するデータ領域を備え、演算部は、入れ子状態のインターロック領域については、その入れ子状態のインターロック領域に対応する状態判定用フラグと、そのインターロック領域を含むように設定される他のインターロック領域に対応する状態判定用フラグフラグのうち、少なくとも1つがインターロック状態を示す場合、その入れ子状態のインターロック領域はインターロック状態として処理をするようにするとよい。これにより、インターロックのネストを実現できる。   (2) The user program is allowed to nest an interlock area in which another interlock start instruction and an interlock end instruction are arranged in an interlock area surrounded by an interlock start instruction and an interlock end instruction. A data area for storing a state determination flag indicating whether the input corresponding to the lock start instruction is an interlock state or a normal state is provided, and the arithmetic unit, for a nested interlock area, includes the nested interlock area. If at least one of the state determination flag corresponding to the state and the state determination flag flag corresponding to another interlock region set so as to include the interlock region indicates the interlock state, the nested state Process the interlock area as an interlock state. Then good. Thereby, interlock nesting can be realized.

(3)POU中に、対となるインターロック開始命令とインターロック終了命令が記述され、演算部は、そのPOU中でもインターロック状態か否かにより対応する処理を実行するようにするとよい。   (3) A pair of interlock start instructions and interlock end instructions are described in the POU, and the arithmetic unit may execute a corresponding process depending on whether or not the POU is in the interlock state.

(4)更に本発明は、複数の命令語から構成されるプログラム構成単位であるPOUを含むユーザプログラムを演算実行する演算部を備えた産業用コントローラ用機器であって、ユーザプログラムは、対となるインターロック開始命令とインターロック終了命令が記述された場合、その両命令で囲んだ区間がインターロック領域となり、インターロック開始命令に対応する入力がインターロック状態を示す値の場合、インターロック領域をインターロック状態となるようにする。そして、演算部は、ユーザプログラム中のOUT命令を実行するに際し、そのOUT命令が含まれるインターロック領域がインターロック状態か否かを判断し、インターロック状態の場合には設定されたインターロック処理を実行する機能を備えるようにしてもよい。   (4) Furthermore, the present invention is an industrial controller device including an operation unit that performs an operation of a user program including a POU that is a program constituent unit composed of a plurality of instruction words. When an interlock start instruction and an interlock end instruction are described, the section enclosed by both instructions becomes the interlock area, and when the input corresponding to the interlock start instruction is a value indicating the interlock state, the interlock area To be in an interlock state. Then, when executing the OUT instruction in the user program, the arithmetic unit determines whether or not the interlock area including the OUT instruction is in the interlock state, and in the case of the interlock state, the set interlock process May be provided with a function of executing

本発明は、産業用コントローラ用機器において、ユーザプログラム中のインターロックについて個々に柔軟に対応ができ、対象プログラムの特徴にあわせたインターロックアルゴリズムの設定や変更が可能となる。   According to the present invention, in an industrial controller device, the interlock in the user program can be flexibly dealt with individually, and the interlock algorithm can be set or changed in accordance with the characteristics of the target program.

図1は、本発明が適用される産業用コントローラの一種であるプログラマブルオートメーションコントローラ(Programmable Automation Controller、略してPAC)1の一形態を示している。このPAC1は、各種の機能を実現するための複数のユニットを連結して構成され、各ユニットは内部バスにて接続される。この複数のユニットは、少なくとも1つのCPUユニット2を有する。更に、本実施形態では、PAC1は、電源ユニット3,モータユニット4,カウンタユニット5,画像ユニット6,通信ユニット7,I/Oユニット8を備えている。もちろん、PAC1を構成するユニットは、上記のものに限ることはなく、実行したい制御等に応じて必要なユニットを適宜取捨選択して構成する。例えば、PACは、「CPUユニット+モータユニット+カウンタユニット」,「CPUユニット+I/Oユニット」という組合せの構成も有効である。なお、本実施形態では、PAC1を例にして説明するが、PLCについても同様に適用できる。   FIG. 1 shows one form of a programmable automation controller (abbreviated as PAC) 1 which is a kind of industrial controller to which the present invention is applied. The PAC1 is configured by connecting a plurality of units for realizing various functions, and each unit is connected by an internal bus. The plurality of units have at least one CPU unit 2. Furthermore, in the present embodiment, the PAC 1 includes a power supply unit 3, a motor unit 4, a counter unit 5, an image unit 6, a communication unit 7, and an I / O unit 8. Of course, the units constituting the PAC1 are not limited to those described above, and the necessary units are appropriately selected according to the control to be executed. For example, a combination of “CPU unit + motor unit + counter unit” and “CPU unit + I / O unit” is also effective for PAC. In the present embodiment, PAC1 is described as an example, but the present invention can be similarly applied to PLC.

CPUユニット2やその他のユニットに対して事前に各種の詳細設定を行なう。その場合、図示するように、ユーザは、CPUユニット2にパソコンを接続するとともに、そのパソコンにインストールされたアプリケーションプログラムである設定ツールプログラムを起動し、その設定ツールプログラムを用いて、制御プログラム(ユーザプログラムとも呼ぶ)の作成または編集をしてCPUユニットに記憶したり、ユニット間通信に関する設定をしたり、各種ユニットを動作するための各種の詳細設定をする。CPUユニット2は、基本的には入力ユニットや通信ユニットを経由してINデータを取り込む処理(INリフレッシュ処理)、取り込んだINデータに基づいて制御プログラムを演算実行する処理(ユーザプログラム実行処理)、出力ユニット等へOUTデータを出力する処理(OUTリフレッシュ)を行なう。電源ユニット3は、商用電力・交流電圧を各ユニットに応じた直流電圧に変換し、連結された各ユニットに電力を供給する。なお、各ユニットに対して直接直流電圧を供給することで、電源ユニットを接続しない構成とすることでもよい。モータユニット4は、1台以上のサーボドライブ(サーボモータとその制御装置)を接続でき、そのサーボモータの制御を行う。カウンタユニット5は、1台以上のロータリーエンコーダを接続し、エンコーダからのパルス信号を取り込んで回転量や対象物体の移動量などを計測する。画像ユニット6は、1台以上のカメラを接続し、カメラからの画像について所望の画像処理を行なって撮像対象の物体の移動量や部品個数などを計測する。通信ユニット7は、ネットワークに接続された他の産業用コントローラとデータの送受を行なう。I/Oユニット8は、設備装置内のセンサやスイッチなどの入力機器を接続してそれらのオン・オフ信号を入力信号として取り込む入力ユニットや、設備装置側の制御対象となるアクチュエータやリレーなどの出力機器を接続してそれらに対して出力信号を送り出す出力ユニット等である。入力機能と出力機能とを併せ持つ入出力ユニットも含まれる。   Various detailed settings are made in advance for the CPU unit 2 and other units. In that case, as shown in the figure, the user connects a personal computer to the CPU unit 2 and starts a setting tool program which is an application program installed in the personal computer, and uses the setting tool program to control the program (user (Also called a program) is created or edited and stored in the CPU unit, settings relating to inter-unit communication, and various detailed settings for operating various units. The CPU unit 2 is basically a process for fetching IN data via an input unit or a communication unit (IN refresh process), a process for calculating and executing a control program based on the fetched IN data (user program execution process), Processing for outputting OUT data to an output unit or the like (OUT refresh) is performed. The power supply unit 3 converts commercial power / AC voltage into a DC voltage corresponding to each unit, and supplies power to each connected unit. Note that a configuration in which a power supply unit is not connected may be made by directly supplying a DC voltage to each unit. The motor unit 4 can connect one or more servo drives (servo motor and its control device) and controls the servo motor. The counter unit 5 connects one or more rotary encoders, takes a pulse signal from the encoder, and measures the amount of rotation and the amount of movement of the target object. The image unit 6 connects one or more cameras, performs desired image processing on the images from the cameras, and measures the amount of movement of the object to be imaged, the number of parts, and the like. The communication unit 7 transmits / receives data to / from other industrial controllers connected to the network. The I / O unit 8 is an input unit that connects input devices such as sensors and switches in the equipment and takes in the on / off signals as input signals, and an actuator and relay that are controlled by the equipment. An output unit that connects output devices and sends output signals to them. An input / output unit having both an input function and an output function is also included.

これらの各ユニットは、ユニットの側面に設けられたコネクタ同士を接続することで、電気的に接続される。この接続により、各ユニット同士は内部バス(パラレル通信)や高速シリアル通信線等を用いて接続され、ユニット間でのデータの送受が行なわれる。   These units are electrically connected by connecting connectors provided on the side surfaces of the units. With this connection, the units are connected to each other using an internal bus (parallel communication), a high-speed serial communication line, and the like, and data is transmitted and received between the units.

図2は、CPUユニット2の内部構成を示している。CPUユニット2は、MPU21と、周辺コントローラ22と、メモリ23と、通信インタフェース24と、を備えている。MPU21は、パーソナルコンピュータ等にも実装される高性能なもので、所定の演算処理を実行する。このMPU21は、実行周期ごとに分けた複数のタスクを、定周期間隔でスキャンし動作する。すなわち、MPU21が実行すべきタスクは、たとえば1ms周期で実行すべきタスクもあれば、2ms周期で実行すべきタスクもある。もちろん、それ以外にも、4ms,8ms,……というような様々な周期のタスクが存在することがある。そこで、MPU21は、マルチタスク処理により実行すべき周期のタスクを演算処理する。なお、各タスクは、例えば、ラダー言語などで書かれたユーザプログラムを実行するものである。従来のPLCの場合、上記の各タスクごとの実行周期という概念はなく、それら各タスクに対応するプログラムをまとめて記述した一連の制御プログラムを先頭から順に実行し、更に、IOリフレッシュや周辺処理を含む1つのサイクル処理をサイクリックに繰返し実行するようにしていたが、本実施形態のPAC1は、上記のようにマルチタスク処理(時分割処理)を行なう点で相違する。なお、それぞれのマルチタスク処理についてINリフレッシュ処理及びOUTリフレッシュとは同期しなくてもよいし、同期させてもよい。また、PACは、必ずしもマルチタスク処理をするものではなく、従来のようにサイクリックに処理をするものでも良い。   FIG. 2 shows the internal configuration of the CPU unit 2. The CPU unit 2 includes an MPU 21, a peripheral controller 22, a memory 23, and a communication interface 24. The MPU 21 is a high-performance device that is also mounted on a personal computer or the like, and executes predetermined arithmetic processing. The MPU 21 operates by scanning a plurality of tasks divided for each execution cycle at regular intervals. That is, the tasks to be executed by the MPU 21 include, for example, a task that should be executed at a cycle of 1 ms and a task that should be executed at a cycle of 2 ms. Of course, there may be tasks with various periods such as 4 ms, 8 ms, and so on. Therefore, the MPU 21 calculates a task having a cycle to be executed by multitask processing. Each task executes a user program written in, for example, a ladder language. In the case of a conventional PLC, there is no concept of the execution cycle for each task described above, a series of control programs that collectively describe programs corresponding to each task are executed in order from the top, and IO refresh and peripheral processing are performed. One cycle process including the above is cyclically repeated, but the PAC1 of the present embodiment is different in that the multitask process (time division process) is performed as described above. Note that the multi-task processing may not be synchronized with the IN refresh processing and the OUT refresh, or may be synchronized. Further, the PAC does not necessarily perform multitask processing, but may perform processing cyclically as in the past.

周辺コントローラ22は、チップセットとも称されるもので、メモリ23やインタフェース24とMPU21との間を取り持ち、調停やタイミング調整を行なう。これにより、MPU21は、演算に注力することができる。メモリ23は、例えばMPU21が演算処理をする際にワークメモリとして使用される。通信インタフェース24は、設定用のツール装置を構成するパーソナルコンピュータと接続を図るためのインタフェースである。なお、図示省略するが、他のスレーブ(ユニット)と通信をするための通信インタフェースも備える。このスレーブとしての通信ユニットは、PAC1の内部に実装される通信媒体(内部バス,高速シリアル通信線)を介して通信をする。   The peripheral controller 22 is also referred to as a chip set, and has a memory 23, an interface 24, and the MPU 21 to perform arbitration and timing adjustment. Thereby, MPU21 can concentrate on a calculation. The memory 23 is used as a work memory when the MPU 21 performs arithmetic processing, for example. The communication interface 24 is an interface for connection with a personal computer constituting a setting tool device. Although not shown, a communication interface for communicating with other slaves (units) is also provided. The communication unit as a slave communicates via a communication medium (internal bus, high-speed serial communication line) mounted in the PAC1.

本実施形態では、ファンクションブロック(Function Block:FB)によるプログラムの記述を許容しているので、メモリ23上に各ファンクションブロックのインスタンス格納用のデータ領域であるFBインスタンス格納用領域23aを設けている。図3(a)に示すように、メモリ23に設定されるFBインスタンス格納用領域23aは、ファンクションのインスタンスごとに独立して必要な情報を確保するものであり、主に3つの領域から構成される。すなわち、インターロック時にファンクションブロック呼び出しを行なうか否かを指定するフラグ(インターロック時動作フラグ)と、ファンクションブロックインスタンスが保持する各データを格納するデータ領域と、ファンクションブロック実行時の処理を指すポインタである。このポインタは図3(a)中の「手続き」に該当する。ポインタの情報は、メモリ23に格納されているFB定義(ファンクションブロック定義)の具体的な実行時処理を特定するための情報を格納する場所となる。つまり、このポインタで指されるのが、ファンクションブロック定義であり、具体的な実行時処理のプログラム(図5参照)が格納された領域となる。   In the present embodiment, since description of a program by function blocks (Function Blocks: FB) is allowed, an FB instance storage area 23a that is a data area for storing instances of each function block is provided on the memory 23. . As shown in FIG. 3A, the FB instance storage area 23a set in the memory 23 secures necessary information independently for each function instance, and is mainly composed of three areas. The In other words, a flag that specifies whether or not to call a function block at the time of interlocking (operation flag at the time of interlocking), a data area that stores each data held by the function block instance, and a pointer that indicates processing at the time of function block execution It is. This pointer corresponds to the “procedure” in FIG. The pointer information is a place for storing information for specifying a specific execution process of the FB definition (function block definition) stored in the memory 23. That is, what is pointed by this pointer is a function block definition, which is an area in which a program for specific execution processing (see FIG. 5) is stored.

補足すると、概念的にファンクションブロックは型と実体とから構成されている。型とはデータ型と手続きを表しており、実体の雛型となるものである、実体とは、雛型から生成されるものである。これに対応するようにファンクションブロックは、メモリ領域にFB定義とFBインスタンス領域として格納される。そしてファンクションブロックのインスタンスごとに独立して必要な情報をFBインスタンス領域に確保し、同一のファンクションブロックのインスタンスに共通している情報をFB定義に確保することになる。FBインスタンス領域の代表例としてデータが、FB定義の代表例として手続きがある。手続きがFB定義に確保されるためにファンクションブロック実行時の処理を指すポインタはFB定義を表すことになる。   Supplementally, a function block is conceptually composed of a type and an entity. A type represents a data type and a procedure, and is a template of an entity. An entity is generated from a template. Corresponding to this, the function block is stored in the memory area as an FB definition and an FB instance area. Necessary information is secured in the FB instance area independently for each function block instance, and information common to the same function block instance is secured in the FB definition. Data is a representative example of the FB instance area, and a procedure is a representative example of the FB definition. Since the procedure is secured in the FB definition, a pointer indicating processing at the time of function block execution represents the FB definition.

MPU21は、ファンクションブロック呼出時にインターロック時動作フラグを確認し、ONならばインターロック中にファンクションブロック呼出を行ない、ファンクションブロックのプログラムを実行する。OFFならばインターロック中はファンクションブロック呼び出しを行わず、ファンクションブロックのプログラムを非実行とする。   The MPU 21 confirms the interlock operation flag when the function block is called. If it is ON, the MPU 21 calls the function block during the interlock and executes the function block program. If OFF, the function block program is not called during interlocking, and the function block program is not executed.

更に、本実施形態では、ネストのあるインターロック実現のため、メモリ23上に状態判定用フラグを格納するためのデータ領域23bを設けている。図3(b)に示すように、本実施形態ではデータ領域23bを8bit分確保しており、各bitがインターロックのネストの1段に対応している。あるインターロック領域がインターロック状態の場合には、対応するbit(状態判定用フラグ)が0になり、あるインターロック領域がインターロック状態でない通常状態の場合には、対応するbit(状態判定用フラグ)が1になるように制御する。これにより、少なくとも1つのbitに0の状態判定用フラグが存在していればインターロック状態であり、全てのbitが1の状態判定用フラグならば、通常状態であることがわかる。   Furthermore, in the present embodiment, a data area 23b for storing a state determination flag is provided on the memory 23 in order to realize a nested interlock. As shown in FIG. 3B, in this embodiment, the data area 23b is secured for 8 bits, and each bit corresponds to one level of interlock nesting. When a certain interlock area is in an interlock state, the corresponding bit (state determination flag) is 0, and when a certain interlock area is in a normal state other than the interlock state, the corresponding bit (for state determination) The flag is controlled to be 1. As a result, it is understood that if at least one bit has a state determination flag of 0, it is in an interlock state, and if all bits have a state determination flag of 1, it is in a normal state.

次に、CPUユニット2が演算実行するネスト構造のインターロックについて、具体的なラダー図で記述されたユーザプログラムを用いて説明する。図4は、インターロック命令を用いたラダー図を示している。図において、“MILH”が、インターロック開始命令であり、“MILC”が、インターロック終了命令である。また、同一のインターロック番号(図では、“0”,“1”)により、対となるインターロック開始命令とインターロック終了命令が特定される。そして、この対となるインターロック開始命令からインターロック終了命令までの間が、インターロック領域となり、インターロック中は、そのインターロック領域中に存在する出力接点(図では“MILH 0”〜“MILC 0”にはさまれた“0002.00”,“H00.00”はOFF(0)となり、SET命令,CNT命令等のOUT系の命令は実行されない。インターロックは、インターロック開始命令に関連付けられる入力接点(図では、“W000.00”,“W000.01”)がOFFの時にインターロックされる。   Next, the interlock of the nested structure that is executed by the CPU unit 2 will be described using a user program described in a specific ladder diagram. FIG. 4 shows a ladder diagram using an interlock instruction. In the figure, “MILH” is an interlock start command, and “MILC” is an interlock end command. Also, the interlock start instruction and the interlock end instruction to be paired are specified by the same interlock number (“0”, “1” in the figure). The area between the interlock start instruction and the interlock end instruction is an interlock area. During the interlock, output contacts ("MILH 0" to "MILC" in the figure) exist in the interlock area. “0002.00” and “H00.00” sandwiched between 0 are OFF (0), and OUT-related commands such as the SET command and the CNT command are not executed.Interlock is an input associated with the interlock start command. Interlocked when the contact ("W000.00", "W000.01" in the figure) is OFF.

また、本実施形態では、対となるMILHからMILCまでの区間であるインターロック領域中に、別の対となるMILH,MILCを入れ子状態に配置したネストを許容する。図示の例では、“MILH 0”〜“MILC 0”のインターロック領域中に、“MILH 1”〜“MILC 1”のインターロック領域が配置されたネスト構造となっている。   Further, in the present embodiment, nests in which another pair of MILH and MILC are arranged in a nested state are allowed in the interlock region that is a section from the pair of MILH to MILC. In the example shown in the figure, a nested structure is formed in which the interlock regions “MILH 1” to “MILC 1” are arranged in the interlock regions “MILH 0” to “MILC 0”.

このプログラムによれば、MILH 0 0100.00の入力接点W000.00、MILH 1 0100.01の入力接点W000.01が共にONの時、インターロック領域の命令はインターロックされずに全て通常通り実行される。   According to this program, when the input contact W000.00 of MILH 0 0100.00 and the input contact W000.01 of MILH 1 0100.01 are both ON, the commands in the interlock area are all executed normally without being interlocked.

また、MILH 0 0100.00の入力接点W000.00がOFFの時には、MILH 0 からMILC 0までのインターロック領域の出力がインターロックされる。つまり、入れ子となる“MILH 1”,“MILC 1”は、その外側の“MILH 0”,“MILC 0”がインターロックされている場合には、インターロック開始命令“MILH 1”の入力接点W000.01の値に関わらず、MILH 1 0100.01からMILC 1までの領域の出力もインターロックされる。よって、インターロック中のため、MPU21は、出力接点である0002.00、H00.00接点をOFFにし、SET 0002.03並びにCNT 1 #0010命令は、前サイクル時の値のままする(保持する)。   When the input contact W000.00 of MILH 0 0100.00 is OFF, the outputs in the interlock region from MILH 0 to MILC 0 are interlocked. In other words, the nested “MILH 1” and “MILC 1” are input contacts W000 of the interlock start instruction “MILH 1” when the outer “MILH 0” and “MILC 0” are interlocked. Regardless of the value of .01, the output in the region from MILH 1 0100.01 to MILC 1 is also interlocked. Therefore, since the interlock is in progress, the MPU 21 turns off the output contacts 0002.00 and H00.00, and the SET 0002.03 and CNT 1 # 0010 instructions remain at the values of the previous cycle (hold).

一方、MILH 0 0100.00の入力接点W000.00がONで、MILH 1 0100.01の入力接点W000.01がOFFの場合、“MILH 0”のインターロック開始命令ではインターロックがされず、“MILH 1”のインターロック開始命令でインターロックとなる。従って、MILH 0 0100.00からMILH 1 0100.01の領域は通常通り実行され、MPU21は出力接点0002.00に入力接点0000.01の値(ON/OFF)を書き込む。そして、MILH 1 0100.01からMILC 1までのインターロック領域の出力がインターロックされるので、MPU21は、その領域内のH00.00接点をOFF、SET 0002.03を前サイクルの値のままとする。また、MILC 1からMILC 0の領域は通常通り実行され、MPU21は、2つの入力接点(0000.04,0000.05)に基づきCNT命令を実行する。   On the other hand, when the input contact W000.00 of MILH 0 0100.00 is ON and the input contact W000.01 of MILH 1 0100.01 is OFF, the interlock start command of “MILH 0” is not interlocked and “MILH 1” The interlock is activated by the interlock start command. Accordingly, the region from MILH 0 0100.00 to MILH 1 0100.01 is executed as usual, and the MPU 21 writes the value (ON / OFF) of the input contact 0000.01 to the output contact 0002.00. Since the output of the interlock area from MILH 1 0100.01 to MILC 1 is interlocked, the MPU 21 turns off the H00.00 contact in that area and keeps SET 0002.03 at the value of the previous cycle. The MILC 1 to MILC 0 area is executed as usual, and the MPU 21 executes the CNT instruction based on the two input contacts (0000.04,0000.05).

そして、本実施形態では、インターロック状態であるか否かの判断をし、インターロック状態の場合にはインターロック中の処理をするのを、専用のハードウェアではなく、ソフトウェアにより処理するようにしている。これにより、ユーザプログラム中のインターロックに柔軟に対応ができ、対象プログラムの特徴にあわせたインターロックアルゴリズムの変更に対応できるようになる。   In the present embodiment, it is determined whether or not the interlock state is established, and in the interlock state, the processing during the interlock is performed by software instead of dedicated hardware. ing. As a result, it is possible to flexibly deal with the interlock in the user program, and to deal with a change in the interlock algorithm in accordance with the characteristics of the target program.

MPU21は、出力接点や、各種の命令等、少なくともインターロック状態か否かで処理が異なる箇所において、当該処理を実行するに先立ち、インターロック状態か通常状態かを判断し、その状態に応じた処理を実行するようにする。具体的には、図4に示すプログラムの場合、MPU21は、以下の処理を実行する。   The MPU 21 determines whether it is in the interlock state or the normal state before executing the process at the location where the process differs depending on whether or not it is in the interlock state, such as an output contact or various instructions, and according to the state Execute the process. Specifically, in the case of the program shown in FIG. 4, the MPU 21 executes the following processing.

(1)MPU21は、1bitの値であるW000.00を読み込み、読み込んだ値をパワーフローと呼ぶデータ格納領域(Power Flow、以下PFと表記する)に書き込む。次にMPU21はMILH 0 0100.00命令を実行する。すなわち、MPU21は、PFが0ならばインターロック状態となり、PFが1ならば通常状態を継続するように決定する。 (1) The MPU 21 reads W000.00, which is a 1-bit value, and writes the read value in a data storage area (Power Flow, hereinafter referred to as PF) called a power flow. Next, the MPU 21 executes the MILH 0 0100.00 instruction. That is, the MPU 21 determines to enter the interlock state if the PF is 0, and to continue the normal state if the PF is 1.

(2)MPU21は0000.01を読み込み、値をPFに書き込む。次にMPU21はOUT 0002.00命令を実行する。すなわち、MPU21はインターロック状態ならば0002.00をOFFとし、通常状態ならば0002.00にPFの値を書き込む。 (2) The MPU 21 reads 0000.01 and writes the value to the PF. Next, the MPU 21 executes the OUT 0002.00 instruction. That is, the MPU 21 turns OFF 0002.00 in the interlock state, and writes the PF value in 0002.00 in the normal state.

(3)MPU21はW000.01を読み込み、PFに書き込む。次にMPU21はMILH 1 0100.01命令を実行する。つまりMPU21はPFが0ならばインターロック状態となり、PFが1ならば通常状態を継続する。 (3) The MPU 21 reads W000.01 and writes it to the PF. Next, the MPU 21 executes the MILH 1 0100.01 instruction. In other words, the MPU 21 enters an interlock state when the PF is 0, and continues the normal state when the PF is 1.

(4)MPU21は0000.02を読み込み、PFに書き込む。MPU21はOUT H00.00命令を実行する。つまり、MPU21はインターロック状態ならばH00.00をOFFとし、通常状態ならばH00.00にPFの値を書き込む。 (4) The MPU 21 reads 0000.02 and writes it to the PF. The MPU 21 executes the OUT H00.00 instruction. That is, the MPU 21 turns off H00.00 in the interlock state, and writes the value of PF in H00.00 in the normal state.

(5)MPU21は0000.03を読み込み、PFに書き込む。MPU21はインターロック状態ならばSET 0002.03命令を実行せず、前の値のままとし、通常状態ならばSET 0002.03命令を実行し、PFがONならば0002.03をONとする。 (5) The MPU 21 reads 0000.03 and writes it to the PF. If the MPU 21 is in the interlock state, the SET 0002.03 instruction is not executed and the previous value remains unchanged. If the MPU 21 is in the normal state, the SET 0002.03 instruction is executed. If the PF is ON, 0002.03 is turned ON.

(6)MPU21はMILC 1命令、つまりインターロック終了命令を実行する。このインターロック終了命令の具体的な処理アルゴリズムについては、後述する。 (6) The MPU 21 executes a MILC 1 instruction, that is, an interlock end instruction. A specific processing algorithm of the interlock end instruction will be described later.

(7)MPU21は0000.04を読み込み、PFに書き込む。MPU21はPFをスタックにプッシュし、0000.05を読み込み、PFに書き込む。そして、MPU21はCNT 1 #0010命令を実行する。 (7) The MPU 21 reads 0000.04 and writes it to the PF. The MPU 21 pushes the PF onto the stack, reads 0000.05, and writes it to the PF. Then, the MPU 21 executes the CNT 1 # 0010 instruction.

(8)MPU21はインターロック終了命令であるMILC 0命令を実行する。 (8) The MPU 21 executes a MILC 0 instruction which is an interlock end instruction.

図5は、ネスト構造のインターロック命令を用いたラダー図の別の例を示している。このプログラムは、図4と比較し、ファンクションブロック1を含む点で相違する。また、図6は、このファンクションブロック1のプログラムの一例を示している。ファンクションブロック(Function Block、FB)は、ファンクションブロックの実体であるインスタンスごとにデータを所持する機能部品である。このようにファンクションブロックが存在する場合でも、インターロック開始命令の入力接点であるW000.00,W000.01のON/OFFの状態に応じて、図4の場合と同様に、全領域において各命令を通常通り実行する通常状態となったり、MILH 0 0100.00からMILC 0までの領域がインターロック状態となったり、MILH 1 0100.01からMILC 1までの領域のみがインターロック状態となったり、柔軟に対応できるようになっている。   FIG. 5 shows another example of a ladder diagram using a nested interlock instruction. This program is different from FIG. 4 in that the function block 1 is included. FIG. 6 shows an example of the function block 1 program. A function block (Function Block, FB) is a functional component that possesses data for each instance that is the substance of a function block. Even in the case where a function block exists in this manner, each command in all areas is similar to the case of FIG. 4 according to the ON / OFF state of W000.00 and W000.01 which are input contacts for the interlock start command. It is possible to flexibly cope with the normal state in which the process is executed normally, the region from MILH 0 0100.00 to MILC 0 is in the interlock state, or only the region from MILH 1 0100.01 to MILC 1 is in the interlock state. It is like that.

そして、この図5に示すプログラムの場合、MPU21は、上述の(5)の処理が、下記の(5)′の処理を実行するように機能する。   In the case of the program shown in FIG. 5, the MPU 21 functions so that the process (5) described above executes the process (5) ′ described below.

(5)′MPU21は、0000.03を読み込み、PFに書き込む。MPU21はFB EN命令、ENO命令を呼び出す。そして、図6に示したファンクションブロックの場合、MPU21はENを読み込み、PFに書き込む。次にMPU21はOUT isRun命令を実行する。つまり、MPU21はインターロック状態ならばisRunをOFFとし、通常状態ならばisRunにPFの値を書き込む。ここで、isRunはファンクションブロック内で定義されたBOOL型の局所変数である。また、図6から明らかなように、本実施形態のファンクションブロックは、その内部プログラムにおいてもインターロック開始命令のMILHと、インターロック終了命令のMILCの使用が許可されており、インターロック開始命令のMILH numILと対となる入力接点ENの値により、ファンクションブロックの内部プログラムの所定領域が、インターロック状態になったり、通常状態になったりする。 (5) 'The MPU 21 reads 0000.03 and writes it to the PF. The MPU 21 calls the FB EN instruction and the ENO instruction. In the case of the function block shown in FIG. 6, the MPU 21 reads EN and writes it to the PF. Next, the MPU 21 executes an OUT isRun instruction. That is, the MPU 21 turns off isRun if it is in the interlock state, and writes the value of PF in isRun if it is in the normal state. Here, isRun is a BOOL type local variable defined in the function block. As is clear from FIG. 6, the function block of this embodiment is permitted to use the interlock start instruction MILH and the interlock end instruction MILC in the internal program. Depending on the value of the input contact EN paired with MILH numIL, a predetermined area of the internal program of the function block becomes an interlock state or a normal state.

MPU21はMILH numIL isIL命令を実行する。MPU21はPFが0ならばMILH numILからインターロック状態となり、PFが1ならば通常状態を継続する。   The MPU 21 executes the MILH numIL isIL instruction. The MPU 21 enters an interlock state from MILH numIL if the PF is 0, and continues the normal state if the PF is 1.

MPU21は、常時ONフラグであるP_Onを読み込み、PFに書き込む。MPU21はOUT ENO命令を実行する。MPU21はインターロック状態ならばENOをOFFとし、通常状態ならばENOにPFの値を書き込む。そして、MPU21はMILC numIL命令を実行する。これにより、ファンクションブロックの内部プログラムの実行が完了する。   The MPU 21 reads P_On, which is an always-on flag, and writes it to the PF. The MPU 21 executes the OUT ENO instruction. The MPU 21 turns off ENO in the interlock state, and writes the value of PF into ENO in the normal state. Then, the MPU 21 executes the MILC numIL instruction. Thereby, the execution of the internal program of the function block is completed.

次いで、MPU21は出力接点H00.01に対する処理を実行するに際し、インターロック状態か否かを判断し、インターロック状態ならばH00.01をOFFとし、通常状態ならばH00.01にPFの値を書き込む。   Next, when executing the process for the output contact H00.01, the MPU 21 determines whether or not it is in an interlock state. If it is in the interlock state, H00.01 is turned OFF, and if it is in a normal state, the value of PF is set to H00.01. Write.

図7は、PAC1(CPUユニット2のMPU21)におけるサイクル処理の概略のフローチャートを示しており、図8は、1つのタスク並びに周辺サービスについての処理の詳細なフローチャートを示している。   FIG. 7 shows a schematic flowchart of cycle processing in PAC1 (MPU 21 of CPU unit 2), and FIG. 8 shows a detailed flowchart of processing for one task and peripheral services.

まず、システムの電源がONされたとき、MPU21は、電源ON時処理を行う(S1)。この電源ON時処理は、ハードメモリ並びにシステムワークの初期化,実装されているユニットの認識,メモリカードからの電源ON時自動転送処理,実装ユニットと登録I/Oテーブルの照合,I/Oメモリエリアのクリア,強制セット/リセット解除などの各種の処理がある。この処理は、従来からあるPLCの場合と同様である。   First, when the system power is turned on, the MPU 21 performs processing when the power is turned on (S1). This power-on processing includes initialization of hard memory and system work, recognition of mounted units, automatic transfer processing from memory card when power is turned on, verification of mounted units and registered I / O tables, I / O memory There are various processes such as clearing the area and forcibly setting / resetting. This process is the same as in the case of a conventional PLC.

次いで、MPU21は、登録されているタスクの数だけスレッドを生成し、適切なスケジューリングに従って生成したスレッドを実行する。各タスクは、たとえば実行周期ごとに分けた複数のタスクとすることができる。そして、MPU21は、それぞれを定周期間隔でスキャンし動作する。   Next, the MPU 21 generates threads for the number of registered tasks, and executes the threads generated according to appropriate scheduling. Each task can be a plurality of tasks divided for each execution cycle, for example. Then, the MPU 21 operates by scanning each at regular intervals.

各スレッドにおいて、MPU21は、最初に共通処理を行なう(S2)。すなわち、図8に示すように、MPU21は、バッテリ異常チェック,メモリカード着脱チェック,ディップスイッチ監視,I/Oバスチェック,ユーザプログラムのメモリチェック等を行なう(S2a)。そして、MPU21は、そのチェック結果が正常であるか否かを判断し(S2b)、正常な場合には、共通処理を終了し、入力ユニットとのデータ交換を行うINリフレッシュを行なう(S3)。また、チェック結果が異常の場合、MPU21は、対応する異常リレーをセットする(S2c)。これに伴い、異常を知らせるLEDが点灯・点滅したり、アラームが鳴ったりする。MPU21は、以上の種類が運転継続可能なものか否かを判断する(S2d)。継続可能な場合(S2dはYes)には、共通処理を終了し、INリフレッシュを行なう(S3)。なお、運転を停止する異常の場合(S2dはNo)、MPU21は、INリフレッシュ並びにそれに続く演算処理を行なわずにOUTリフレッシュを行なう(S5)   In each thread, the MPU 21 first performs common processing (S2). That is, as shown in FIG. 8, the MPU 21 performs battery abnormality check, memory card attachment / detachment check, dip switch monitoring, I / O bus check, user program memory check, and the like (S2a). Then, the MPU 21 determines whether or not the check result is normal (S2b). If normal, the MPU 21 ends the common process and performs IN refresh for exchanging data with the input unit (S3). When the check result is abnormal, the MPU 21 sets a corresponding abnormal relay (S2c). Along with this, an LED for notifying abnormality is turned on / flashing or an alarm sounds. The MPU 21 determines whether or not the above types can continue operation (S2d). If it can be continued (Yes in S2d), the common process is terminated and IN refresh is performed (S3). In the case of an abnormality that stops the operation (No in S2d), the MPU 21 performs OUT refresh without performing IN refresh and subsequent arithmetic processing (S5).

INリフレッシュの実行後、MPU21は、演算処理を行なう(S4)。すなわち、MPU21は、ユーザプログラムをプログラムの先頭から順に実行し(S4a)、ユーザプログラムが終了したか否かを判断し(S4b)、終了していなければユーザプログラムの実行へ処理を戻す。この処理ステップS4a,S4bを繰り返し実行することにより、MPU21は、ユーザプログラムを最終行まで実行する。そして、ユーザプログラムが終了していれば(S4bはYes)、MPU21は、サイクルタイム算出処理を行なう(S4c)。つまり、実行周期である次のサイクルタイムまでの時間を算出し、設定する。そして、MPU21は、設定されたサイクルタイムになるまで停止する(S4d)。   After executing the IN refresh, the MPU 21 performs arithmetic processing (S4). That is, the MPU 21 executes the user program in order from the top of the program (S4a), determines whether or not the user program has ended (S4b), and if not, returns the process to the execution of the user program. By repeatedly executing these processing steps S4a and S4b, the MPU 21 executes the user program up to the last line. If the user program has ended (S4b is Yes), the MPU 21 performs a cycle time calculation process (S4c). That is, the time until the next cycle time that is the execution cycle is calculated and set. Then, the MPU 21 stops until the set cycle time is reached (S4d).

設定されたサイクルタイムに到達した時、MPU21は、出力ユニットとのデータ交換を行うOUTリフレッシュを実行する(S5)。その後MPU21は、処理ステップS2の共通処理の実行へ戻る。   When the set cycle time is reached, the MPU 21 executes OUT refresh for exchanging data with the output unit (S5). Thereafter, the MPU 21 returns to the execution of the common process in process step S2.

MPU21は、上記の処理ステップS2からS5を、各タスクごとに並列処理により繰り返し実行する。また、MPU21は、演算実行を行なう上記のタスクに加えて、周辺サービスのみを行うタスクを一つ生成し、スケジューリングに従い実行する。すなわち、MPU21は、共通処理(詳細は、処理ステップS2a〜S2c)実行後(S2′)、周辺サービスを実行する(S7)処理を繰り返し実行する。周辺サービスは、例えば、イベント発生時のみ実行されるものや、高機能I/Oユニットとのイベントサービスや、CPU高機能ユニットとのイベントサービスや、RS−232Cポートサービスや、通信ポートサービス等がある。   The MPU 21 repeatedly executes the above processing steps S2 to S5 by parallel processing for each task. Further, the MPU 21 generates one task for performing only the peripheral service in addition to the above-described task for performing the calculation, and executes it according to the scheduling. That is, the MPU 21 repeatedly executes the process (S7) for executing the peripheral service after executing the common process (specifically, the process steps S2a to S2c) (S2 '). Peripheral services include, for example, those that are executed only when an event occurs, event services with high-function I / O units, event services with CPU high-function units, RS-232C port services, communication port services, etc. is there.

ここで、演算処理(S4)、特に、ユーザプログラムの実行(S4b)について、図5,図6に示したプログラムを実行する場合のMPU21の処理・機能を説明する。図9,図10に示すように、MPU21は入力接点のW000.00を読み込み、その読み込んだ値(0/1)をPFに書き込む(S11)。   Here, the processing / function of the MPU 21 in the case of executing the program shown in FIGS. 5 and 6 will be described for the arithmetic processing (S4), in particular, the execution of the user program (S4b). As shown in FIGS. 9 and 10, the MPU 21 reads W000.00 of the input contact and writes the read value (0/1) to the PF (S11).

次にMPU21は、インターロック開始命令(MILH 0 0100.00)を実行する(S12)。このインターロック開始命令の実行処理は、具体的には、図11に示すフローチャートを実行する。ここで、図11に示す“MILH n isInterLock”の第一オペランドである“n”は、インターロック番号をあらわす。図3(b)に示すデータ領域23bを用いた場合、nは0以上8未満となる。nは、具体的な数値で記述される場合もあれば、変数で記述される場合もある。第二オペランド(isInterLock)はインターロック中であることを示すBOOL型の変数をあらわす。インターロック中isInterLockは0となり、通常状態では1となる。そして、nやisInterLockは、具体的な数値で記述される場合もあれば、変数で記述される場合もある。また、インターロック開始命令を示すシンボルの3段(MILH/番号/アドレス)との関係でいうと、“n”は中段の番号に対応し、“isInterLock”は下段のアドレスに対応する。つまり、インターロック開始命令で指定される当該アドレスに、isInterLockの値が書き込まれる。そして、インターロック開始命令(MILH命令)の一般的な処理は、以下の通りである。   Next, the MPU 21 executes an interlock start command (MILH 0 0100.00) (S12). Specifically, the execution process of the interlock start command executes the flowchart shown in FIG. Here, “n” which is the first operand of “MILH is isInterLock” shown in FIG. 11 represents an interlock number. When the data area 23b shown in FIG. 3B is used, n is 0 or more and less than 8. n may be described as a specific numerical value or may be described as a variable. The second operand (isInterLock) represents a Boolean variable indicating that the interlock is being performed. During interlock, isInterLock is 0, and is 1 in the normal state. N and isInterLock may be described by specific numerical values or may be described by variables. Further, in relation to the three stages (MILH / number / address) of the symbol indicating the interlock start instruction, “n” corresponds to the middle number and “isInterLock” corresponds to the lower address. That is, the value of isInterLock is written to the address specified by the interlock start instruction. The general processing of the interlock start instruction (MILH instruction) is as follows.

まず、MPU21はデータ領域23bのnbitにPFの値を書き込む(S41)。処理ステップS12の場合、符号nは“0”であるので、データ領域23bの0bitの位置に、読み込んだPF(0/1)の値を書き込む。   First, the MPU 21 writes the value of the PF in nbit of the data area 23b (S41). In the case of the processing step S12, since the code n is “0”, the read PF (0/1) value is written in the 0-bit position of the data area 23b.

次いで、MPU21は、データ領域23bの8bit分が全て1であるかを確認する(S42)。いずれか1つのbitでも0がある場合には、この分岐判断はNoとなり、インターロック状態にあることになる。データ領域23bが全て1ならば、通常状態となり(S42はYes)、MPU21aは、isInterLockに1を書き込み、MILH命令実行を終了する(S43)。つまり、処理ステップS12の場合、アドレス“0100.00”の領域に1を書き込む。一方、データ領域23bの8bit中に1つでも0が存在する場合(S42はNo)、インターロック状態であることになり、MPU21aは、isInterLockに0を書き込み、MILH命令実行を終了する(S44)。つまり、処理ステップS12の場合、アドレス“0100.00”の領域に0を書き込む。   Next, the MPU 21 checks whether all 8 bits of the data area 23b are 1 (S42). If any one of the bits has 0, this branch determination is No and the interlock state is established. If all the data areas 23b are 1, the normal state is entered (S42 is Yes), and the MPU 21a writes 1 to isInterLock and ends the execution of the MILH instruction (S43). That is, in the case of the processing step S12, 1 is written in the area of the address “0100.00”. On the other hand, when even one 0 exists in 8 bits of the data area 23b (No in S42), the interlock state is set, and the MPU 21a writes 0 to isInterLock and ends the MILH instruction execution (S44). . That is, in the case of the processing step S12, 0 is written in the area of the address “0100.00”.

上記のようにしてインターロック開始命令(MILH 1 0100.00)の実行が完了したならば、MPU21は、0000.01を読み込み、PFに書き込む(S13)。次にMPU21は、OUT2.00命令を実行する。つまり、MPU21は、現在インターロック状態か否かを確認し(S14)、インターロック状態ならば2.00を0とし(S16)、通常状態ならば2.00にPFを書き込む(S15)。インターロック状態か否かは、isInterLockであるアドレス“0100.00”の領域に格納された値(1/0)に基づき判断できる。   When the execution of the interlock start instruction (MILH 1 0100.00) is completed as described above, the MPU 21 reads 0000.01 and writes it to the PF (S13). Next, the MPU 21 executes the OUT2.00 instruction. In other words, the MPU 21 confirms whether or not it is currently in the interlock state (S14). If it is in the interlock state, 2.00 is set to 0 (S16), and if it is in the normal state, PF is written in 2.00 (S15). Whether it is in the interlock state or not can be determined based on the value (1/0) stored in the area of address “0100.00” which is is InterLock.

次にMPU21はW000.01を読み込み、PFに書き込む(S17)。そして、MPU21は、インターロック開始命令(MILH 1 0100.01)を実行する(S18)。すなわち、MPU21は、図11に示すフローチャートを実行する。具体的には、MPU21は、データ領域23bの1bitにPFの値(入力接点のW000.01の値)を書き込む(S41)。次いで、MPU21は、データ領域23bの8bitが全て1であるかを確認する(S42)。いずれか1つのbitでも0がある場合には、この分岐判断はNoとなり、インターロック状態にあることになる。データ領域23bが全て1ならば、通常状態となり(S42はYes)、MPU21aは、isInterLock(0100.01)に1を書き込み、MILH命令実行を終了する(S43)。一方、データ領域23bの8bit中に1つでも0が存在する場合(S42はNo)、インターロック状態であることになり、MPU21aは、isInterLock(0100.01)に0を書き込み、MILH命令実行を終了する(S44)。   Next, the MPU 21 reads W000.01 and writes it in the PF (S17). Then, the MPU 21 executes an interlock start command (MILH 1 0100.01) (S18). That is, the MPU 21 executes the flowchart shown in FIG. Specifically, the MPU 21 writes the value of PF (the value of W000.01 of the input contact) in 1 bit of the data area 23b (S41). Next, the MPU 21 confirms whether all 8 bits of the data area 23b are 1 (S42). If any one of the bits has 0, this branch determination is No and the interlock state is established. If all the data areas 23b are 1, the normal state is entered (S42 is Yes), the MPU 21a writes 1 to isInterLock (0100.01), and ends the MILH instruction execution (S43). On the other hand, if even one 0 exists in 8 bits of the data area 23b (S42: No), the interlock state is entered, and the MPU 21a writes 0 to isInterLock (0100.01) and ends the MILH instruction execution. (S44).

このインターロック開始命令(MILH 1 0100.01)は、ネスト構造の入れ子であり、インターロック開始命令(MILH 1 0100.01)からインターロック終了命令(MILC 1)までのインターロック領域では、図5で説明したとおり、対となる入力接点W000.01がOFFの場合には、インターロック状態となる。そして、入力接点W000.01がONの場合でも、入力接点W000.00がOFFでインターロック開始命令(MILH 1 0100.00)にてすでにインターロック状態となっている場合には、インターロック開始命令(MILH 1 0100.01)からインターロック終了命令(MILC 1)までのインターロック領域はインターロック状態となる。このことは、データ領域23bの各bitに格納する状態判定用フラグを適宜に書き換えることで対応できる。すなわち、W000.01が0(OFF)の場合には、PFに0が書き込まれるので、データ領域23bの1bit(n=1)の領域に0が書き込まれる。従って、少なくとも1bitの部分が0となるので、処理ステップS42の分岐判断はNoとなり、isInterLock(0100.01)に0が書き込まれるので、インターロック状態となる。一方、W000.01が1(ON)の場合には、PFに1が書き込まれるので、データ領域23bの1bit(n=1)の領域に1が書き込まれる。このとき、W000.00が0(OFF)の場合には、処理ステップS12の実行に伴いデータ領域23bの0bit(n=0)の領域に0が書き込まれている。従って、1bitの領域の値の如何に関わらず、処理ステップS42の分岐判断はNoとなり、isInterLock(0100.01)に0が書き込まれるので、インターロック状態となる。なお、W000.01,W000.01が共に1(ON)の場合には、データ領域23bの0bitと1bitの領域は1が書き込まれ、他の領域は、初期値として1が書き込まれたままであるので、データ領域23bの全てのbitが1となり処理ステップS42の分岐判断はYesとなって通常状態となる。   This interlock start instruction (MILH 1 0100.01) is a nested structure. In the interlock area from the interlock start instruction (MILH 1 0100.01) to the interlock end instruction (MILC 1), as described in FIG. When the paired input contact W000.01 is OFF, the interlock state is established. Even when the input contact W000.01 is ON, if the input contact W000.00 is OFF and the interlock start command (MILH 1 0100.00) is already in the interlock state, the interlock start command (MILH 1 0100.01) to the interlock end command (MILC 1) is in the interlock state. This can be dealt with by appropriately rewriting the state determination flag stored in each bit of the data area 23b. That is, when W000.01 is 0 (OFF), 0 is written to the PF, so 0 is written to the 1-bit (n = 1) area of the data area 23b. Accordingly, since at least the 1-bit portion is 0, the branch determination in processing step S42 is No, and 0 is written in isInterLock (0100.01), so that the interlock state is entered. On the other hand, when W000.01 is 1 (ON), 1 is written to the PF, so 1 is written to the 1 bit (n = 1) area of the data area 23b. At this time, if W000.00 is 0 (OFF), 0 is written in the 0-bit (n = 0) area of the data area 23b as the processing step S12 is executed. Therefore, regardless of the value of the 1-bit area, the branch determination in processing step S42 is No and 0 is written to isInterLock (0100.01), so that the interlock state is entered. When both W000.01 and W000.01 are 1 (ON), 1 is written in the 0-bit and 1-bit areas of the data area 23b, and 1 is still written as the initial value in the other areas. Therefore, all the bits in the data area 23b become 1, and the branch determination in the processing step S42 becomes Yes and the normal state is set.

上記のようにしてインターロック開始命令(MILH 1 0100.01)の実行が完了したならば、MPU21は、0.02を読み込み、PFに書き込む(S19)。次にMPU21は、OUT H0.00命令を実行する。つまり、MPU21は、現在インターロック状態か否かを確認し(S20)、インターロック状態ならばH0.00を0とし(S22)、通常状態ならばH0.00にPFを書き込む(S21)。インターロック状態か否かは、isInterLockであるアドレス“0100.01”の領域に格納された値(1/0)に基づき判断できる。   When the execution of the interlock start instruction (MILH 1 0100.01) is completed as described above, the MPU 21 reads 0.02 and writes it to the PF (S19). Next, the MPU 21 executes the OUT H0.00 instruction. That is, the MPU 21 confirms whether or not it is currently in the interlock state (S20), and if it is in the interlock state, H0.00 is set to 0 (S22), and if it is in the normal state, PF is written in H0.00 (S21). Whether it is in the interlock state or not can be determined based on the value (1/0) stored in the area of address “0100.01” which is is InterLock.

次にMPU21は0000.03を読み込み、PFに書き込む(S23)。そして、MPU21は、ファンクションブロック呼び出しを行う(S24)。このファンクションブロック呼び出し処理は、具体的には、図13〜図15に示すフローチャートを実行する。   Next, the MPU 21 reads 0000.03 and writes it to the PF (S23). Then, the MPU 21 calls a function block (S24). Specifically, the function block calling process executes the flowcharts shown in FIGS.

MPU21は、データ領域23bを参照し、全て1であるかを確認する(S51)。そして、MPU21は、0が1つでも存在していれば、インターロック状態と判断し、全て1の場合は通常状態と判断する。   The MPU 21 refers to the data area 23b and checks whether all are 1 (S51). Then, the MPU 21 determines that the interlock state is present even if one 0 exists, and determines that the normal state is present when all 0s are present.

通常状態の場合、MPU21は、PFの値(0000.03の値)を調べる(S52)。そして、PFが0の場合、ファンクションブロック呼出処理を終了する。また、PFが1の場合、MPU21は、ファンクションブロックの入力値をセットし(S53)、ファンクションブロック(FB)を実行する(S54)。このファンクションブロックの実行処理は、具体的には、図14,図15に示すフローチャートを実行する。   In the normal state, the MPU 21 checks the PF value (0000.03 value) (S52). If PF is 0, the function block call processing is terminated. When PF is 1, the MPU 21 sets the input value of the function block (S53) and executes the function block (FB) (S54). Specifically, the function block execution processing executes the flowcharts shown in FIGS.

すなわち、MPU21は、ファンクションブロックのプログラムを先頭から順に実行し(S61)、プログラムが終了したか否かを判断し(S62)、終了していなければファンクションブロックのプログラムの実行へ処理を戻す。この処理ステップS61,S62を繰り返し実行することにより、MPU21は、ファンクションブロックのプログラムを最終行まで実行する。そして、プログラムが終了すればファンクションブロック実行処理を終了する。   That is, the MPU 21 executes the function block program in order from the top (S61), determines whether or not the program has ended (S62), and if not, returns the process to the execution of the function block program. By repeatedly executing the processing steps S61 and S62, the MPU 21 executes the function block program up to the last line. Then, when the program ends, the function block execution process ends.

ファンクションブロックのプログラムの実行(S61)について、図6に示したプログラムを実行する場合のMPU21の処理・機能を説明する。図15に示すように、MPU21は、ENを読み込み、PFに書き込む(S71)。次にMPU21は、isRunへの書き込み処理を行なう。isRunはOUT系であるので、書き込み処理を行なうに先立ちインターロック状態であるか否かを確認し(S72)、インターロック状態であればisRunに0を書き込み(S74)、通常状態であればisRunにPFを書き込む(S75)。処理ステップ54のファンクションブロック実行処理では、S51の分岐判断により通常状態であることがわかっているので、MPU21は、isRunにPFの値を書き込む。   Regarding the execution of the function block program (S61), the processing and function of the MPU 21 when executing the program shown in FIG. 6 will be described. As shown in FIG. 15, the MPU 21 reads EN and writes it into the PF (S71). Next, the MPU 21 performs a write process to isRun. Since isRun is an OUT system, it is checked whether or not it is in an interlock state prior to writing processing (S72). If it is in an interlock state, 0 is written to isRun (S74), and if it is in a normal state, isRun PF is written in (S75). In the function block execution process of process step 54, since it is known that the normal state is determined by the branch determination in S51, the MPU 21 writes the value of PF in isRun.

次にMPU21は、インターロック開始命令(MILH numIL isIL)を実行する(S75)。すなわち、MPU21は、図11に示すフローチャートを実行する。具体的には、MPU21は、データ領域23bの所定のbit(numILで特定される数値に該当するbit)にPFの値(入力接点のENの値)を書き込む(S41)。なお、numILは、ファンクションブロックの内部変数であり、ここでは、2から7のいずれかの数値となる。次いで、MPU21は、データ領域23bの8bitが全て1であるかを確認する(S42)。いずれか1つのbitでも0がある場合には、この分岐判断はNoとなり、インターロック状態にあることになる。データ領域23bが全て1ならば、通常状態となり(S42はYes)、MPU21aは、isInterLock(isILで特定されるアドレス)に1を書き込み、MILH命令実行を終了する(S43)。一方、データ領域23bの8bit中に1つでも0が存在する場合(S42はNo)、インターロック状態であることになり、MPU21aは、isInterLock(isIL)に0を書き込み、MILH命令実行を終了する(S44)。   Next, the MPU 21 executes an interlock start instruction (MILH numIL isIL) (S75). That is, the MPU 21 executes the flowchart shown in FIG. Specifically, the MPU 21 writes the value of PF (the value of EN of the input contact) in a predetermined bit (bit corresponding to the numerical value specified by numIL) in the data area 23b (S41). Note that numIL is an internal variable of the function block, and is a numerical value from 2 to 7 here. Next, the MPU 21 confirms whether all 8 bits of the data area 23b are 1 (S42). If any one of the bits has 0, this branch determination is No and the interlock state is established. If all the data areas 23b are 1, the normal state is entered (S42 is Yes), and the MPU 21a writes 1 to isInterLock (address specified by isIL), and ends the MILH instruction execution (S43). On the other hand, if even one 0 exists in 8 bits of the data area 23b (S42 is No), the interlock state is set, and the MPU 21a writes 0 to isInterLock (isIL) and ends the execution of the MILH instruction. (S44).

上記のようにしてインターロック開始命令(MILH numIL isIL)の実行が完了したならば、次にMPU21はP_Onを読み込み、PFに書き込む(S76)。次に、MPU21は、ファンクションブロックの出力であるENOへの書き込みを行なう。この書き込みに先立ち、MPU21は、現在インターロック状態か否かを確認し(S77)、インターロック状態であればENOに0を書き込み(S79)、通常状態であればENOにPFを書き込む(S78)。次にMPU21は、インターロック終了命令(MILC numIL)を実行し、ファンクションブロック実行処理を終了する(S80)。   When the execution of the interlock start instruction (MILH numIL isIL) is completed as described above, the MPU 21 reads P_On and writes it to the PF (S76). Next, the MPU 21 writes to the ENO that is the output of the function block. Prior to this writing, the MPU 21 checks whether or not it is currently in an interlock state (S77). If the interlock state is established, 0 is written to ENO (S79), and if it is a normal state, PF is written to ENO (S78). . Next, the MPU 21 executes an interlock end instruction (MILC numIL) and ends the function block execution process (S80).

このインターロック終了命令の実行処理は、具体的には、図12に示すフローチャートを実行する。ここで、図12に示す“MILC n”の第一オペランドである“n”は、インターロック番号をあらわす。対となるインターロック開始命令と同じインターロック番号が記述される。このMILC n命令は、MILH n 第二オペランド で始まったインターロック領域を終了することを示すのに用いる命令である。そして、インターロック終了命令(MILC命令)の一般的な処理は、以下の通りである。   Specifically, the execution process of the interlock end instruction executes the flowchart shown in FIG. Here, “n” which is the first operand of “MILC n” shown in FIG. 12 represents an interlock number. The same interlock number as the interlock start instruction to be paired is described. This MILC n instruction is used to indicate that the interlock region starting with the MILH n second operand is to be terminated. The general processing of the interlock end instruction (MILC instruction) is as follows.

まずMPU21は、データ領域23bのnbitに1を書き込む(S45)。そして、MPU21は、データ領域23bが全て1であるかを確認する(S46)。データ領域23bが全て1ならば、通常状態となり(S46はYes)、MPU21aは、isInterLockに1を書き込み、MILC命令実行を終了する(S47)。つまり、処理ステップS80の場合、アドレス“isIL”の領域に1を書き込む。一方、データ領域23bの8bit中に1つでも0が存在する場合(S46はNo)、isInterLockに0を書き込み、インターロック状態を継続した状態でMILC命令実行を終了する(S48)。つまり、処理ステップS80の場合、アドレス“isIL”の領域に0を書き込む。なお、処理ステップ54の場合、ファンクションブロック1が存在するインターロック領域(MILH1〜MILC1)は通常状態となっているので、S45の処理ステップの実行により、データ領域23bは全てのbitが1となり、通常状態となる。   First, the MPU 21 writes 1 in the nbit of the data area 23b (S45). Then, the MPU 21 checks whether all the data areas 23b are 1 (S46). If all the data areas 23b are 1, the normal state is entered (S46 is Yes), the MPU 21a writes 1 to isInterLock, and ends the MILC instruction execution (S47). That is, in the case of the processing step S80, 1 is written in the area of the address “isIL”. On the other hand, if even one 0 exists in 8 bits of the data area 23b (No in S46), 0 is written in isInterLock, and the MILC instruction execution is terminated while the interlock state is continued (S48). That is, in the case of the processing step S80, 0 is written in the area of the address “isIL”. In the case of processing step 54, since the interlock areas (MILH1 to MILC1) where the function block 1 exists are in the normal state, the execution of the processing step of S45 causes all the bits in the data area 23b to be 1, It becomes a normal state.

上記のようにしてインターロック終了命令(MILC numIL)の実行が完了したならば、図13の処理ステップS54の処理が完了するので、MPU21は、ファンクションブロック(FB)の出力値をセットし、ファンクションブロック呼出処理を終了する。   When the execution of the interlock end instruction (MILC numIL) is completed as described above, the processing of step S54 in FIG. 13 is completed, so the MPU 21 sets the output value of the function block (FB), and the function Block call processing is terminated.

一方、データ領域のいずれか1つでも0があり、インターロック状態の場合(S51でNo)、MPU21は、FBインスタンス領域23にアクセスし、該当するファンクションブロックインスタンスの“インターロック時動作フラグ”を確認する(S56)。そして、そのフラグがON(インターロック時FB実行が有効であることを示す)の場合、MPU21は、通常状態と同様にファンクションブロック(FB)の入力値をセットし(S57)、ファンクションブロックを実行し(S58)、ファンクションブロック(FB)の出力値をセットし(S59)、ファンクションブロック呼出処理を終了する。これら処理ステップS57,S58,S59は、それぞれ、S53,S54,S55と同様である。   On the other hand, if any one of the data areas has 0 and is in the interlock state (No in S51), the MPU 21 accesses the FB instance area 23 and sets the “operation flag at interlock” of the corresponding function block instance. Confirm (S56). If the flag is ON (indicating that FB execution is effective at interlock), the MPU 21 sets the input value of the function block (FB) as in the normal state (S57) and executes the function block. (S58), the output value of the function block (FB) is set (S59), and the function block call processing is terminated. These processing steps S57, S58, and S59 are the same as S53, S54, and S55, respectively.

一方、“インターロック時動作フラグ”がOFF(インターロック時FB実行が無効であることを示す)の場合、そのままファンクションブロック呼出処理を終了する。このようにすることで、インターロック状態にあるファンクションブロックであっても、ファンクションブロックのプログラムを実行したり、実行させなかったりすることができる。しかも、各ファンクションブロックインスタンスごとに、インターロック時動作フラグを設定するので、インターロック領域内にあるファンクションブロックに対し、個々に演算実行をさせたり、させなかったりすることができる。   On the other hand, when the “interlock operation flag” is OFF (indicating that the FB execution at the time of interlock is invalid), the function block call processing is terminated as it is. By doing in this way, even if it is a function block in an interlock state, the function block program can be executed or not executed. In addition, since the operation flag at the time of interlock is set for each function block instance, it is possible to individually execute or not execute the function block in the interlock area.

上記の処理により、ファンクションブロック呼び出し処理(S24)が完了したならば、図10の処理ステップS25に戻り、MPU21は、OUT H00.01命令を実行する。つまり、MPU21は、インターロック状態か否かを確認する(S25)。この確認は、“0100.01”にアクセスし、書き込まれている値(1/0)に基づいて行なえる。そして、MPU21は、インターロック状態ならばH00.01を0とし(S27)、通常状態ならばH00.01にPFを書き込む(S26)。次にMPU21は、インターロック終了命令(MILC 1)を実行する(S29)。つまり、MPU21は、図12に示すフローチャートを実行する。   If the function block calling process (S24) is completed by the above process, the process returns to the process step S25 of FIG. 10, and the MPU 21 executes the OUT H00.01 instruction. That is, the MPU 21 confirms whether or not the interlock state is established (S25). This confirmation can be made based on the written value (1/0) by accessing “0100.01”. Then, the MPU 21 sets H00.01 to 0 in the interlock state (S27), and writes PF to H00.01 in the normal state (S26). Next, the MPU 21 executes an interlock end instruction (MILC 1) (S29). That is, the MPU 21 executes the flowchart shown in FIG.

次にMPU21は、0000.04を読み込み、PFに書き込む(S30)。次いで、MPU21は、PFをスタックに積み、0000.05を読み込み、PFに書き込む(S31,S32)。そして、MPU21は、PF並びにスタックに積まれた0000.04や0000.05の値に基づいてCNT 1 #10命令を実行する(S33)。そして、MPU21は、インターロック終了命令(MILC 0)を実行する(S34)。つまり、MPU21は、図12に示すフローチャートを実行する。この終了命令を実行することで、データ領域23bの全てのbitが1に戻る。そして、これにより演算処理は、終了する。   Next, the MPU 21 reads 0000.04 and writes it in the PF (S30). Next, the MPU 21 loads the PF on the stack, reads 0000.05, and writes it to the PF (S31, S32). Then, the MPU 21 executes the CNT 1 # 10 instruction based on the PF and the values of 0000.04 and 0000.05 loaded on the stack (S33). Then, the MPU 21 executes an interlock end instruction (MILC 0) (S34). That is, the MPU 21 executes the flowchart shown in FIG. By executing this end instruction, all the bits in the data area 23b return to 1. This completes the arithmetic processing.

なお、上述した実施形態では、プログラム中に入出力変数と内部変数を持つブロックである“ファンクションブロック”を含む例について説明したが、本発明は、ファンクションブロックに限ることはなく、例えば、PLC,PAC等の産業用コントローラにおける演算の組み合わせを拡張したブロックで内部変数を持たない“ファンクション”でもよいし、I/Oやグローバル変数を含むメインプログラムである“プログラム”でもよい。このように、“ファンクションブロック”,“ファンクション”,“プログラム”等のPOU(Program Organization Unit)について適用できる。すなわち、ブロック等の適当な集合に対し、インターロック時に実行するか(呼び出しを行なうか)否かを指定するフラグ(インターロック時動作フラグ)を関連付けて記憶保持させ、演算実行時に、インターロック中のインターロック領域内に係るPOUが存在する場合、当該フラグを参照し、そのPOUの演算を実行したり、実行させなかったりすることができる。   In the above-described embodiment, an example in which a “function block” that is a block having an input / output variable and an internal variable is included in the program has been described. However, the present invention is not limited to a function block. It may be a “function” that does not have internal variables in a block obtained by expanding a combination of operations in an industrial controller such as a PAC, or may be a “program” that is a main program including I / O and global variables. Thus, the present invention can be applied to POU (Program Organization Unit) such as “function block”, “function”, and “program”. In other words, an appropriate set such as a block is associated with a flag (operation flag at interlock) that specifies whether or not to execute at the time of interlocking (calling) or not, and is interlocked at the time of calculation execution. When there is a POU in the interlock area, it is possible to refer to the flag and execute or not execute the calculation of the POU.

PACの一例を示す図である。It is a figure which shows an example of PAC. CPUユニットの内部構造の一例を示す図である。It is a figure which shows an example of the internal structure of a CPU unit. メモリの内部構造の一例を示す図である。It is a figure which shows an example of the internal structure of memory. インターロックを説明するためのプログラムの一例を示す図である。It is a figure which shows an example of the program for demonstrating an interlock. インターロックを説明するためのファンクションブロックを含むプログラムの一例を示す図である。It is a figure which shows an example of the program containing the function block for demonstrating an interlock. ファンクションブロックのプログラムの一例を示す図である。It is a figure which shows an example of the program of a function block. MPUの機能を示すフローチャートである。It is a flowchart which shows the function of MPU. MPUの機能を示すフローチャートである。It is a flowchart which shows the function of MPU. MPUの機能(ユーザプログラム実行機能)を示すフローチャート(その1)である。It is a flowchart (the 1) which shows the function (user program execution function) of MPU. MPUの機能(ユーザプログラム実行機能)を示すフローチャート(その2)である。It is a flowchart (the 2) which shows the function (user program execution function) of MPU. MPUの機能(インターロック開始命令実行機能)を示すフローチャートである。It is a flowchart which shows the function (interlock start command execution function) of MPU. MPUの機能(インターロック終了命令実行機能)を示すフローチャートである。It is a flowchart which shows the function (interlock end command execution function) of MPU. MPUの機能(ファンクションブロック呼出命令実行機能)を示すフローチャートである。It is a flowchart which shows the function (function block call instruction execution function) of MPU. MPUの機能(ファンクションブロック実行機能)を示すフローチャートである。It is a flowchart which shows the function (function block execution function) of MPU. MPUの機能(ファンクションブロック実行機能)を示すフローチャートである。It is a flowchart which shows the function (function block execution function) of MPU.

符号の説明Explanation of symbols

1 PAC
2 CPUユニット
21 MPU(制御部)
23 メモリ(記憶部)
23a FBインスタンス格納用領域
23b データ領域
1 PAC
2 CPU unit 21 MPU (control unit)
23 Memory (storage unit)
23a FB instance storage area 23b Data area

Claims (4)

複数の命令語から構成されるプログラム構成単位であるPOUを含むユーザプログラムを演算実行する演算部と、
インターロック状態の時、前記POU内の命令を実行するか否かを特定するインターロック時動作情報を格納する記憶部と、
を備え、
前記ユーザプログラムは、対となるインターロック開始命令とインターロック終了命令が記述された場合、その両命令で囲んだ区間がインターロック領域となり、前記インターロック開始命令に対応する入力がインターロック状態を示す値の場合、前記インターロック領域をインターロック状態となるようにし、
前記演算部は、
前記ユーザプログラム中のOUT命令を実行するに際し、そのOUT命令が含まれるインターロック領域がインターロック状態か否かを判断し、インターロック状態の場合には設定されたインターロック処理を実行する機能と、
インターロック状態のインターロック領域内に存在する前記POUを実行するに際し、前記記憶部のインターロック時動作情報を確認し、その確認結果に基づきそのPOU内の命令の実行/非実行をする機能と、
を備えたことを特徴とする産業用コントローラ用機器。
A computing unit that computes and executes a user program including a POU that is a program constituent unit composed of a plurality of instruction words;
A storage unit that stores operation information at the time of interlocking that specifies whether or not to execute an instruction in the POU in the interlock state;
With
In the user program, when an interlock start instruction and an interlock end instruction to be paired are described, a section surrounded by both instructions becomes an interlock area, and an input corresponding to the interlock start instruction is in an interlock state. In the case of the value shown, the interlock area is set to the interlock state,
The computing unit is
A function for determining whether or not an interlock area including the OUT instruction is in an interlock state when executing the OUT instruction in the user program, and executing a set interlock process in the case of the interlock state; ,
A function of confirming the operation information at the time of interlock of the storage unit when executing the POU existing in the interlock area in the interlock state, and executing / non-executing instructions in the POU based on the confirmation result; ,
Industrial controller equipment characterized by comprising:
前記ユーザプログラムは、インターロック開始命令とインターロック終了命令とで囲んだインターロック領域内に別のインターロック開始命令とインターロック終了命令とを配置するインターロック領域のネストが許容され、
前記インターロック開始命令に対応する入力が、インターロック状態か通常状態かを示す状態判定用フラグを格納するデータ領域を備え、
前記演算部は、入れ子状態のインターロック領域については、前記データ領域の、その入れ子状態のインターロック領域に対応する状態判定用フラグと、そのインターロック領域を含むように設定される他のインターロック領域に対応する状態判定用フラグとのうち、少なくとも1つがインターロック状態を示す場合、その入れ子状態のインターロック領域はインターロック状態として処理をすることを特徴とする請求項1に記載の産業用コントローラ用機器。
The user program is allowed to nest an interlock area in which another interlock start instruction and an interlock end instruction are arranged in an interlock area surrounded by an interlock start instruction and an interlock end instruction.
A data area for storing a state determination flag indicating whether the input corresponding to the interlock start command is an interlock state or a normal state;
For the nested interlock area, the calculation unit includes a state determination flag corresponding to the nested interlock area of the data area and another interlock set to include the interlock area. 2. The industrial use according to claim 1, wherein, when at least one of the state determination flags corresponding to the region indicates an interlock state, the nested interlock region is processed as the interlock state. Controller equipment.
前記POU中に、対となるインターロック開始命令とインターロック終了命令が記述され、前記演算部は、そのPOU中でもインターロック状態か否かにより対応する処理を実行することを特徴とする請求項1または2に記載の産業用コントローラ用機器。   2. The interlock start instruction and the interlock end instruction that are paired are described in the POU, and the arithmetic unit executes a corresponding process depending on whether or not the POU is in the interlock state. Or the apparatus for industrial controllers of 2. 複数の命令語から構成されるプログラム構成単位であるPOUを含むユーザプログラムを演算実行する演算部を備えた産業用コントローラ用機器であって、
前記ユーザプログラムは、対となるインターロック開始命令とインターロック終了命令が記述された場合、その両命令で囲んだ区間がインターロック領域となり、前記インターロック開始命令に対応する入力がインターロック状態を示す値の場合、前記インターロック領域をインターロック状態となるようにし、
前記演算部は、前記ユーザプログラム中のOUT命令を実行するに際し、そのOUT命令が含まれるインターロック領域がインターロック状態か否かを判断し、インターロック状態の場合には設定されたインターロック処理を実行する機能を備えたことを特徴とする産業用コントローラ用機器。
An industrial controller device comprising a calculation unit for calculating and executing a user program including a POU which is a program constituent unit composed of a plurality of instruction words,
In the user program, when an interlock start instruction and an interlock end instruction to be paired are described, a section surrounded by both instructions becomes an interlock area, and an input corresponding to the interlock start instruction is in an interlock state. In the case of the value shown, the interlock area is set to the interlock state,
When executing the OUT instruction in the user program, the arithmetic unit determines whether or not the interlock area including the OUT instruction is in an interlock state, and in the case of the interlock state, the set interlock process Industrial controller equipment characterized by having a function to execute
JP2008021333A 2008-01-31 2008-01-31 Industrial controller equipment Active JP4993208B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008021333A JP4993208B2 (en) 2008-01-31 2008-01-31 Industrial controller equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008021333A JP4993208B2 (en) 2008-01-31 2008-01-31 Industrial controller equipment

Publications (2)

Publication Number Publication Date
JP2009181443A true JP2009181443A (en) 2009-08-13
JP4993208B2 JP4993208B2 (en) 2012-08-08

Family

ID=41035360

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008021333A Active JP4993208B2 (en) 2008-01-31 2008-01-31 Industrial controller equipment

Country Status (1)

Country Link
JP (1) JP4993208B2 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012124542A1 (en) 2011-03-15 2012-09-20 オムロン株式会社 Control device and system program
WO2012124198A1 (en) 2011-03-15 2012-09-20 オムロン株式会社 Control device and system program, and recording medium
WO2012124197A1 (en) 2011-03-15 2012-09-20 オムロン株式会社 Control device, system program, and storage medium
WO2014207825A1 (en) * 2013-06-25 2014-12-31 三菱電機株式会社 Programmable controller
US9377769B2 (en) 2011-03-15 2016-06-28 Omron Corporation Control apparatus for updating a user program while processing is being performed and recording medium
WO2019082627A1 (en) 2017-10-24 2019-05-02 オムロン株式会社 Control device, control method for control device, information processing program, and recording medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11143504A (en) * 1997-11-07 1999-05-28 Denso Corp Programmable controller
JP2007086831A (en) * 2005-09-16 2007-04-05 Omron Corp Development support device, program for creating outline information, and method for creating outline information
JP2008059421A (en) * 2006-09-01 2008-03-13 Yokogawa Electric Corp Sequence program editing support device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11143504A (en) * 1997-11-07 1999-05-28 Denso Corp Programmable controller
JP2007086831A (en) * 2005-09-16 2007-04-05 Omron Corp Development support device, program for creating outline information, and method for creating outline information
JP2008059421A (en) * 2006-09-01 2008-03-13 Yokogawa Electric Corp Sequence program editing support device

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9377769B2 (en) 2011-03-15 2016-06-28 Omron Corporation Control apparatus for updating a user program while processing is being performed and recording medium
WO2012124198A1 (en) 2011-03-15 2012-09-20 オムロン株式会社 Control device and system program, and recording medium
WO2012124197A1 (en) 2011-03-15 2012-09-20 オムロン株式会社 Control device, system program, and storage medium
JP2012194683A (en) * 2011-03-15 2012-10-11 Omron Corp Control device and system program
CN103403634A (en) * 2011-03-15 2013-11-20 欧姆龙株式会社 Control device and system program
US10025281B2 (en) 2011-03-15 2018-07-17 Omron Corporation Control device and system program, and recording medium
US9778630B2 (en) 2011-03-15 2017-10-03 Omron Corporation Control device and system program for maintaining global variable and reference data consistency during parallel processing of multiple tasks
CN103403634B (en) * 2011-03-15 2016-08-10 欧姆龙株式会社 Control device and control method thereof
WO2012124542A1 (en) 2011-03-15 2012-09-20 オムロン株式会社 Control device and system program
KR20160018796A (en) 2013-06-25 2016-02-17 미쓰비시덴키 가부시키가이샤 Programmable controller
CN105339854A (en) * 2013-06-25 2016-02-17 三菱电机株式会社 Programmable controller
JP5661953B1 (en) * 2013-06-25 2015-01-28 三菱電機株式会社 Programmable controller
US9811486B2 (en) 2013-06-25 2017-11-07 Mitsubishi Electric Corporation Programmable controller
WO2014207825A1 (en) * 2013-06-25 2014-12-31 三菱電機株式会社 Programmable controller
WO2019082627A1 (en) 2017-10-24 2019-05-02 オムロン株式会社 Control device, control method for control device, information processing program, and recording medium
US11287793B2 (en) 2017-10-24 2022-03-29 Omron Corporation Control device, control method for control device, information processing program, and recording medium

Also Published As

Publication number Publication date
JP4993208B2 (en) 2012-08-08

Similar Documents

Publication Publication Date Title
JP4993208B2 (en) Industrial controller equipment
EP3256915B1 (en) Extending a programmable logic controller with apps
CN107924171B (en) Slave device, control method for slave device, and recording medium
EP2682830B9 (en) Control device and system program, and recording medium
JP5747584B2 (en) Control device and system program
WO2017154273A1 (en) Master-slave control system, method for controlling master-slave control system, information processing program, and recording medium
JP7000686B2 (en) Control device
JP2015176191A (en) controller
JP3754369B2 (en) Automation device and update method
JP2014146070A (en) Control device, control method, and program
CN111095138B (en) Control device, control method for control device, information processing program, and recording medium
US20130081054A1 (en) Method for Enabling Sequential, Non-Blocking Processing of Statements in Concurrent Tasks in a Control Device
US20220402121A1 (en) Control and monitoring of a machine arrangement
JPH09128255A (en) Programable logic controller
CN116909678A (en) Implementation method and system of containerized PLC and management server
CN113867271B (en) Production system, upper control device, communication method, and storage medium
JP5365875B2 (en) Industrial controller
JP2010079355A (en) Cooperative control system between a plurality of plcs
JP2009048632A (en) Method for conveying telegram between control device and peripheral element via intermediate device
JP2017068663A (en) Programmable controller
JP6812726B2 (en) Control unit, data refresh method, data refresh program
CN113168149A (en) Expansion device for an automation device
JP2007241570A (en) Setting system of shared memory for communication between programmable controller
JP6645223B2 (en) Control system and control device
JP2007128413A (en) Programmable controller

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20101105

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20111118

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20111124

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111212

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20120412

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120425

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20150518

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 4993208

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250