JP4123660B2 - Programmable controller - Google Patents
Programmable controller Download PDFInfo
- Publication number
- JP4123660B2 JP4123660B2 JP33552599A JP33552599A JP4123660B2 JP 4123660 B2 JP4123660 B2 JP 4123660B2 JP 33552599 A JP33552599 A JP 33552599A JP 33552599 A JP33552599 A JP 33552599A JP 4123660 B2 JP4123660 B2 JP 4123660B2
- Authority
- JP
- Japan
- Prior art keywords
- output
- data
- module
- cpu
- shared mask
- 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.)
- Expired - Lifetime
Links
Images
Description
【0001】
【発明の属する技術分野】
本発明は、プログラマブルコントローラに関し、更に詳しくはプログラマブルコントローラにおけるデータ出力の共有及び競合制御に関する。
【0002】
【従来の技術】
図16で示すようなシリアルリンクバス等のバス101に複数のCPUモジュール102やDO(出力)モジュール103及びDI(入力)モジュール104を接続したマルチCPU構成のプログラマブルコントローラが知られている。
【0003】
この様なプログラマブルコントローラにおいて、複数のCPUモジュール102−1〜102−mが一つのDOモジュール103の出力点を共有して出力を行う場合、この出力点を共有している各CPUモジュール102は、DOモジュール103の出力状態が現在ON(=“1”)状態なのかOFF(=“0”)状態なのかを知ることができない。例えば図16において、CPU102−1がDOモジュール103−1の一つの出力点の出力状態をOFFにしても他のCPUモジュール102−2〜102−mはこのことを知ることが出来ない。このことは、例えば共有するDOモジュール103−1を緊急停止信号として使用する場合、何れかのCPUモジュール102−1がこのDOモジュール103−1に緊急停止信号をセットし、これを他のCPUモジュール102−2〜102−mが認識して、しかるべき処理を行った後に緊急停止信号をリセットするようなアプリケーション等において、緊急停止信号をセットしたCPUモジュール102−1が、その後この緊急停止信号に対して他のCPUモジュール102−2〜102−mが何等かの対処処理を行って緊急停止状態が回避されたかどうかを知ることが出来ず、問題となる。
【0004】
この為DOモジュール103の出力のモニタ用に図17のごとくDIモジュール106を別に追加して、このDIモジュール106にDOモジュール103の出力を折り返し入力する構成としていた。そしてDOモジュール103−1に“0”を出力したCPUモジュール102−1が他のCPUモジュール102−2〜102−mによって出力が“1”にされたかどうか等、各CPUモジュール102−1〜102−mは、現在のDOモジュール103−1の出力状態を知るためには、このDIモジュール106の出力を参照していた。
【0005】
図17はDIモジュール106によるDOモジュール103の出力の折り返し入力の例である。図17において、バス101上の局アドレスとして局番0が設定されているDOモジュール103−1の各出力点105からの出力は局番1が設定されているDIモジュール106の入力点107へ折り返し入力されている。DOモジュール103−1を共有している各CPUモジュール102上のタスクは、DOモジュール103−1へデータを出力する時は局番0のDOモジュールをアドレス指定して出力し、またDOモジュール103−1の出力状態を得たい時は局番1のDIモジュールをアドレス指定してDIモジュール106からのデータを得る。
【0006】
図18に図17の構成での各モジュール及びバス上での出力データの様子を示す。
プログラマブルコントローラでのデータの転送は、シリアルリンクバス1での転送速度と同一速度の一定間隔の周期で行われる。またCPUモジュール102内の演算実行部へは、このデータ転送と同一周期で割込みが入力される。この周期をタクト周期といい図18中縦の点線で示してある。各モジュールはこのタクト周期に同期して処理を行う。
【0007】
CPUモジュール102の演算実行部201で行われる演算処理によって生じたDOモジュール103への出力データは、CPUモジュール102内のI/O領域の対応するアドレス領域へ格納される。するとこのデータは出力バッファを介してバス101上にフレームデータとして送信出力される。
【0008】
このフレームを受信した局番0のDOモジュール103はこの受信データに基づいて各出力点の出力状態を変更する。またこのDOモジュール103の出力は局番1のDIモジュール106に折り返し入力されているので、このDIモジュール106によってDOモジュール103の出力状態はバス101上にフレームデータとして送信出力され、これは各CPUモジュール102のI/O領域の局番1に対応するアドレス領域に格納される。
【0009】
図19にCPUモジュールの入出力処理の為の機能ブロック図を示す。
CPUモジュール102内には、データの入出力制御を行うための構成要素として演算実行部201、I/O領域202、出力バッファ203、入力バッファ204、シリアルリンク制御部205、出力データ転送テーブル206及び入力データ転送テーブル207を備える。
【0010】
シリアルリンク制御部205は、バス101から送信されてきたフレームのうち自局に必要なデータを入力バッファ204に取込むと共に下流局のモジュールに流す。入力バッファ204に取込まれたデータは、タスク起動時にそのタスクに対応する入力データ転送テーブル207を参照してそのタスクが必要とするデータをI/O領域202に転送する。
【0011】
I/O領域202は自局で実行されている複数のアプリケーションプログラムの各タスクが直接アクセスすることが出来るメモリ領域で、プログラム処理を行う演算実行部201は、このI/O領域202内から自己が必要とするデータを読み出す。
【0012】
また演算実行部201はDOモジュールへデータ出力する時は、I/O領域202の対応するアドレス領域へ出力データを書込む。そしてタスク処理がすると、出力処理時に、出力データ転送テーブル206に基づいてI/O領域202から出力バッファ203へそのタスクに割り当てられたデータのみが転送される。そしてシリアルリンク制御部205は、これをフレームデータとしてバス101に出力する。
【0013】
【発明が解決しようとする課題】
図17の様にDOモジュール103−1の出力をDIモジュール106で折り返す構成にした場合、この為用に別にDIモジュールを追加しなければならない。
【0014】
また各CPUモジュール102で実行されているアプリケーションプログラムは、DOモジュール103−1の出力状態を知るのに、そのDOモジュール103−1の局アドレスとは別なアドレスを用いなければならない。よってアプリケーションプログラミングに処理の煩雑さを強いることになる。
【0015】
また、各CPUモジュール102では、I/O領域202上に、DOモジュール103−1の出力モニタ用のDIモジュール106の局アドレスを設定しなければならない。プログラマブルコントローラでは、I/O領域202のサイズ、即ち接続できるモジュールの総数は限定されているので、DOモジュール103−1の出力状態のモニタのためにDIモジュール106を用いると、1つのDOモジュールの為に2つのアドレスを用いてしまうこととなり、資源利用効率が悪い。
【0016】
またCPUモジュール102では、バス101からのデータの入力処理において、入力データ転送テーブル207に従って入力バッファ204からI/O領域202へ入力データのコピーを行い、また出力処理では出力データ転送テーブル206に従ってI/O領域202から出力バッファ203への出力データのコピーを行っている。よって出力データ転送テーブル206中の局番0のDOモジュール103−1に設定されている出力データの転送元アドレスと入力データ転送テーブル207中の局番1のDIモジュール106に設定されている入力データ転送先アドレスを同じにすることにより、I/O領域202のDOモジュール103−1への出力先と同じアドレス領域にDIモジュール106を経由したDOモジュール103−1の出力状態を入力させることができる。しかしDOモジュール103−1への入力データと出力データに対してI/O領域202の同じアドレス領域を割り当てた場合、図20に示す不具合がある。
【0017】
図20は、出力データ転送テーブル中206のDOモジュールへの出力データの転送元アドレスと入力データ転送テーブル中207のDIモジュールからの入力データの転送先アドレスを同じにした場合の各モジュール及びバス上での入出力の状態を示すタイミング図である。
【0018】
図20のタクト周期Aにおいて、演算実行部201がI/O領域202にDOモジュール103への出力データとしてOUT2を出力したとする。しかし次のタクト周期Bでは、このOUT2の出力による折り返し出力がI/O領域202に転送される前に、1つ前の出力状態であるOUT1が入ってくる。もしOUT2がCPUモジュールが緊急停止信号として出力した“1”で、またOUT1が“0”であったとき、次のタクト周期BでDOモジュールの出力状態を得ようとしてI/O領域202を参照すると、OUT1(“0”)となってるので、アプリケーションプログラムは、DOモジュールの出力が他のCPUによって“0”にリセットされたものと誤認識する。
【0019】
また一般にマルチCPU構成のプログラマブルコントローラにおいては、各CPUで担当するリソースを完全に分け機能分散した構成の場合では、入出力の共有・競合は起こらないが、本来1つのCPUでシステム制御するところを、プログラム容量の増大への対処、並列処理による処理性能の向上などの理由でマルチCPUを採用する場合1つの入出力モジュールを複数のCPUで共有することとなる。そしてこの場合、1台の入出力モジュールに対して、複数のCPUが書込み処理を行う競合書込みを行う場合がある。その場合のプログラムの開発では、ユーザは、競合制御を意識してプログラムソースを作成、変更するようなわずらわしさが有る。また、競合書込みが行われると複数のCPUモジュールのプログラムで、同じ出力モジュールの同一アドレスに対する書込みが行われることとなるが、このアドレス重複が競合書込みによるものなのか、プログラム作業の誤り等によるものかチェックが容易に出来ることが要求される。
【0020】
本発明は、上記問題点を鑑み、複数のCPUモジュールがDOモジュールを共有している場合、そのDOモジュールの出力をモニタするDIモジュールを設けることなしに、各CPUモジュールが共有したDOモジュールの出力状態を知ることが可能なプログラマブルコントローラ及びアプリケーションプログラム開発装置を提供することを課題とする。
【0021】
【課題を解決するための手段】
本発明によるプログラマブルコントローラは、複数のCPUモジュールと少なくとも1つの出力モジュールを備えることを前提とする。
【0022】
上記各CPUモジュールは、共有マスク生成手段及び出力データ送信手段を備える。
共有マスク生成手段は、出力モジュールに対して出力状態を変更するかどうかを指示する共有マスクを生成する。
【0023】
出力データ送信手段と、上記出力モジュールに対する出力データを上記共有マスクと共に送信する。
また上記出力モジュールは、出力データ受信手段と共有及び競合制御手段を備える。
【0024】
出力データ受信手段は、上記CPUモジュールからの上記出力データを上記共有マスクと共に受信する。
共有及び競合制御手段は、CPUモジュールからの、例えば自己を共有する複数のCPUモジュールからの上記出力データと共有マスクから出力状態を決定する。
【0025】
また上記出力モジュールは、上記出力状態を示す参照出力を上記自己を共有する複数のCPUモジュールへ送信する参照出力送信手段を備え、上記CPUモジュールは、上記共有マスク生成手段が生成した共有マスクを記憶する共有マスク記憶手段と、該共有マスク記憶手段に記憶されている共有マスクと出力モジュールからの上記参照出力から該出力モジュールの出力状態を示す参照データを生成する出力状態参照データ生成手段とを更に備える構成としても良い。
【0026】
更に上記出力データ送信手段が、上記出力データを送信する出力モジュールで該出力データに対し他のCPUモジュールからの出力データとの共有及び競合制御を行う必要が無い時、該出力データの送信時、上記共有マスクを該出力データを送信しない構成としてもよい。この場合例えばCPUモジュールに、上記共有マスクを上記出力データと共に送信したか否かを通知するデータ転送モード制御ビットを生成するデータ転送モード制御ビット生成手段を更に備え、上記出力データ送信手段が、該データ転送モード制御ビットを上記出力データと共に送信し、受信側の出力モジュールの上記共有及び競合制御手段は、該データ転送モード制御ビットが上記共有マスクが上記出力データと共に送信されていないことを示す時、該出力データのみから出力状態を決定する構成となる。
【0027】
また、本発明によるプログラマブルコントローラのアプリケーションプログラム開発装置は、プログラム参照手段及び競合書込み命令生成手段を備える。
プログラム参照手段は、マルチCPU構成のプログラマブルコントローラを構成する全てのCPUモジュールのプログラムを参照する。
【0028】
競合書込み命令生成手段は、上記参照結果、上記プログラムに複数のCPUモジュールが同じ出力モジュールの同じ出力点への出力を示す命令を含む場合、該命令を競合書込み用の命令に変換する。またこのアプリケーションプログラム開発装置は、上記競合書込み用の命令に変換する部分をユーザに通知するワーニング通知手段を備える。
【0029】
本発明によれば、各CPUモジュールは、出力モジュールに対して出力データと共に共有マスクを送信し、出力モジュールではこの共有マスクの内容に基づいて出力の共有及び競合制御を行う。
【0030】
また各CPUモジュールは、出力状態参照データ生成手段によって、出力モジュールの参照出力送信手段が送信した参照出力と共有マスク記憶手段が記憶する共有マスクから参照データを生成するので、この参照データから出力モジュールの出力状態を知ることが出来る。
【0031】
更に参照データは出力モジュールからの参照出力と共有マスク記憶手段が記憶する共有マスクから生成されるので、CPUモジュールでは、出力モジュールへの出力情報と上記参照データを同一アドレス領域に格納することが出来る。
【0032】
また、共有及び競合制御を必要としない時には、CPUモジュールが上記共有マスクを出力データと共に出力モジュールに送信しない構成とすれば、トラフィク量を少なくすることが出来る。
【0033】
また本発明によるアプリケーションプログラム開発装置によれば、ユーザが意識しなくても競合書込みとなる書込み命令は、競合書込み命令に変換される。また競合書込み命令に変換される部分は、ユーザに通知される。
【0034】
【発明の実施の形態】
図1は本実施形態におけるプログラマブルコントローラの概略を示す図である。本実施形態でのプログラマブルコントローラは、CPUモジュール2−1〜2−3の3つのCPUモジュールが1つのDOモジュール3を共有しているものとする。
【0035】
DOモジュール3は、シリアルリンクバス1を介して各CPUモジュール2から送信されてきた出力データを受信すると、共有及び競合制御回路10により、その受信データに基づいて出力点からの出力状態を変化させると共に、参照出力として各CPUモジュール2に現在の出力状態を示すデータを送信する。
【0036】
尚本実施形態では、CPUモジュール2とDOモジュール3との間でのデータ転送は、本発明の出願人による特願平10−148648号に開示されているトータルフレーム方式及びマルチキャスト方式によって行われるものとする。
【0037】
図2はトータルフレーム方式によるデータ通信の説明図である。
本実施形態では、シリアルリンクバス1の局の内の1つをリングマスター局とし、このリングマスター局によってトータルフレーム方式及び後述するマルチキャスト方式によるデータ転送を管理する。図2ではシリアルリンクバス1に、リングマスター局、A局、B局、C局、D局の順に接続されていたとする。
【0038】
トータルフレーム方式では、ネットワーク上に唯一存在するリングマスター局により、まずトータルフレーム送信の要求を表すREQフレームが送信される。図2ではこの時のREQフレームはreq0と表されている。
【0039】
このREQフレームには、フレームのデミリタ部(スタートデミリタ(SD)部)にこのフレームがREQフレームであることを示すデータが設定されており、このフレームの受信局はSD部を調べることによりこのフレームがREQフレームであることを認識する。
【0040】
REQフレームを受信した局は、そのフレーム最後に自局のデータを付加して隣の下流局へ送信する。図2の場合、A局はREQフレームを受信すると、その末尾に自己の出力データDaを付加して下流局のB局へ送信する。B局ではこのフレームを受信すると、その末尾に自己の出力データDbを付加して出力する。以下、順に各局はフレームを受取ると自己のデータをフレームの末尾に付加して下流局へ送信する。尚、本実施形態は複数のCPUモジュール2を使用するマルチCPUの構成であり、CPUモジュール2が他のCPUモジュール2がDOモジュールに出力したデータを参照できるようにするため、DOモジュールも自己のデータの出力を行っている。しかし、CPUモジュールを1つしか持たないプログラマブルコントローラの構成の場合には、この様な必要はない。
【0041】
REQフレームがシリアルリンクバス1を1巡して、これをリングマスター局が受信すると、リングマスター局はこのフレームのスタートデミリタ(SD)部に設定されているデータを2巡目のREQフレームであることを示すデータを設定変更し、またフレームの最後に自己のデータを付加して隣の下流局であるA局へ送信する。
【0042】
このフレームを受信したA局は、受信フレームのSD部を調べ、これが2巡目のREQフレームであることを認識すると、フレームのSD部の次にある1巡目の時に自己が付加した自局データを削除して下流局へ中継する。図2の場合、A局は2巡目のREQフレームを受信すると、1巡目で自己が付加した自局のデータDaを削除して下流局のB局へ送信し、B局は受信フレームのSD部の次にある自己の出力データDbを削除して次の下流局であるC局へ送信する。以下、順に各局はフレームを受取ると1巡目で付加した自己のデータをフレームから削除して下流局へ送信する。
【0043】
この2巡回目のREQフレームがシリアルリンクバス1を巡回して、リングマスター局に戻ってくると、リングマスター局は、このフレームをシリアルリンクバス1から除去する。これによってトータルフレーム通信は完了する。
【0044】
次にマルチキャスト方式によるデータ転送について説明する。
マルチキャスト方式は、CPUモジュール2からDOモジュール3に対してデータの出力を行う時用いられるデータ転送方式である。
【0045】
マルチキャスト方式は、シリアルリンクバス1上にマルチキャスト通信用のフリートークンを巡回させ、データ伝送を要求する局(DOモジュールに出力するための送信データが用意されており、また当該送信帯域の送信許可設定がされている局)はそのフリートークンを確保して代わりにマルチキャストフレームの送信を行う。マルチキャストフレームはシリアルリンクバス1上を巡回し、このマルチキャストフレームを受信したネットワーク上の局は、それを下流へ中継して巡回させると共にフレーム内の出力データの設定内容に基づいてデータの取込みを行う。
【0046】
図3は、マルチキャスト方式による通信の説明図である。
マルチキャスト方式による通信では、まず、シリアルリンクバス1上に1つだけ存在するネットワーク管理を行うリングマスター局が、データ転送の権限を制御するフリートークンを生成し、シリアルリンクバス1上にリリースする。このフリートークンのリリースによって、マルチキャスト通信は開始される。
【0047】
リリースされたフリートークンは、各局が順次下流局へ中継してゆき、シリアルリンクバス1上を巡回する。そしてデータの出力を行いたいCPUモジュール2は、このフリートークンを受信すると、これをシリアルリンクバス1から確保し、マスター局となる。
【0048】
マスター局は、用意してある送信データを、SD部にこのフレームがマルチキャスト通信のフレームであることを示すデータを設定したマルチキャストフレームとしてシリアルリンクバス1上に流す。図3では、マスター局は、保持したフリートークンの代わりにA局に対する出力データ(M→Da)とB局に対する出力データ(M→Db)の2つの局に対する出力データがマルチキャストフレームとして、下流局Bへ送信される。
【0049】
このマルチキャストフレームを受取った局は、そのフレーム内の出力データに設定されている出力データの格納先の局番を参照し、この出力データが自局に対するものであれば、それを取込むと共にそのフレームをそのまま下流局へ送信する。図3では、マルチキャストフレームを受信したA局及びB局はそれぞれ自局にあててマスタ局が出力した出力データ(M→Da、M→Db)を取込むと共に、その受信フレームをそのまま隣の下流局であるリングマスター局及びマスター局へ送信する。
【0050】
フレームが1巡すると、そのフレームを最初に送信したマスタ局は、これをシリアルリンクバス1から除去し、代わりにフリートークンを生成してシリアルリンクバス1上にリリースする。
【0051】
そしてフリートークンがシリアルリンクバス1を1巡して戻ってくると、リングマスター局はデータ伝送要求の有無をチェックし、要求があれば当該送信データ[A局に対する出力データ(RM→Da),B局に対する出力データ(RM→Db)]の送信を行う。その後、自局が送信したデータフレームがシリアルリンクを1巡して自局に戻ってきたことでリングマスター局はフリートークンをシリアルリンク上から除去し、これによってマルチキャスト通信は終了する。
【0052】
以下DOモジュール3からCPUモジュール2へデータを送信するときのデータ転送は、トータルフレーム方式により行う。またCPUモジュール2からDOモジュール3へデータを出力するときのデータ転送は、マルチキャスト方式により行う。尚本発明では、各モジュール間でのデータ転送はこのトータルフレーム方式とマルチキャスト方式のみに限定されるものではない。また上記トータルフレーム方式及びマルチキャスト方式によるデータ転送は、各モジュールがリング型の伝送トポロジーのバスで接続されていることを前提とするが、本発明が適用されるプログラマブルコントローラにおいて各モジュールを接続するバスはリング型のトポロジーをもつシリアルバスに限定されるものではなく、モジュール間を他のトポロジーやパラレルバスで接続する構成でも良い。
【0053】
図4にDOモジュール3の共有及び競合制御回路10を詳細に示す。
同図中最下段はシリアルリンクバス1上を伝送されるフレームを示し、1タクト周期中にDOモジュール3から各CPUモジュール2−1〜2−3に対するトータルフレーム方式によるフレームに続いてCPUモジュール2−1、2−2及び2−3からのマルチキャスト方式によるフレームが続く。尚同図中「メッセージ」はCPUモジュール2間やCPUモジュール2と通信モジュールなどとの間で行われるメッセージ転送用の時間帯域を示している。
【0054】
各CPUモジュール2−1〜2−3は、DOモジュール3に対する出力データと共に共有マスクを送信フレーム内に格納して、マルチキャスト方式でDOモジュール3に送信する。この共有マスクは各CPUモジュール2がDOモジュール3に対して出力状態の変更を行うかどうかを出力点毎に指定するもので、各CPUモジュール2はDOモジュール3の複数の出力点のうち、出力状態を変更したい出力点に対応する共有マスクのビットに“1”を、変更を行わない出力点に対応するビットに“0”を設定し、出力データと共にDOモジュールに送信する。
【0055】
DOモジュール3では、マルチキャスト方式のフレームを自己を共有している各CPUモジュール2−1〜2−3全てから受信すると、フレーム中の共有マスクデータ11及び出力データ12と、参照出力ラッチ16内の自己の現在の出力状態との論理結果から新出力を求める。
【0056】
DOモジュール3では、CPUモジュール2からのフレームから共有マスク11と出力データ12を取り出すと、これらを各CPUモジュール2毎にAND回路13によってAND値を取る。また各共有マスク11−1〜11−3の反転値と参照出力ラッチ16の出力のAND値をAND回路14によって求める。
【0057】
そして各AND回路13−1〜13−3の出力とAND回路14の出力のOR値をOR回路15によって求め、これをその出力点の新出力とする。またOR回路15の出力は参照出力ラッチ16に格納されて次出力の決定に用いられると共に、トータルフレーム方式でシリアルリンクバス上に出力されて、各CPUモジュール2−1〜2−3に出力状態を通知する。これにより例えば全てのCPUモジュール2からの共有マスクデータ11−1〜11−3が“0”だったビットに対応する出力点は、前回の出力状態の保持となる。また複数のCPUモジュール2からの共有マスクデータ11が“1”であり、その出力データ12として“1”と“0”の両方ある場合には“1”が優先され、対応する出力点からは“1”が出力される。
【0058】
図5はCPUモジュール2の入出力処理の為の構成要素を示す機能ブロック図である。
CPUモジュール2内には、データの入出力制御を行うための構成要素として演算実行部21、I/O領域22、出力バッファ23、入力バッファ24、シリアルリンク制御部25、出力データ転送テーブル26、入力データ転送テーブル27及び共有マスクデータ領域28を備える。
【0059】
プログラム処理を行う演算実行部21は、演算結果からDOモジュールへデータ出力する必要が生じた時は、I/O領域22のそのDOモジュールに対応するアドレス領域へ出力データを書込む。この出力データは、タスク処理すると出力処理時に、出力データ転送テーブル26に基づいて、I/O領域22から出力バッファ23へそのタスクに割り当てられたデータのみ転送され、シリアルリンク制御部25は、これをフレームデータとしてシリアルリンクバス1に出力する。
【0060】
I/O領域22は、自局で実行されている複数のアプリケーションプログラムの各タスクが直接アクセスすることが出来るメモリ領域で、CPUモジュールの内部メモリ上に構成される。演算実行部21は、自己が必要とする他モジュールからのデータを、このI/O領域22内の対応するアドレス領域から読み出し、また他モジュールへ出力する時は、対応するアドレス領域に出力データを書込む。各CPUモジュール2では、自己が対応している入力モジュールや出力モジュールを、出力データ転送テーブル26及び入力データ転送テーブル27でこのI/O領域22中の各アドレス領域に1:1で対応付けてある。よって、例えばI/O領域22が0HからFFHまでのアドレスをもつ場合、このCPUモジュール2は256の入出力モジュールとデータのやり取りを行うことが出来る。また各アドレス領域の各ビットの位置は、各入出力モジュールの入出力点に1:1対応しており、例えば1ワードが8ビットの場合、1つのアドレス領域で8つの入出力点に対応したデータのやり取りを行える。
【0061】
出力バッファ23は、出力データを出力先の局番、データのサイズ及び共有マスクと共に、出力する局毎に蓄積するバッファである。タスク処理が終了すると、出力処理時に、そのタスク処理で生じた出力データは出力データ転送テーブル26に基づいてI/O領域22から出力バッファ23へ転送される。そして出力バッファ23内のデータは、シリアルリンク制御部25により、演算実行部21による処理とは無関係にタクト周期でシリアルリンクバス1上に出力される。この様な一連の動作により、シリアルリンクバス1に接続された各モジュールは、一定周期(タクト周期)中は共通のデータを用いて動作することが可能となる。
【0062】
入力バッファ24は、上流局から流れてきたデータのうち、自局で必要なものを取込むバッファである。シリアルリンクバス1から受信したデータは、シリアルリンクバス1の転送周期と同一周期のタクト周期で、シリアルリンク制御部25から入力バッファ24に格納される。そして、タスク起動時にそのタスクに対応する入力データ転送テーブル27が参照されてそのタスクが必要とするデータが入力バッファ24からI/O領域22に転送される。
【0063】
シリアルリンク制御部25は、シリアルリンクバス1から送信されてきたフレームを自己の受信バッファに取込み、それが自局に対するものでなければそのまま下流局に送り、また自局に対するものあればそれを入力バッファ24に取込むと共に下流局のモジュールに流す。これによってシリアルリンクバス1上をフレームデータが一定方向に巡回する。またマルチキャスト用のトークンを受信するとシリアルリンク制御部25は、出力バッファ23内のデータをマルチキャストフレームとして、シリアルリンクバス1上にDMA転送する。
【0064】
出力データ転送テーブル26は、出力先となるモジュールのバス1上での局アドレスとI/O領域22のアドレスとを対応付けるものである。出力データ転送テーブル26は、タスク毎に存在し、そのタスク処理によって演算実行部21が、DOモジュールに出力する出力データをI/O領域22から出力バッファ23へ転送する際に参照される。1つのタスク処理が終了すると演算実行部21は、出力処理時に、出力データ転送テーブル26を参照し、I/O領域22から出力バッファ23へそのタスクに割り当てられたデータのみ転送する。
【0065】
入力データ転送テーブル27は、入力相手先となるモジュールのバス上での局アドレスとI/O領域22のアドレスとを対応付けるもので、入力バッファ24からI/O領域22へのデータの転送を行う際に参照されるものである。入力データ転送テーブル27は、各タスク毎に複数存在し、そのタスクが使用するデータの入力バッファ24でのアドレス、I/O領域22のアドレス及びデータサイズが格納されている。タスクが起動される際に、入力バッファ24からI/O領域22へのデータの転送を行うときには、そのタスクに対応した入力データ転送テーブル27を使用してそのタスクが起動される前に入力バッファ24からI/O領域22にそのタスクが使用するデータのみが転送される。
【0066】
共有マスクデータ領域28は、I/O領域22と同じ構成をもつ記憶領域で、CPUモジュールの内部メモリ上に構成される。演算実行部21はこの共有マスクデータ領域28中に共有マスクを生成する。そしてこの共有マスクは、I/O領域22中の同じアドレスの出力データと共に出力バッファ23へ転送され、対応するDOモジュール3へ送信される。
【0067】
この共有マスクは、DOモジュールへ送信後も共有マスクデータ領域28内に保持される。そして、DOモジュール3からの自己の出力状態を通知する参照出力を受信した時、そのDOモジュールに対応するアドレス領域内の共有マスクに基づいて入力バッファ24からI/O領域22への転送を行う。またこのI/O領域22への転送入力処理が完了すると、対応する共有マスクは“0”にリセットされる。この点については後述する。
【0068】
図6はCPUモジュールで作られる共有マスクの例を示す図である。
演算実行部21はタスク処理の結果からDOモジュールの出力状態を変更する必要が生じた時、出力データと共に共有マスクデータ領域28に共有マスクデータを生成する。この共有マスクデータは、各ビットがDOモジュールの出力点と1:1対応した複数ビットのマスクデータで、DOモジュールの各出力点のうち出力状態を変更する出力点に対応するビットに“1”、変更しない出力点に対応するビットに“0”が設定してある。
【0069】
図6の共有マスクは8ビット構成の例で、この共有マスクのデータによって8つの出力点についての共有及び競合制御を行う。図6ではタスク処理による演算結果から、DOモジュールに出力する出力データはビット0が“1”から“0”に、またビット4が“0”から“1”に変化しているため、共有マスクデータは出力状態に変更があるビット0とビット4に“1”、他の変更がないビットに“0”がセットされたものが生成され、共有マスクデータ領域28に格納される。
【0070】
またCPUモジュール2では、DOモジュール3からトータルフレームによる参照出力を受信すると、これを入力バッファ24に格納した後、入力データ参照テーブル27に基づいてI/O領域22の対応するアドレス領域へ転送するが、この時全てのデータがI/O領域22に転送されるわけではなく、I/O領域22と同じアドレス領域の共有マスク領域28内の共有マスクを参照して、ビット毎に転送を行うかどうかを決定して、排他的にデータ転送を行う。
【0071】
共有マスクに“1”がセットされているビットの参照出力は、図6のビット0やビット4の様に自己がDOモジュールに出力の変更を指示した出力点の出力状態を示すものだが、今回の受信データはまだこの変更は反映されていないものである。よってこれをそのまま現在のDOモジュールの出力状態として入力バッファ24からI/O領域22へ転送すると図20で示したような問題を生じる。よって共有マスクに“1”がセットされているビットの参照出力の転送は行わずに出力データの値をそのままDOモジュールの出力状態を示す値として残し、“0”がセットされているビットの参照出力のみ入力バッファ24からI/O領域22へ転送する。
【0072】
そしてI/O領域22への出力状態を示すデータの転送処理完了後、共有マスク領域28内の対応アドレス領域の共有マスクを“0”にリセットし、次の出力データの生成に備える。
【0073】
尚共有マスク領域28内の共有マスクのリセットは、I/O領域22への参照データの書き換え時に随時行っても良いし、またタスク処理による演算を行う前にI/O領域22内のデータをコピーしておいたものと、演算後のI/O領域22内のデータとを全アドレス領域に対して比較を行い、まとめて全ての共有マスクを生成する構成としても良い。
【0074】
図7はCPUモジュール2からDOモジュール3に、出力データを送信するためにシリアルリンクバス1上に送出されるマルチキャストフレームの構成例である。
【0075】
各CPUモジュール2は出力データを送信するDOモジュール3宛てのマルチキャストフレームを送出する。マルチキャスト方式は、1タクト周期で複数のモジュールに対してデータを送信することが出来、1フレーム中に複数のDOモジュールへのデータを含めることが出来る。
【0076】
図7では、マルチキャストフレームには、複数のDOモジュールに対する出力データが含まれており、この出力データは出力相手局を示す局番、データのサイズ及びマスク情報と共に各DOモジュール毎に格納されている。
【0077】
DOモジュール3は、マルチキャストフレームを受信すると、受信フレーム内の各出力データに対し付されている局番と自己の局番情報を比較してゆき、一致するものがあれば対応する出力データを入力バッファに取込む。
【0078】
図8はCPU0とCPU1の2つのCPUモジュールがDOモジュールを共有している場合の各モジュール及びバス上での入出力状態の例を示すタイミング図である。同図は、CPU0がDOモジュールの1つの出力点を“1”にセットし、これを認識したCPU1がこれを“0”にリセットする例である。尚同図及び以下の説明は説明簡略化の為、DOモジュールの1つの出力点について、つまり1ビットのデータの入出力について記載されている。
【0079】
図8において、まずタクト周期Aでタスク処理による演算結果から、CPU0が共有しているDOモジュールの1つの出力点に対し、出力状態を“0”から“1”へ変更する必要が生じたとする。演算実行部21は、I/O領域22のそのDOモジュール及び出力点に対応するアドレス領域に出力データとして“1”をセットし、また共有マスク領域28のI/O領域22のアドレスと同じアドレス領域に対応ビットを“1”にセットした共有マスクを生成し、格納する。
【0080】
この出力データと共有マスクはマルチキャストフレーム32−1としてDOモジュールに送信される。DOモジュールではCPU0及びCPU0からの出力データ及び共有マスクに基づいて、タクト周期Bで、DOモジュールは出力状態を変更する。この場合CPU0の共有マスクは“1”、CPU1の共有マスクは“0”なので出力状態はCPU0からの出力データが反映され、出力点の出力状態は“0”から“1”になる。
【0081】
またこの間にDOモジュールからは、自己の出力状態を通知する参照出力がトータルフレーム31−1によってCPU0及びCPU1に通知される。このトータルフレーム31−1による参照出力は、マルチキャストフレーム32−1によるCPU0からの出力データが反映されていないものなので、これをDOモジュールの出力状態としてCPU0のI/O領域22に転送すると、CPU0は自己がセットした出力“1”がCPU1によって“0”にリセットされたと誤判断してしまう。しかし、CPU0では共有マスク領域28に記憶されている共有マスクが“1”となっているので、このトータルフレーム31−1による参照出力はI/O領域に転送されず出力状態を示す参照データはタクト周期Aでセットされた“1”のままとなる。これによりCPU0でタクト周期Bの演算処理で演算実行部21がI/O領域22からDOモジュールの出力状態を示す参照データを読み出しても、タクト周期Aでセットした出力が他のCPUモジュールによってリセットされていると誤認識することはない。
【0082】
トータルフレームによるデータのI/O領域22への入力処理が完了すると、共有マスク領域28内の同じアドレス領域内の共有マスクは“0”にクリアされる。これにより、演算処理によって新たにDOモジュールの出力状態を変更する必要が生じて、共有マスクが生成されるまでの間はトータルフレームによるDOモジュールからの参照出力は参照データとしてそのままI/O領域22に入力される。図8では、CPU0は、トータルフレーム31−2、31−3、31−4の参照出力はそのままI/O領域22にDOモジュールの出力状態を示す参照データとして入力される。
【0083】
またCPU1では、DOモジュールからのトータルフレーム31−1及び31−2による参照出力は、そのままI/O領域22へ参照データとして入力される。CPU1はタクト周期Cで、DOモジュールの出力状態が“0”から“1”変化があったのを知ると、出力状態を“1”から“0”へリセットするようにDOモジュールへ指示する出力データを生成してI/O領域へ格納し、また対応ビットが“1”となる共有マスクを生成して共有マスク領域へ格納する。これらは、マルチキャストフレーム32−3としてDOモジュールに通知される。DOモジュールでは、マルチキャストフレーム32−3内の共有マスクがCPU0からのものは“0”、CPU1からのものは“1”なので、CPU1からの出力データ“0”を反映させて出力状態を“1”から“0”に変更する。またこの変更された出力状態は参照出力として、トータルフレーム31−4によってCPU0及びCPU1に通知される。
【0084】
この様に本実施形態によるプログラマブルコントローラでは、DOモジュールでは、出力データと共に送信されるCPUモジュールからの共有マスクによって、各CPUモジュールからの出力の競合制御を行うことが出来る。
【0085】
またCPUモジュールでは、DOモジュールから参照出力を受信すると、共有マスク領域内の対応する共有マスクを参照してI/O領域への転送を行うので、DOモジュールへの出力データと参照データを同一アドレスに設定しても問題を生じない。
次に本発明の第2の実施形態について説明する。
【0086】
これまでのプログラマブルコントローラでは、他のCPUモジュールと共有しており競合制御の必要のあるDOモジュールだけでなく、共有していないDOモジュールに対しても、CPUモジュールは常に共有マスクデータを含む大きさのフレームをシリアルリンクバス1上に流すので、シリアルリンクバス1上の伝送効率は低下してしまう。
【0087】
第2の実施形態のプログラマブルコントローラはこの点を考慮したもので、送信先が競合制御を必要とするか否かによって、送信フレームを変更する構成を備えている。
【0088】
図9は、本発明の第2の実施形態でのマルチキャストフレームの構成例を示す図で、図7の第1の実施形態のフレーム構成図に対応するものである。
第2の実施形態によるフレーム構成では、フレーム内にデータ転送モード制御ビットを設けてある。同図の場合フレームの先頭部分である送信先を示す入出力モジュールの局番部分の上位のリザーブビットをデータ転送モード制御ビットに用いている。尚このデータ転送モード制御ビットは、同図の位置に限らず、特定の位置であればフレーム内の他の位置に設けたり、独立して設けることも可能である。
【0089】
このデータ転送モード制御ビットは、共有マスクによるデータ転送制御を行うか否かを示すビットで、データ転送時に共有及び競合制御を行う場合にはこのビットに“1”を、共有及び競合制御を行う必要が無い場合にはこのビットに“0”を設定したフレームを送信する。
【0090】
図9中(1)は、送信先のDOモジュールで共有及び競合制御を行わない場合のフレーム構成を示すもので、フレーム先頭部のデータ転送モード制御ビットに“0”がセットされ、またこのフレーム内には共有マスクデータは含まれておらず、局番、サイズ、出力データで構成される。また同図(2)は、共有及び競合制御を行う場合のフレーム構成を示すもので、データ転送モード制御ビットに“1”がセットされ、また図7の第1の実施形態でのフレーム構成と同様、出力データと共に共有マスクデータを持つ構成となっている。
【0091】
データ送信を行うCPUモジュールは、送信先が共有されているか否か、競合制御を必要としているかどうかによってこれら2つのフレームを使い分け、他のCPUと共有している出力モジュールに出力データを送信する場合は、図9(2)に示したような構成のフレームを用い、他のCPUと共有していない出力モジュールに出力データを送信する際は、同図(1)に示したような構成のフレームを用いる。この様にフレームを使い分けることにより、他のCPUとデータ出力の共有及び競合制御を行う必要が無い場合は、余分な共有マスクデータをフレーム内に含まなくなるので、その分トラヒック量は減り、シリアルリンクバス1上のデータ転送効率は良くなる。
【0092】
図10は、第2実施形態におけるDOモジュール側の出力データを決定する共有及び競合制御回路40の詳細を示す図である。図10は、第1の実施形態の図4の構成に対応するもので、同一の構成要素には同じ番号が符されている。
【0093】
図10の共有及び競合制御回路40は、図4の構成を基本に共有マスク有効モード記憶レジスタ41、新規受信有り記憶レジスタ42、NOT回路43及びOR回路44が各CPUモジュール毎に加えられ、またAND回路は3入力のAND回路に変更されている。このうち共有マスク有効モード記憶レジスタ41は、受信したマルチキャストフレーム中のデータ転送モード制御ビットの値がセットされるもので、この値により共有及び競合制御回路40は、共有及び競合制御を行う共有マスク有りモードと共有及び競合制御を行わない共有マスク無しモードを切替える。また新規受信有り記憶レジスタ42は、新規のマルチキャストフレームを受信したことを示すレジスタで、新規にマルチキャストフレームをCPUモジュールから受信するとそのCPUモジュールに対応する新規受信有り記憶レジスタ42に“1”にセットされる。そしてOR回路15の出力がDO出力点から出力され、また参照出力ラッチ16にラッチされると“0”にリセットされる。
【0094】
共有マスク有効モード記憶レジスタ41の値は、NOT回路43により反転された後OR回路44により共有マスクデータ11とのOR値が取られる。よってOR回路44からは、共有マスク有効モード記憶レジスタ41に“0”がセットされている時は“1”が、“1”がセットされている時は共有マスクデータ11の値が出力されて、AND回路45により出力データ12及び新規受信有り記憶レジスタ42内の値とAND値が取られる。例えば図9(1)の様な競合制御を行わない場合のフレームを受信すると、対応する共有マスク有効モード記憶レジスタ41には“0”がセットされる。また新規に受信したマルチキャストフレームが無い間は、各新規受信有り記憶レジスタ42−1〜42−3の値は“0”にリセットされたままなので、各AND回路45−1〜45−3の出力は“0”となり、DO出力点からの出力は、参照出力ラッチ16にラッチされている値がAND回路14及びOR回路15を介して出力され続ける。
【0095】
次に各CPUモジュールが、共有マスクデータを持たないフレーム(図9(1)のフレーム)と持つフレーム(図9(2)のフレーム)のどちらを用いるかを決定する共有マスクモジュールモード決定の仕方について説明する。
【0096】
図11は、共有マスクモード決定論理を示す図で、同図(a)は、複数のCPUモジュールにより出力点の共有及び競合がある場合すなわち共有マスク有りモードを示し、同図(b)は共有及び競合が無い場合すなわち共有マスクデータ無モードの例を示す。同図(a)はCPU0〜2の3つのCPUモジュールが出力モジュールDO0及びDO1にデータを送信する際、データ共有を行う場合に共有マスク有りのモードの決定を例としたもので、16点の出力点を持つ1つのDOモジュールに対する16ビットの共有マスクデータをCPUの使用ビットとして示している。
【0097】
図11(a)の出力モジュールDO0の場合、ビット0がCPU1とCPU2、ビット10がCPU0とCPU2、ビット13がCPU1とCPU2、及びビット15がCPU0とCPU1で共有マスクに“1”が設定され、これらに対応するDO0の出力点が競合されていることが分る。よってCPUモジュールCPU0、CPU1及びCPU2は出力モジュールDO0にデータを送信し出力点の出力状態の変更を行う時は、共有有りモードとして図9(2)に示した様な共有マスクデータを含むフレームをマルチキャストフレームとして送信する。
【0098】
また同図(a)において出力モジュールDO1の場合は、同一ワードにおいて、CPU0がビット13,14,15を使用し、CPU1がビット10,11,12を使用し、CPU2がビット0,1,2を使用しており、3台のCPUで共有されている。そして各CPUモジュールは出力モジュールDO1にデータを送信する時は、共有マスク有りモードとして、CPU使用ビットに対応する共有マスクデータを出力データと共に送出する。
【0099】
また同図(b)のDO2の場合、CPU0のみがDO2の全ビットを使用しており、CPU1とCPU2はDO2を一切使用していない。すなわちDO2はCPU0のみの制御下の出力モジュールであり、CPU0は共有無しモードとして図9(1)に示したような共有マスクデータを含まないフレームをマルチキャストフレームとして出力モジュールDO2に送信する。
【0100】
図12は、第2の実施形態でのCPUモジュールによる共有マスクデータの制御例を示す図である。同図は図11の出力条件で、CPU0がDO0の出力制御を行う場合の共有マスクの制御動作を例として示したものである。
【0101】
CPUモジュールCPU0では、出力モジュールDO0に対して、図12に示すように固定共有マスクレジスタ51及び出力条件共有マスクレジスタ52をOR回路53の入力に、その出力をシリアルリンク出力共有マスクレジスタ54に接続して備えている。固定共有マスクレジスタ51は、CPUモジュールで動作するOSによって操作されるもので、他のCPUモジュールと競合せずにCPU0のみが用いる出力点に対応するビットに“1”がセットされる。この固定共有マスクレジスタ51の値は、そのDOモジュールの出力点の共有状態の変更が無ければ、固定的にセットされたままである。出力条件共有マスクレジスタ52は、CPUモジュールがDOモジュールに出力変更を行う出力点を設定するレジスタで、出力条件が整った出力点に対応するビットに“1”が出力条件判定部55によってセットされる。シリアルリンク出力共有マスクレジスタ54は、マルチキャストフレームに格納して送信する共有マスクデータを格納するレジスタである。
【0102】
CPU0がDO0を出力制御する場合の共有マスクデータ生成の制御動作処理を以下に示す。
▲1▼CPU0は、DO0のビット1、2を他のCPUモジュールと競合せずに使用するため、予めOS処理によってDO0用の固定共有マスクレジスタのビット1及び2に“1”をセットしておく。
▲2▼CPU0は、競合出力点に対する出力条件判定を行い、出力条件が成立した場合出力条件判定部55がDO0出力条件成立共有マスクレジスタ52の対応ビットに“1”をセットする。同図の場合、ビット15に対応する出力点で出力条件が成立したのでビット15に“1”をセットする。
▲3▼DO0用の固定共有マスクレジスタ51と出力条件成立共有マスクレジスタ52の値のOR値を取り、結果をDO0用のシリアルリンク出力共有マスクレジスタ54にセットする。この場合ビット1,2,15に“1”がセットされた値がシリアルリンク出力共有マスクレジスタ54にセットされる。そしてこのシリアルリンク出力共有マスクレジスタ54内のデータは、共有マスクデータとしてマルチキャストフレームにより出力データと共にDO0に送信される。DO0では図10に示した共有及び競合制御回路40により、共有及び競合制御として共有マスクデータからビット1、2、15に対応する出力点の出力をCPU0からの出力データに基づいて変更する。尚ビット10に対応する出力点もCPU0は出力制御を行っているが、今回は出力条件が成立しなかったため、出力は前回値のまま保持される。
【0103】
ところで一般に、マルチCPUシステムのプログラマブルコントローラにおいては、各CPUで担当するリソースを完全に分け機能分散した構成の場合では、入出力の共有・競合は起こらないが、本来1つのCPUでシステム制御するところを、プログラム容量の増大への対処、並列処理による処理性能の向上などの理由でマルチCPUを採用する場合入出力モジュールを複数のCPUで共有することとなる。そしてこの場合、1台の入出力モジュールに対して、複数のCPUが書込み処理を行う競合WT(書込み)を行う場合がある。その場合のプログラム開発においてユーザは、競合制御を意識してプログラムソースを作成、変更するようなわずらわしさが有ってはならない。また、競合WTが行われると複数のCPUのプログラムで、同じDOモジュールの同一アドレスに対する書込みが行われることとなるが、このアドレス重複が競合書込みによるものなのか、プログラム作業の誤り等によるものかチェックが容易に出来ることが要求される。
【0104】
これに対応するため本発明では、複数のCPUで共有されている出力点への書込みに対し、競合制御を行う競合WT命令を持ち、またユーザはこの競合WT命令を意識して用いなくても、アプリケーションプログラム開発装置(以下ローダという)が自動的に競合WT命令を生成する機構を備える。
【0105】
図13に基本的な競合WT命令例を示す。同図ではユーザ記述プログラム例として、基本的なWT命令のラダー表示、それをコーディングした通常命令表示であるS(セット)、R(リセット)、W(ライト)及びそれぞれに対応する競合WT命令KS(競合セット)、KR(競合リセット)、KW(競合ライト)を示している。
【0106】
各WT命令の基本動作を以下に示す。
となる。
【0107】
図14にローダによる競合WT命令生成処理例を示す。
図14(a)に示すように、ローダは、ローダ処理として各CPUモジュールの実行オブジェクトを生成するに際し、マルチCPUシステムを構成する全てのCPUモジュール(同図ではCPU0、CPU1、CPU2)のソースプログラムを参照し、異なるCPUによって同じ入出力モジュールの同一出力点への出力、即ち同じ出力アドレスへの書込みが行われいる部分を調べる。そして、同じアドレスに対し複数のCPUが書込みを行っている箇所を検出すると、そのCPUのソースプログラム中のWT命令を図13に示したような競合WT命令に変換された後、実行オブジェクトを生成する。
【0108】
図14(b)の場合、CPU0とCPU1のプログラム中、出力モジュールDO0のビット15に対しての書込みが競合しているため、ローダはCPU0とCPU1のソースプログラム中のビット15に対するWT命令を競合WT命令(KW)に置換えている。尚、CPU0のDO0ビット2に対する書込みとCPU1のDO0のビット10に対する書込みは他のCPUと競合していないので、通常のWT命令(W)のままとなっている。
【0109】
また、同一アドレスへの書込みは、その出力点を複数のCPUモジュールが競合使用しているために発生する場合と、プログラミング作業の誤り等によるユーザの認識外の要因によって発生した場合が考えられる。よって、後者の要因によるものを排除するために、ローダは上記競合WT命令への置換を行う前にユーザに対してアドレスの重複を警告する競合WTのワーニング通知を行う。
【0110】
図15はローダによる競合WTのワーニング通知例を示す図である。
このワーニング通知の方法としては、同図(a)に示すように、ソースプログラムレベルで表示し、競合が発生した出力命令部分を他の表示部分と表示色を替えたり、あるいは点滅表示したりして強調する方法がある。同図の場合、通常表示部分が白色で表示されているのに対し、競合が発生した書込み命令部分を赤色で表示してユーザに通知している。
【0111】
またワーニング通知の別方法としては、同図(b)に示すように競合制御箇所をプログラムの行番号と命令種類をリスト形式で示す方法がある。
ユーザは、これらのワーニング通知からプログラムの誤りを検出することが出来る。以上の説明で、出力モジュールとしてデジタル出力モジュール(DOモジュール)を例として説明したが、アナログ出力モジュール(AOモジュール)においても、共有及び競合制御の考え方は全く同じであり、ただ共有マスクデータが出力データ、例えば1ワードに対して1ビットで対応することで実現することが出来る。例えば4ワードAOモジュールにおいて、1ワード目はCPU0が使用し、2ワード目はCPU1が使用し、3、4ワード目はCPU2が使用する場合は、共有が行われ共有マスク有りモードとなり、4ワードデータに対して4ビットの共有マスクデータで制御されることとなる。また出力モジュールにおける共有及び競合制御回路は、単純なAND及びOR回路でなくセレクタ及び中間値データ生成及び平均値データ生成回路などで実現することも出来る。
【0112】
【発明の効果】
本発明に基づくプログラマブルコントローラによれば、出力モジュールの出力状態をCPUモジュールに知らせるために、新たに入力モジュールを設ける必要が無い。
【0113】
また、出力モジュールでは各CPUモジュールから出力データと共に送信されてくる共有マスクによって各CPUモジュールによる出力データの共有及び競合制御を行うことが出来る。
【0114】
更にCPUモジュールでは、CPUモジュールが出力モジュールの出力状態を誤認識する等の問題を生じることが無く、出力モジュールに対する出力データと参照出力に対して同じアドレスを設定することが出来る。よって、出力モジュールにデータを出力する時も、出力状態を参照する時も同じアドレスを用いることが出来るので、プログラミングに混乱を招かない。これはアプリケーションプログラミングに拠るデータの入出力処理を簡易化することが出来、プログラムの簡略化や処理速度の向上を実現できる。
【0115】
また共有及び競合制御を必要としない出力データの場合には出力データと共に共有マスクを出力モジュールに送信しない構成とした場合には、単一CPUシステムと同様の通信負荷となり、システム性能を向上することが出来る。すなわち、単一CPUシステムにおいても、本発明は上記共有マスク無しモードでそのまま使用可能である。
【0116】
更にマルチCPUのプログラマブルコントローラのプログラム開発に於て、ユーザは、競合制御を行う場合でも、通常の入出力モジュールへの書込み命令を記述すれば、ローダが複数のCPUのプログラムを参照して自動的に競合制御専用の命令に変換する。またこの変換部分は、ユーザに通知されるので、ユーザは競合を意識してアドレスを重複させてたのか、誤ってアドレスを重複させたのかを容易に確認でき、マルチプロセッサシステムにおけるプログラミング開発効率及びプログラムの品質を向上することが出来る。
【図面の簡単な説明】
【図1】本実施形態におけるDOモジュールの概略を示す図である。
【図2】トータルフレーム方式による通信の説明図である。
【図3】マルチキャスト方式による通信の説明図である。
【図4】DOモジュールの競合制御回路を詳細に示す図である。
【図5】CPUモジュールの入出力処理の為の構成要素を示す機能ブロック図である。
【図6】CPUモジュールで作られる共有マスクの例を示す図である。
【図7】マルチキャストフレームの構成例を示す図である。
【図8】2つのCPUモジュールがDOモジュールを共有している場合の各モジュール及びバス上での入出力の状態例を示すタイミング図である。
【図9】第2の実施形態でのマルチキャストフレームの構成例を示す図である。
【図10】第2実施形態における競合制御回路を詳細に示す図である。
【図11】各CPUモジュールで行われる共有マスクモード決定論理を示す図である。
【図12】第2の実施形態でのCPUモジュールによる共有マスクデータの制御例を示す図である。
【図13】基本的な競合WT(書込み)命令例を示す図である。
【図14】ローダによる競合WT命令生成処理例を示す図である。
【図15】競合WTのワーニング通知例を示す図である。
【図16】バスに複数のCPUモジュールやDIモジュール及びDOモジュールを接続したマルチCPU構成のプログラマブルコントローラを示す図である。
【図17】DIモジュールによるDOモジュールの出力の折り返し入力の例を示す図である。
【図18】各モジュール及びバス上での出力データの様子を示すタイミング図である。
【図19】従来のCPUモジュールの入出力処理の為の機能ブロック図である。
【図20】DOモジュールへの出力データの転送元アドレスとDIモジュールからの入力データの転送先アドレスを同じにした場合の各モジュール及びバス上での入出力の状態を示すタイミング図である。
【符号の説明】
1、101 シリアルリンクバス
2、102 CPUモジュール
3、103 DOモジュール
10、40 共有及び競合制御回路
11 共有マスク
12 出力データ
13、14、45 AND回路
15、44、53 OR回路
16 参照出力ラッチ
21 演算実行部
22 I/O領域
23 出力バッファ
24 入力バッファ
25 シリアルリンク制御部
26 入力バッファ転送テーブル
27 入力データ転送テーブル
28 共有マスクデータ領域
41 共有マスク有効モード記憶レジスタ
42 新規受信有り記憶レジスタ
43 NOT回路
51 固定共有マスクレジスタ
52 出力条件共有マスクレジスタ
54 シリアルリンク出力共有マスクレジスタ[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a programmable controller, and more particularly to data output sharing and contention control in a programmable controller.
[0002]
[Prior art]
A programmable controller having a multi-CPU configuration in which a plurality of
[0003]
In such a programmable controller, when a plurality of CPU modules 102-1 to 102-m share an output point of one
[0004]
For this reason, the
[0005]
FIG. 17 shows an example of the return input of the output of the
[0006]
FIG. 18 shows the state of output data on each module and bus in the configuration of FIG.
Data transfer in the programmable controller is performed at a constant interval cycle at the same speed as the transfer speed in the
[0007]
Output data to the
[0008]
The
[0009]
FIG. 19 shows a functional block diagram for input / output processing of the CPU module.
In the
[0010]
The serial
[0011]
The I /
[0012]
Further, when the
[0013]
[Problems to be solved by the invention]
When the output of the DO module 103-1 is turned back by the
[0014]
Further, the application program executed by each
[0015]
In each
[0016]
Further, the
[0017]
FIG. 20 shows each module and bus when the transfer source address of output data to the
[0018]
Assume that the
[0019]
In general, in a programmable controller having a multi-CPU configuration, in the case of a configuration in which resources assigned to each CPU are completely divided and functions are distributed, input / output sharing and contention do not occur, but the system control is originally performed by one CPU. When a multi-CPU is employed for reasons such as dealing with an increase in program capacity and improving processing performance by parallel processing, one input / output module is shared by a plurality of CPUs. In this case, competitive writing in which a plurality of CPUs perform writing processing may be performed on one input / output module. In the program development in that case, the user has the trouble of creating and changing the program source in consideration of the competition control. In addition, when competing writing is performed, a program of a plurality of CPU modules will write to the same address of the same output module. Whether this address duplication is due to competing writing or due to an error in program work, etc. It is required that it can be easily checked.
[0020]
In the present invention, in view of the above problems, when a plurality of CPU modules share a DO module, the output of the DO module shared by each CPU module is provided without providing a DI module for monitoring the output of the DO module. It is an object of the present invention to provide a programmable controller and an application program development device capable of knowing the state.
[0021]
[Means for Solving the Problems]
The programmable controller according to the present invention is premised on including a plurality of CPU modules and at least one output module.
[0022]
Each of the CPU modules includes a shared mask generation unit and an output data transmission unit.
The shared mask generation means generates a shared mask that instructs the output module whether to change the output state.
[0023]
Output data for the output data transmitting means and the output module are transmitted together with the shared mask.
The output module includes output data receiving means and sharing and contention control means.
[0024]
The output data receiving means receives the output data from the CPU module together with the shared mask.
The sharing and contention control means determines an output state from the output data from the CPU module, for example, a plurality of CPU modules sharing the same, and the sharing mask.
[0025]
The output module further includes reference output transmission means for transmitting a reference output indicating the output state to the plurality of CPU modules sharing the self, and the CPU module stores the shared mask generated by the shared mask generating means. And a shared mask storage means for generating, and an output state reference data generating means for generating reference data indicating an output state of the output module from the shared mask stored in the shared mask storage means and the reference output from the output module. It is good also as a structure provided.
[0026]
Further, when the output data transmitting means does not need to perform sharing control and competition control with the output data from other CPU modules for the output data in the output module for transmitting the output data, when transmitting the output data, The shared mask may be configured not to transmit the output data. In this case, for example, the CPU module further includes data transfer mode control bit generating means for generating a data transfer mode control bit for notifying whether or not the shared mask is transmitted together with the output data, and the output data transmitting means includes the output data transmitting means. A data transfer mode control bit is transmitted with the output data, and the sharing and contention control means of the receiving output module indicates that the data transfer mode control bit indicates that the shared mask is not transmitted with the output data. The output state is determined only from the output data.
[0027]
An application program development device for a programmable controller according to the present invention comprises program reference means and contention write instruction generation means.
The program reference means refers to the programs of all the CPU modules constituting the programmable controller having a multi-CPU configuration.
[0028]
If the plurality of CPU modules include an instruction indicating output to the same output point of the same output module in the program as a result of the reference, the contention write instruction generation unit converts the instruction into an instruction for competitive writing. The application program development device further includes warning notification means for notifying the user of the portion to be converted into the contention write instruction.
[0029]
According to the present invention, each CPU module transmits a sharing mask together with output data to the output module, and the output module performs output sharing and contention control based on the contents of the sharing mask.
[0030]
Each CPU module generates reference data from the reference output transmitted by the reference output transmission unit of the output module and the shared mask stored in the shared mask storage unit by the output state reference data generation unit. You can know the output status.
[0031]
Further, since the reference data is generated from the reference output from the output module and the shared mask stored in the shared mask storage means, the CPU module can store the output information to the output module and the reference data in the same address area. .
[0032]
Further, when sharing and contention control are not required, the traffic volume can be reduced if the CPU module does not transmit the sharing mask to the output module together with the output data.
[0033]
Also, according to the application program development apparatus of the present invention, a write command that becomes a competitive write without being conscious of the user is converted into a competitive write command. Further, the user is notified of the part that is converted into the competitive write instruction.
[0034]
DETAILED DESCRIPTION OF THE INVENTION
FIG. 1 is a diagram showing an outline of a programmable controller in the present embodiment. In the programmable controller in the present embodiment, it is assumed that the three CPU modules 2-1 to 2-3 share one
[0035]
When the
[0036]
In this embodiment, data transfer between the
[0037]
FIG. 2 is an explanatory diagram of data communication by the total frame method.
In this embodiment, one of the stations of the
[0038]
In the total frame method, a REQ frame representing a total frame transmission request is first transmitted by a ring master station that exists only on the network. In FIG. 2, the REQ frame at this time is represented as req0.
[0039]
In this REQ frame, data indicating that this frame is a REQ frame is set in a delimiter portion (start delimiter (SD) portion) of the frame, and the receiving station of this frame checks this frame by examining the SD portion. Is a REQ frame.
[0040]
The station that has received the REQ frame adds its own data to the end of the frame and transmits it to the adjacent downstream station. In the case of FIG. 2, when the A station receives the REQ frame, it adds its own output data Da to the end thereof and transmits it to the B station of the downstream station. When station B receives this frame, it adds its output data Db to its end and outputs it. Thereafter, each station sequentially receives its frame and adds its own data to the end of the frame and transmits it to the downstream station. In this embodiment, a multi-CPU configuration using a plurality of
[0041]
When the REQ frame makes a round on the
[0042]
Upon receiving this frame, the station A checks the SD part of the received frame and recognizes that this is the second round REQ frame. Delete data and relay to downstream station. In the case of FIG. 2, when the station A receives the second REQ frame, the station A deletes its own data Da added by itself in the first round and transmits it to the station B of the downstream station. It deletes its own output data Db next to the SD part and transmits it to the next downstream station C. Thereafter, each station sequentially receives the frame and deletes its own data added in the first round from the frame and transmits it to the downstream station.
[0043]
When the second REQ frame circulates through the
[0044]
Next, data transfer by the multicast method will be described.
The multicast method is a data transfer method used when data is output from the
[0045]
In the multicast method, a free token for multicast communication is circulated on the
[0046]
FIG. 3 is an explanatory diagram of communication by the multicast method.
In communication by the multicast method, first, a ring master station that performs network management, which exists only on the
[0047]
The released free token is sequentially relayed to the downstream station by each station and circulates on the
[0048]
The master station sends the prepared transmission data on the
[0049]
The station that has received this multicast frame refers to the station number of the output data storage destination set in the output data in that frame, and if this output data is for its own station, takes it in and Is transmitted to the downstream station as it is. In FIG. 3, the A station and B station that have received the multicast frame take the output data (M → Da, M → Db) output to the own station and output from the master station, and receive the received frame as it is downstream. Transmit to the ring master station and the master station.
[0050]
When the frame has made one round, the master station that first transmitted the frame removes it from the
[0051]
When the free token returns once through the
[0052]
Hereinafter, data transfer when data is transmitted from the
[0053]
FIG. 4 shows the sharing and
In the figure, the lowermost stage shows a frame transmitted on the
[0054]
Each CPU module 2-1 to 2-3 stores the shared mask together with the output data for the
[0055]
When the
[0056]
In the
[0057]
Then, an OR value of the outputs of the AND circuits 13-1 to 13-3 and the output of the AND
[0058]
FIG. 5 is a functional block diagram showing components for input / output processing of the
In the
[0059]
When it becomes necessary to output data from the calculation result to the DO module, the
[0060]
The I / O area 22 is a memory area that can be directly accessed by each task of a plurality of application programs executed in the own station, and is configured on the internal memory of the CPU module. The
[0061]
The output buffer 23 is a buffer for accumulating output data for each station to be output, together with an output destination station number, data size, and shared mask. When the task processing is completed, output data generated by the task processing is transferred from the I / O area 22 to the output buffer 23 based on the output data transfer table 26 during the output processing. The data in the output buffer 23 is output on the
[0062]
The input buffer 24 is a buffer for taking in data necessary for the own station from data flowing from the upstream station. The data received from the
[0063]
The serial link control unit 25 takes the frame transmitted from the
[0064]
The output data transfer table 26 associates the station address on the
[0065]
The input data transfer table 27 associates the station address on the bus of the module that is the input partner with the address of the I / O area 22, and transfers data from the input buffer 24 to the I / O area 22. It is what is referred to when. There are a plurality of input data transfer tables 27 for each task, and the address in the input buffer 24 of the data used by the task, the address of the I / O area 22 and the data size are stored. When data is transferred from the input buffer 24 to the I / O area 22 when the task is activated, the input buffer is used before the task is activated using the input data transfer table 27 corresponding to the task. Only data used by the task is transferred from 24 to the I / O area 22.
[0066]
The shared mask data area 28 is a storage area having the same configuration as the I / O area 22 and is configured on the internal memory of the CPU module. The
[0067]
This shared mask is held in the shared mask data area 28 even after being transmitted to the DO module. When a reference output for notifying its own output state from the
[0068]
FIG. 6 is a diagram showing an example of a shared mask created by the CPU module.
The
[0069]
The shared mask shown in FIG. 6 is an example of an 8-bit configuration, and sharing and contention control are performed for eight output points based on the data of the shared mask. In FIG. 6, the output data to be output to the DO module is changed from “1” to “0” and bit 4 is changed from “0” to “1”. Data is generated in which bit 0 and bit 4 whose output states are changed are set to “1”, and other bits which are not changed are set to “0” and stored in the shared mask data area 28.
[0070]
When the
[0071]
The reference output of the bit for which “1” is set in the shared mask indicates the output state of the output point where it has instructed the DO module to change the output, as in
[0072]
Then, after completion of the process of transferring the data indicating the output state to the I / O area 22, the shared mask of the corresponding address area in the shared mask area 28 is reset to “0” to prepare for the generation of the next output data.
[0073]
The reset of the shared mask in the shared mask area 28 may be performed at any time when the reference data in the I / O area 22 is rewritten, and the data in the I / O area 22 may be changed before the calculation by the task process. A configuration may be adopted in which the copied data and the data in the I / O area 22 after the operation are compared with respect to all the address areas, and all the shared masks are generated collectively.
[0074]
FIG. 7 is a configuration example of a multicast frame sent out on the
[0075]
Each
[0076]
In FIG. 7, the multicast frame includes output data for a plurality of DO modules, and this output data is stored for each DO module together with the station number indicating the output partner station, the data size, and the mask information.
[0077]
When the
[0078]
FIG. 8 is a timing diagram showing an example of an input / output state on each module and the bus when the CPU modules CPU0 and CPU1 share the DO module. This figure shows an example in which the
[0079]
In FIG. 8, it is first assumed that the output state needs to be changed from “0” to “1” for one output point of the DO module shared by the
[0080]
The output data and the shared mask are transmitted to the DO module as a multicast frame 32-1. In the DO module, the DO module changes the output state in tact cycle B based on the output data from CPU0 and CPU0 and the shared mask. In this case, since the shared mask of CPU0 is “1” and the shared mask of CPU1 is “0”, the output state reflects the output data from CPU0, and the output state of the output point changes from “0” to “1”.
[0081]
During this period, the DO module notifies the
[0082]
When the input process of data to the I / O area 22 by the total frame is completed, the shared mask in the same address area in the shared mask area 28 is cleared to “0”. As a result, it is necessary to newly change the output state of the DO module by arithmetic processing, and the reference output from the DO module in the total frame is directly used as reference data in the I / O area 22 until the shared mask is generated. Is input. In FIG. 8, the
[0083]
In the
[0084]
As described above, in the programmable controller according to the present embodiment, the DO module can perform the competition control of the output from each CPU module by the shared mask from the CPU module transmitted together with the output data.
[0085]
Further, when the CPU module receives the reference output from the DO module, it refers to the corresponding shared mask in the shared mask area and transfers it to the I / O area. Therefore, the output data to the DO module and the reference data have the same address. No problem occurs even when set to.
Next, a second embodiment of the present invention will be described.
[0086]
In the conventional programmable controller, the CPU module always includes the shared mask data not only for the DO module which is shared with other CPU modules and needs competition control but also for the DO module which is not shared. Since this frame is sent on the
[0087]
The programmable controller of the second embodiment takes this point into consideration, and has a configuration for changing the transmission frame depending on whether or not the transmission destination requires contention control.
[0088]
FIG. 9 is a diagram illustrating a configuration example of a multicast frame in the second embodiment of the present invention, and corresponds to the frame configuration diagram of the first embodiment in FIG.
In the frame configuration according to the second embodiment, a data transfer mode control bit is provided in the frame. In the case of the figure, the upper reserved bit in the station number portion of the input / output module indicating the transmission destination which is the head portion of the frame is used as the data transfer mode control bit. The data transfer mode control bit is not limited to the position shown in the figure, and can be provided at other positions in the frame or independently as long as it is a specific position.
[0089]
This data transfer mode control bit indicates whether or not to perform data transfer control using a shared mask. When sharing and contention control is performed during data transfer, this bit is set to “1”, and sharing and contention control are performed. If there is no need, a frame with this bit set to “0” is transmitted.
[0090]
(1) in FIG. 9 shows a frame configuration when sharing and contention control is not performed in the transmission destination DO module. “0” is set in the data transfer mode control bit at the head of the frame, and this frame This does not include shared mask data, and is composed of station number, size, and output data. FIG. 2B shows the frame configuration when sharing and contention control is performed. The data transfer mode control bit is set to “1”, and the frame configuration in the first embodiment of FIG. Similarly, it has a configuration having shared mask data together with output data.
[0091]
The CPU module that performs data transmission uses these two frames properly depending on whether or not the transmission destination is shared and whether or not competition control is required, and transmits output data to an output module shared with other CPUs Uses a frame configured as shown in FIG. 9 (2), and when sending output data to an output module not shared with other CPUs, the frame configured as shown in FIG. 9 (1) Is used. By using different frames in this way, when there is no need to share data and control contention with other CPUs, extra shared mask data is not included in the frame, so the traffic volume is reduced accordingly, and the serial link The data transfer efficiency on the
[0092]
FIG. 10 is a diagram showing details of the sharing and contention control circuit 40 that determines output data on the DO module side in the second embodiment. FIG. 10 corresponds to the configuration of FIG. 4 of the first embodiment, and the same components are denoted by the same reference numerals.
[0093]
The sharing and contention control circuit 40 in FIG. 10 has a shared mask valid mode storage register 41, a new reception storage register 42, a
[0094]
The value of the shared mask valid mode storage register 41 is inverted by the
[0095]
Next, how to determine a shared mask module mode in which each CPU module determines whether to use a frame without the shared mask data (frame in FIG. 9 (1)) or a frame with the shared mask data (frame in FIG. 9 (2)). Will be described.
[0096]
FIG. 11 is a diagram showing the logic for determining the shared mask mode. FIG. 11A shows a mode in which there is output point sharing and contention by a plurality of CPU modules, that is, a mode with a shared mask, and FIG. An example where there is no conflict, that is, no shared mask data mode is shown. FIG. 5A shows an example of determining a mode with a shared mask when data sharing is performed when three CPU modules CPU0 to CPU2 transmit data to the output modules DO0 and DO1. 16-bit shared mask data for one DO module having an output point is shown as a used bit of the CPU.
[0097]
In the output module DO0 of FIG. 11A,
[0098]
In the case of the output module DO1 in FIG. 4A, in the same word, CPU0 uses
[0099]
In the case of DO2 in FIG. 2B, only CPU0 uses all bits of DO2, and CPU1 and CPU2 do not use DO2. That is, DO2 is an output module under the control of only CPU0, and CPU0 transmits a frame that does not include shared mask data as shown in FIG. 9A as a multicast frame to output module DO2 as a multicast frame.
[0100]
FIG. 12 is a diagram illustrating a control example of shared mask data by the CPU module according to the second embodiment. This figure shows, as an example, the control operation of the shared mask when the
[0101]
In the CPU module CPU0, the fixed shared mask register 51 and the output condition shared mask register 52 are connected to the input of the OR circuit 53 and the output is connected to the serial link output shared mask register 54 as shown in FIG. It is prepared. The fixed shared mask register 51 is operated by the OS running on the CPU module, and “1” is set to the bit corresponding to the output point used only by the
[0102]
The control operation process for generating the shared mask data when the
(1) CPU0 uses
(2) The
(3) The OR value of the values of the fixed shared mask register 51 for DO0 and the output condition establishment shared mask register 52 is taken, and the result is set in the serial link output shared mask register 54 for DO0. In this case, a value in which “1” is set in
[0103]
In general, in a programmable controller of a multi-CPU system, in the case of a configuration in which resources assigned to each CPU are completely divided and functions are distributed, input / output sharing and contention do not occur, but the system is originally controlled by one CPU. When a multi-CPU is employed for reasons such as dealing with an increase in program capacity and improving processing performance by parallel processing, the input / output module is shared by a plurality of CPUs. In this case, contention WT (writing) in which a plurality of CPUs perform writing processing may be performed on one input / output module. In program development in that case, the user should not have the trouble of creating and changing the program source in consideration of competition control. In addition, when a conflicting WT is performed, a plurality of CPU programs will write to the same address of the same DO module. Is this address duplication due to conflicting writing or due to an error in program work, etc. It must be easy to check.
[0104]
To cope with this, the present invention has a contention WT instruction for performing contention control for writing to an output point shared by a plurality of CPUs, and the user does not need to use this contention WT instruction consciously. The application program development device (hereinafter referred to as a loader) has a mechanism for automatically generating a conflicting WT instruction.
[0105]
FIG. 13 shows a basic contention WT instruction example. In this figure, as an example of a user-written program, a basic WT instruction ladder display, S (set), R (reset), W (write), and corresponding WT instruction KS corresponding to each of them are displayed as normal instructions. (Contention set), KR (contention reset), and KW (contention write).
[0106]
The basic operation of each WT instruction is shown below.
It becomes.
[0107]
FIG. 14 shows an example of contention WT instruction generation processing by the loader.
As shown in FIG. 14A, when the loader generates an execution object of each CPU module as a loader process, the source program of all the CPU modules (CPU0, CPU1, CPU2 in the figure) constituting the multi-CPU system. Referring to FIG. 4, the part where the output to the same output point of the same input / output module by different CPUs, that is, the writing to the same output address is performed is examined. When a location where a plurality of CPUs are writing to the same address is detected, a WT instruction in the source program of the CPU is converted into a conflicting WT instruction as shown in FIG. 13, and an execution object is generated. To do.
[0108]
In the case of FIG. 14B, since writing to the
[0109]
In addition, writing to the same address may be caused by a plurality of CPU modules competingly using the output point, or may be caused by a factor outside the user's recognition due to an error in programming work or the like. Therefore, in order to eliminate the cause of the latter factor, the loader notifies the user of a conflicting WT warning that warns the address duplication before performing the replacement with the conflicting WT instruction.
[0110]
FIG. 15 is a diagram showing a warning notification example of a conflicting WT by the loader.
As a warning notification method, as shown in (a) of the figure, the output instruction part where the conflict has occurred is displayed at the source program level, the display color is changed from the other display part, or the display is blinked. There is a way to emphasize. In the case of the figure, while the normal display portion is displayed in white, the write command portion where the conflict has occurred is displayed in red to notify the user.
[0111]
As another method of warning notification, there is a method in which the contention control location is indicated in a list format and the program line number and instruction type are shown in FIG.
The user can detect a program error from these warning notifications. In the above description, the digital output module (DO module) has been described as an example of the output module. However, in the analog output module (AO module), the concept of sharing and competition control is exactly the same, and only the shared mask data is output. It can be realized by corresponding to data, for example, one word for one word. For example, in a 4-word AO module, when the first word is used by CPU0, the second word is used by CPU1, and the third and fourth words are used by CPU2, sharing is performed and a mode with shared mask is set. The data is controlled by 4-bit shared mask data. Also, the sharing and contention control circuit in the output module can be realized by a selector, intermediate value data generation and average value data generation circuit, etc., instead of a simple AND and OR circuit.
[0112]
【The invention's effect】
According to the programmable controller based on this invention, in order to notify the CPU module of the output state of an output module, it is not necessary to newly provide an input module.
[0113]
Further, in the output module, the sharing of output data by each CPU module and the competition control can be performed by the sharing mask transmitted together with the output data from each CPU module.
[0114]
Further, in the CPU module, there is no problem that the CPU module misrecognizes the output state of the output module, and the same address can be set for the output data and the reference output for the output module. Therefore, the same address can be used when outputting data to the output module and referring to the output state, so that programming is not confused. This can simplify data input / output processing based on application programming, and can simplify the program and improve the processing speed.
[0115]
In the case of output data that does not require sharing and contention control, if the configuration is such that the sharing mask is not sent to the output module together with the output data, the communication load is the same as that of a single CPU system, and the system performance is improved. I can do it. That is, even in a single CPU system, the present invention can be used as it is in the mode without the shared mask.
[0116]
Furthermore, when developing a program for a multi-CPU programmable controller, even if the user performs contention control, if the user writes a write command to a normal input / output module, the loader automatically refers to the programs of multiple CPUs. Are converted into instructions dedicated to contention control. In addition, since this conversion part is notified to the user, the user can easily confirm whether the address has been duplicated in consideration of the conflict or whether the address has been mistakenly duplicated. The quality of the program can be improved.
[Brief description of the drawings]
FIG. 1 is a diagram showing an outline of a DO module in the present embodiment.
FIG. 2 is an explanatory diagram of communication by a total frame method.
FIG. 3 is an explanatory diagram of communication by a multicast method.
FIG. 4 is a diagram showing in detail a contention control circuit of the DO module.
FIG. 5 is a functional block diagram showing components for input / output processing of a CPU module.
FIG. 6 is a diagram illustrating an example of a shared mask created by a CPU module.
FIG. 7 is a diagram illustrating a configuration example of a multicast frame.
FIG. 8 is a timing diagram showing an example of an input / output state on each module and bus when two CPU modules share a DO module.
FIG. 9 is a diagram illustrating a configuration example of a multicast frame in the second embodiment.
FIG. 10 is a diagram showing in detail a contention control circuit in the second embodiment.
FIG. 11 is a diagram illustrating shared mask mode determination logic performed in each CPU module;
FIG. 12 is a diagram illustrating an example of control of shared mask data by a CPU module according to the second embodiment.
FIG. 13 is a diagram illustrating an example of a basic contention WT (write) instruction.
FIG. 14 is a diagram showing an example of contention WT instruction generation processing by a loader.
FIG. 15 is a diagram illustrating a warning notification example of a contention WT.
FIG. 16 is a diagram showing a programmable controller having a multi-CPU configuration in which a plurality of CPU modules, DI modules, and DO modules are connected to a bus.
FIG. 17 is a diagram illustrating an example of a return input of a DO module output by a DI module;
FIG. 18 is a timing chart showing the state of output data on each module and bus.
FIG. 19 is a functional block diagram for input / output processing of a conventional CPU module.
FIG. 20 is a timing diagram showing the input / output states on each module and bus when the transfer source address of output data to the DO module is the same as the transfer destination address of input data from the DI module.
[Explanation of symbols]
1, 101 Serial link bus
2,102 CPU module
3, 103 DO module
10, 40 Sharing and contention control circuit
11 Shared mask
12 Output data
13, 14, 45 AND circuit
15, 44, 53 OR circuit
16 Reference output latch
21 Calculation execution part
22 I / O area
23 Output buffer
24 input buffers
25 Serial link controller
26 Input buffer transfer table
27 Input data transfer table
28 Shared mask data area
41 Shared mask valid mode storage register
42 Memory register with new reception
43 NOT circuit
51 Fixed shared mask register
52 Output condition sharing mask register
54 Serial link output shared mask register
Claims (14)
前記各CPUモジュールは、
出力モジュールに対して出力状態を変更するかどうかを指示する共有マスクを生成する共有マスク生成手段と、
前記出力モジュールに対する出力データを前記共有マスクと共に送信する出力データ送信手段と、
を備え、
前記出力モジュールは、
前記CPUモジュールからの前記出力データを前記共有マスクと共に受信する出力データ受信手段と、
前記出力データと共有マスクを各CPUモジュール毎にANDを取った第1のAND値を求め、また各前記共有マスクの反転値と現在の出力値とのANDを取った第2のAND値を求め、当該第1のAND値と第2のAND値のORを取ったOR値から出力状態を決定する共有及び競合制御手段と、
前記出力状態を示す参照出力を自出力モジュールを共有する複数のCPUモジュールへ送信する参照出力送信手段と、
を備えることを特徴とするプログラマブルコントローラ。In a programmable controller comprising a plurality of CPU modules and at least one output module,
Each of the CPU modules is
A shared mask generating means for generating a shared mask for instructing whether to change the output state to the output module;
Output data transmitting means for transmitting output data for the output module together with the shared mask;
With
The output module is
Output data receiving means for receiving the output data from the CPU module together with the shared mask;
A first AND value obtained by ANDing the output data and the shared mask for each CPU module is obtained, and a second AND value obtained by taking an AND of the inverted value of each shared mask and the current output value is obtained. Sharing and contention control means for determining an output state from an OR value obtained by ORing the first AND value and the second AND value ;
A reference output transmitting means for transmitting a reference output indicating the output state to a plurality of CPU modules sharing the output module;
A programmable controller comprising:
前記出力データと共有マスクを各CPUモジュール毎にANDを取った第1のAND値を求め、また各前記共有マスクの反転値と現在の出力値とのANDを取った第2のAND値を求め、当該第1のAND値と第2のAND値のORを取ったOR値から出力状態を決定する共有及び競合制御手段と、
を備えることを特徴とするプログラマブルコントローラの出力モジュール。Output data receiving means for receiving output data from the CPU module together with a shared mask for instructing whether or not to change its output state;
A first AND value obtained by ANDing the output data and the shared mask for each CPU module is obtained, and a second AND value obtained by taking an AND of the inverted value of each shared mask and the current output value is obtained. Sharing and contention control means for determining an output state from an OR value obtained by ORing the first AND value and the second AND value ;
An output module of a programmable controller, comprising:
前記各CPUモジュールが、
出力モジュールに対して出力状態を変更するかどうかを指示する共有マスクを生成し、
前記出力モジュールに対する出力データを前記共有マスクと共に送信し、
前記出力モジュールが、
前記CPUモジュールからの前記出力データを前記共有マスクと共に受信し、 前記出力データと共有マスクを各CPUモジュール毎にANDを取った第1のAND値を求め、また各前記共有マスクの反転値と現在の出力値とのANDを取った第2のAND値を求め、当該第1のAND値と第2のAND値のORを取ったOR値から出力状態を決定し、
前記出力状態を示す参照出力を自出力モジュールを共有する複数のCPUモジュールへ送信する、
ことを特徴とするプログラマブルコントローラに於けるデータ出力の共有及び競合制御方法。A data output sharing and contention control method in a programmable controller comprising a plurality of CPU modules and at least one output module,
Each of the CPU modules is
Generate a shared mask that tells the output module whether to change the output state,
Sending output data for the output module with the shared mask;
The output module is
The output data from the CPU module is received together with the shared mask , a first AND value obtained by ANDing the output data and the shared mask for each CPU module is obtained, and an inverted value of each shared mask and a current value are obtained. A second AND value obtained by ANDing the output value of the first AND value, and determining an output state from an OR value obtained by ORing the first AND value and the second AND value
Transmitting a reference output indicating the output state to a plurality of CPU modules sharing the output module;
A data output sharing and contention control method in a programmable controller.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP33552599A JP4123660B2 (en) | 1999-03-30 | 1999-11-26 | Programmable controller |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP11-90279 | 1999-03-30 | ||
JP9027999 | 1999-03-30 | ||
JP33552599A JP4123660B2 (en) | 1999-03-30 | 1999-11-26 | Programmable controller |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2000347712A JP2000347712A (en) | 2000-12-15 |
JP4123660B2 true JP4123660B2 (en) | 2008-07-23 |
Family
ID=26431777
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP33552599A Expired - Lifetime JP4123660B2 (en) | 1999-03-30 | 1999-11-26 | Programmable controller |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4123660B2 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4556809B2 (en) * | 2005-08-24 | 2010-10-06 | 横河電機株式会社 | Ladder program development support device |
WO2011007399A1 (en) * | 2009-07-17 | 2011-01-20 | 富士通テレコムネットワークス株式会社 | Snmp agent device and snmp agent control method |
EP3401742B1 (en) * | 2017-05-09 | 2020-09-02 | Siemens Aktiengesellschaft | Automation system and method for operating same |
-
1999
- 1999-11-26 JP JP33552599A patent/JP4123660B2/en not_active Expired - Lifetime
Also Published As
Publication number | Publication date |
---|---|
JP2000347712A (en) | 2000-12-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6094532A (en) | Multiprocessor distributed memory system and board and methods therefor | |
US4409656A (en) | Serial data bus communication system | |
JPH0624372B2 (en) | Method for diagnosing a first node to a second node in a local area network | |
EP0405545A2 (en) | Data communication adapter and data communication terminal apparatus employing the same | |
JPH06295336A (en) | Video display device | |
JPH1049507A (en) | Parallel computer | |
JP2011008541A (en) | Data processor, data processing method, and program | |
JP4154853B2 (en) | A redundant programmable controller and an equalization method for equalizing control data. | |
US11204799B2 (en) | Semiconductor device and systems using the same | |
JP2996440B2 (en) | Diagnosis method of data processing system | |
JPS62206658A (en) | Memory controller | |
US4958271A (en) | Transfer control equipment | |
JP4123660B2 (en) | Programmable controller | |
US5442631A (en) | Communication control device | |
JP2003271574A (en) | Data communication method for shared memory type multiprocessor system | |
JP2008146541A (en) | Dma transfer system, dma controller and dma transfer method | |
GB2409302A (en) | Data Communication Mechanism | |
JPS6054549A (en) | Data transmitting method and device | |
JPH0562384B2 (en) | ||
JP3799741B2 (en) | Bus controller | |
JP2705955B2 (en) | Parallel information processing device | |
JPH0399337A (en) | Diagnostic method for data processing unit, data processing unit and data processing system | |
JPH01157143A (en) | Network system with token passing bus system | |
JP3077992B2 (en) | Data transmission equipment | |
JPH03204254A (en) | Data receiver |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD02 | Notification of acceptance of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7422 Effective date: 20040218 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20040713 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20070104 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070410 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070611 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20080122 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20080321 |
|
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: 20080415 |
|
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: 20080428 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 4123660 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110516 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110516 Year of fee payment: 3 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313111 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110516 Year of fee payment: 3 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110516 Year of fee payment: 3 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120516 Year of fee payment: 4 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313111 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120516 Year of fee payment: 4 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120516 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130516 Year of fee payment: 5 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130516 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140516 Year of fee payment: 6 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
EXPY | Cancellation because of completion of term |