JP3791563B2 - Data exchange method and apparatus - Google Patents

Data exchange method and apparatus Download PDF

Info

Publication number
JP3791563B2
JP3791563B2 JP30842696A JP30842696A JP3791563B2 JP 3791563 B2 JP3791563 B2 JP 3791563B2 JP 30842696 A JP30842696 A JP 30842696A JP 30842696 A JP30842696 A JP 30842696A JP 3791563 B2 JP3791563 B2 JP 3791563B2
Authority
JP
Japan
Prior art keywords
communication
data
shared memory
flag
reception
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
Application number
JP30842696A
Other languages
Japanese (ja)
Other versions
JPH10150467A (en
Inventor
弘章 山田
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
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 filed Critical Omron Corp
Priority to JP30842696A priority Critical patent/JP3791563B2/en
Publication of JPH10150467A publication Critical patent/JPH10150467A/en
Application granted granted Critical
Publication of JP3791563B2 publication Critical patent/JP3791563B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Description

【0001】
【発明の属する技術分野】
この発明は、サイクリック型通信(データリンク)を用いたデータ交換方法および装置に関する。
【0002】
【従来の技術】
従来、サイクリック型通信(データリンク)を用いてデータ交換を行う通信システムとしては図10に示す構成が知られている。この図10に示す通信システムは、通信媒体40、通信コントローラ30、共有メモリ20を介してプログラマブルコントローラ10のユーザプログラム11に対する通信データの読み出し/書き込みを行うもので、共有メモリ20には、通信データバッファ21、排他フラグ22、完了フラグ23が設けられ、通信コントローラ30には複数の受信データバッファ31および送信データバッファ32が設けられている。
【0003】
図10において、通信コントローラ30は、図11のタイムチャートに示すように、プログラマブルコントローラ10のユーザプログラム11からの命令にかかわらず、通信媒体40から定期的に他局の通信データを受信し(R- A)、この受信した通信データを受信データバッファ31に格納し、また、送信データバッファ32に格納されている送信データを自局の送信タイミングに合わせて通信媒体40に送信する(W- B)。
【0004】
また、通信コントローラ30は、プログラマブルコントローラ10からの命令がない限り、受信データバッファ31に格納された受信データを共有メモリ20の通信データバッファ21にコピーし(R- B)、また、共有メモリ20の通信データバッファ21に格納されている送信データを送信データバッファ32にコピーする(W- A)。
【0005】
プログラマブルコントローラ10の通信ドライバ12は、ユーザプログラム11から読み出し命令が発行されると(R−1)、上記手順で共有メモリ20の通信データバッファ21にコピーされた受信データを通信データバッファ21から読み出し(R- 2)、これをユーザプログラム11に引き渡す(R−3)。
【0006】
ところで、共有メモリ20の通信データバッファ21から受信データを読み出し、これをプログラマブルコントローラ10のユーザプログラム11に引き渡している途中で、通信コントローラ30の受信データバッファ31に格納された受信データの共有メモリ20の通信データバッファ21に対するコピーが発生すると、プログラマブルコントローラ10のユーザプログラム11に引き渡される受信データが途中から新たな受信データに変化してしまい、この結果データの一貫性が破壊され、データの信頼性が失われる。
【0007】
そこで、図10に示した通信システムにおいてはプログラマブルコントローラ10と通信コントローラ30の間に設けられた共有メモリ20に、排他フラグ22および完了フラグ23を設け、上記共有メモリ20の通信データバッファ21からプログラマブルコントローラ10のユーザプログラム11への受信データの引き渡し処理と、通信コントローラ30の受信データバッファ31から共有メモリ20の通信データバッファ21への受信データのコピー処理の排他制御を行うように構成されている。
【0008】
図12および図13は上記排他制御をフローチャートで示したもので、図12は、プログラマブルコントローラ10の通信ドライバ12の通信処理を示し、図13は、通信コントローラ30の通信処理を示す。
【0009】
すなわち、図12において、プログラマブルコントローラ10の通信ドライバ12は、まず、共有メモリ20の排他フラグ22をONにし(ステップ101)、次に、共有メモリ20の完了フラグ23がONであるか否かを調べる(ステップ102)。
【0010】
ここで、共有メモリ20の完了フラグ23がONでない場合は(ステップ102でNO)、ステップ102に戻り、完了フラグ23がONになるまで待ち、共有メモリ20の完了フラグ23がONであると(ステップ102でYES)、共有メモリ20の通信データバッファ21からプログラマブルコントローラ10のユーザプログラム11への受信データの引き渡し処理を実行する(ステップ103)。
【0011】
そして、この共有メモリ20の通信データバッファ21からプログラマブルコントローラ10のユーザプログラム11への受信データの引き渡し処理が終了すると、共有メモリ20の排他フラグ22をOFFにし(ステップ104)、完了フラグ23をOFFにして(ステップ105)、この処理を終了する。
【0012】
また、図13において、通信コントローラ30は、まず、共有メモリ20の排他フラグ22がONであるか否かを調べ(ステップ201)、ここで、共有メモリ20の排他フラグ22がONでないと(ステップ201でNO)、通信コントローラ30の受信データバッファ31から共有メモリ20の通信データバッファ21への受信データのコピー処理を実行し(ステップ202)、続いて、共有メモリ20の通信データバッファ21から通信コントローラ30の送信データバッファ32への送信データのコピー処理を実行し(ステップ203)、ステップ201に戻る。
【0013】
また、ステップ201で、共有メモリ20の排他フラグ22がONであると判断されると(ステップ201でYES)、次に、共有メモリ20の完了フラグ23がOFFであるか否かを調べる(ステップ204)。
【0014】
ここで、共有メモリ20の完了フラグ23がOFFでないと(ステップ204でNO)、ステップ201に戻るが、共有メモリ20の完了フラグ23がOFFであると(ステップ204でYES)、次に、前回の排他処理からの間隔が1通信サイクル時間以上かを調べる(ステップ205)。
【0015】
ここで、前回の排他処理からの間隔が1通信サイクル時間以上でないと(ステップ205でNO)、ステップ202に進み、通信コントローラ30の受信データバッファ31から共有メモリ20の通信データバッファ21への受信データのコピー処理を実行し、続いて、共有メモリ20の通信データバッファ21から通信コントローラ30の送信データバッファ32への送信データのコピー処理を実行し(ステップ203)、ステップ201に戻る。
【0016】
また、ステップ205で、前回の排他処理からの間隔が1通信サイクル時間以上であると判断されると(ステップ205でYES)、共有メモリ20の完了フラグ23をONにし(ステップ206)、ステップ201に戻る。
【0017】
すなわち、通信コントローラ30側には、プログラマブルコントローラ10の通信ドライバ12側の排他処理に対して、前回の排他処理からの時間間隔を1通信サイクル以上あけるように制限を設けている。これは、プログラマブルコントローラ10の通信ドライバ12側からの排他処理が頻繁に行われると、通信コントローラ30側が共有メモリ20の通信データバッファ21を操作する時間がなくなるので、これを防ぐためである。
【0018】
【発明が解決しようとする課題】
しかしながら、上記従来のサイクリック型通信(データリンク)を用いてデータ交換を行う通信システムにおいては、
1)排他制御が通信サイクルタイムに影響するため、ユーザプログラムが1通信サイクル時間分の停止を受ける
2)このため、信頼のおける通信データの読み出し/書き込みを連続して行うユーザプログラムの性能を通信サイクルタイムよりも高速にすることはできない3)通信サイクル時間は、通信媒体に伝送されるデータ量の増大や、伝送速度の低速使用に対して比例して遅くなる特性があるので、通信媒体の使用条件によりユーザプログラムの性能が大きく変動する
という問題があった。
【0019】
そこで、この発明は、信頼のおける通信データの読み出し/書き込みを連続して行うユーザプログラムの性能に対する通信サイクルタイム時間の影響をなくすとともに、通信媒体の使用条件によるユーザプログラムの性能変動をなくしたデータ交換方法および装置を提供することを目的とする。
【0020】
【課題を解決するための手段】
上記目的を達成するために、請求項1の発明は、複数のノードを収容する通信媒体に接続された通信コントローラと端末との間に、その間でデータの交換を行う共有メモリが接続されるとともに、上記通信コントローラを介して上記通信媒体からサイクリックに受信した受信データを上記共有メモリにコピーし、該共有メモリにコピーした受信データを上記端末からの読み出し命令に対応して読み出して該端末に引き渡す、サイクリック型通信を用いたデータ交換方法であって、上記通信コントローラは、上記受信データを上記ノード単位で格納するための受信データバッファを備えるとともに、この受信データバッファに、上記通信媒体からサイクリックに受信した受信データを上記ノード単位で格納し、上記共有メモリは、上記ノード単位で受信データを格納するための通信データバッファと、上記ノード毎に設けられるとともに上記通信データバッファに上記受信データが上記ノード単位で格納されたか否かを示す受信フラグとを、備えるとともに、その通信データバッファに、上記通信コントローラの受信データバッファに格納した受信データを上記複数のノード毎にコピーし、上記端末に引き渡す新規受信データが上記共有メモリの通信データバッファに格納され上記受信フラグが受信データの格納を示している場合にのみ、その共有メモリの通信データバッファから該端末に対する受信データの引き渡しを可能にすることを特徴とする。
【0022】
また、請求項の発明は、請求項1の発明において、
上記共有メモリにコピーされた受信データを読み出して上記端末に引き渡す動作は、
上記端末に設けられたキャッシュメモリを介して行われることを特徴とする。
【0023】
また、請求項の発明は、請求項1の発明において、
上記端末は、
ユーザプログラムと通信ドライバとを有するプログラマブルコントローラからなることを特徴とする。
【0024】
また、請求項の発明は、請求項の発明において、
上記端末は、
ユーザプログラムと通信ドライバとを有するプログラマブルコントローラからなり、
上記キャッシュメモリは、
上記通信ドライバに設けられることを特徴とする。
【0025】
また、請求項の発明は、複数のノードを収容する通信媒体に接続された通信コントローラとプログラマブルコントローラとの間に、その間でデータの交換を行う共有メモリが接続されるとともに、上記通信コントローラを介して上記通信媒体からサイクリックに受信した受信データを上記共有メモリにコピーし、該共有メモリにコピーした受信データを上記プログラマブルコントローラからの読み出し命令に対応して読み出して該プログラマブルコントローラに引き渡す、サイクリック型通信を用いたデータ交換装置であって、上記通信コントローラは、上記通信媒体からサイクリックに受信した受信データを上記ノード単位で格納する受信データバッファを備え、上記共有メモリは、上記交換するデータを上記ノード単位で格納する通信データバッファと、上記通信データバッファに格納された上記交換するデータの排他処理を上記ノード単位で管理する管理手段と、を具備し、上記管理手段は、上記ノード毎に設けられるとともに上記交換するデータが上記ノード単位で上記通信データバッファに格納されたか否かを示す受信フラグを具備することを特徴とする。
【0027】
また、請求項の発明は、請求項の発明において、
上記プログラマブルコントローラは、
ユーザプログラムを格納するユーザプログラム部と、
上記共有メモリとの間で通信を行う通信ドライバと、
を具備することを特徴とする。
【0028】
また、請求項の発明は、請求項6の発明において、
上記通信ドライバは、
上記共有メモリにコピーされた受信データを一旦読み出して格納するキャッシュメモリ、
を具備することを特徴とする。
【0029】
【発明の実施の形態】
以下、この発明の実施の形態について添付図面を参照して詳細に説明する。
【0030】
図1は、この発明に係わるデータ交換方法および装置を適用して構成した通信システムの一実施の形態を概略ブロック図で示したものである。
【0031】
図1に示す通信システムは、図10に示した従来の通信システムの共有メモリ20に対して以下に示す構成を追加することにより構成することができる。
1)ノード単位の通信データバッファ21−1〜21−n
2)ノード単位の受信フラグ22−1〜22−n
3)ノード単位の排他フラグ23−1〜23−n
4)排他処理の開始を示す開始フラグ24
5)完了1を示す完了1フラグ25
6)完了2を示す完了2フラグ26
【0032】
なお、ここで、4)の開始フラグ24および5)の完了1フラグ25および6)の完了2フラグ26は、プログラマブルコントローラ10の通信ドライバ12および通信コントローラ30に対する割り込み通知から構成することもできる。
【0033】
通信コントローラ30は、図2のタイムチャートに示すように、プログラマブルコントローラ10のユーザプログラム11からの命令にかかわらず、通信媒体40から定期的に他局(他ノード)の通信データを受信し(Rx- A)、この受信した通信データを受信データバッファ(x)31に格納し、また、送信データバッファ32に格納されている送信データを自局の送信タイミングに合わせて通信媒体40に送信する(W- B)。
【0034】
また、通信コントローラ30は、プログラマブルコントローラ10からの命令がない限り、受信データバッファ31に格納された受信データを共有メモリ20の通信データバッファ21- 1〜21−nにコピーし(Rx- B)、また、共有メモリ20の通信データバッファ21- 1〜21−nに格納されている送信データを送信データバッファ32にコピーする(W- A)。
【0035】
プログラマブルコントローラ10の通信ドライバ12は、ユーザプログラム11から読み出し命令が発行されると(R−1)、上記手順で共有メモリ20の通信データバッファ21にコピーされた受信データを対応する通信データバッファ21- 1〜21−nから読み出し(Rx- 2)、これをユーザプログラム11に引き渡す(R−3)。
【0036】
ところで、この図1に示す通信システムにおいては、図2に示すように、共有メモリ20の通信データバッファ21−1〜21−nに読み出すべき新規の受信データがある場合のみ、プログラマブルコントローラ10の通信ドライバ12による共有メモリ20の通信データバッファ21−1〜21−nからの受信データの読み出しを可能にするように構成される。
【0037】
また、共有メモリ20の通信データバッファ21−1〜21−nに読み出すべき新規の受信データがない場合は、プログラマブルコントローラ10の通信ドライバ12が、プログラマブルコントローラ10のユーザプログラムに対して読み出しの結果を失敗として通知する。
【0038】
図3は、図1に示したプログラマブルコントローラ10の通信ドライバ12による特定ノードに対する受信処理をフローチャートで示したものである。
【0039】
図3において、プログラマブルコントローラ10の通信ドライバ12は、まず、共有メモリ20の特定ノード、例えば、ノード(2)に対応する受信フラグ22−2(受信フラグ2)がONであるか否かを調べる(ステップ301)。
【0040】
ここで、受信フラグ22−2(受信フラグ2)がONでない場合は(ステップ301でNO)、読み出すべき新規の受信データがないので、プログラマブルコントローラ10のユーザプログラムに対して読み出しの結果を失敗として通知する(ステップ311)。
【0041】
また、ステップ301で、受信フラグ22−2(受信フラグ2)がONであると判断されると(ステップ301でYES)、次に、この受信フラグ22−2(受信フラグ2)に対応する排他フラグ23−2(排他フラグ2)をONにし(ステップ302)、続いて、共有メモリ20の開始フラグ24をONにする(ステップ303)。
【0042】
次に、共有メモリ20の完了1フラグ25がONかを調べ(ステップ304)、ここで、共有メモリ20の完了1フラグ25がONでないと(ステップ304でNO)、ステップ304に戻り、共有メモリ20の完了1フラグ25がONになるまで待ち、共有メモリ20の完了1フラグ25がONになると(ステップ304でYES)、共有メモリ20の通信データバッファ21−2からプログラマブルコントローラ10のユーザプログラム11への受信データの引き渡し処理を実行する(ステップ305)。
【0043】
そして、この共有メモリ20の通信データバッファ21−2からプログラマブルコントローラ10のユーザプログラム11への受信データの引き渡し処理が終了すると、共有メモリ20の対応する受信フラグ22−2をOFFにし(ステップ306)、次に、対応する排他フラグ23−2をOFFにし(ステップ307)、次に、開始フラグ24をOFFにし(ステップ308)、その後、完了1フラグ25をOFFにして(ステップ309)、この処理が成功となる(ステップ310)。
【0044】
図4は、図1に示した通信コントローラ30による特定ノードに対する受信処理をフローチャートで示したものである。
【0045】
図4において、通信コントローラ30は、まず、共有メモリ20の開始フラグ24がONであるか否かを調べる(ステップ401)。
【0046】
ここで、共有メモリ20の開始フラグ24がONでないと(ステップ401でNO)、ステップ404に進み、共有メモリ20の開始フラグ24がONであると(ステップ401でYES)、次に、共有メモリ20の完了1フラグ25がOFFかを調べる(ステップ402)。
【0047】
ここで、完了1フラグ25がOFFでないと(ステップ402でNO)、ステップ404に進み、完了1フラグ25がOFFであると(ステップ402でYES)、共有メモリ20の完了1フラグ25をONにして(ステップ403)、ステップ404に進む。
【0048】
ステップ404では、通信媒体40からノード(x)に対応するノード(x)分のデータを受信する。そして、ノード(x)分のデータの受信を終了すると、次に、共有メモリ20の対応する排他フラグ23−x(排他フラグx)がOFFか否かを調べる(ステップ405)。
【0049】
ここで、排他フラグ23−x(排他フラグx)がOFFでないと(ステップ405でNO)、ステップ401に戻る。
【0050】
また、ステップ405で、排他フラグ23−x(排他フラグx)がOFFであると判断された場合は(ステップ405でYES)、通信コントローラ30の受信データバッファ31(x)から共有メモリ20の通信データバッファ21−xへの受信データのコピー処理を実行し(ステップ406)、続いて、共有メモリ20の対応する受信フラグ22−xをONにして(ステップ407)、ステップ401に戻る。
【0051】
図5は、プログラマブルコントローラ10のユーザプログラム11から自ノードデータを送信する場合における通信ドライバ12の送信処理をフローチャートで示したものである。
【0052】
図5において、プログラマブルコントローラ10の通信ドライバ12は、まず、共有メモリ20の完了2フラグ26がOFFかを調べる(ステップ501)。ここで、共有メモリ20の完了2フラグ26がOFFでない場合は(ステップ501でNO)、ステップ501に戻り、共有メモリ20の完了2フラグ26がOFFになるまで待ち、共有メモリ20の完了2フラグ26がOFFになると(ステップ501でYES)、自ノードの排他フラグをONにする(ステップ502)。
【0053】
次に、開始フラグ24をONにし(ステップ503)、そして、共有メモリ20の完了1フラグ25がONかを調べる(ステップ504)。
【0054】
ここで、共有メモリ20の完了1フラグ25がONでないと(ステップ504でNO)、ステップ504に戻り、共有メモリ20の完了1フラグ25がONになるのを待つ。
【0055】
共有メモリ20の完了1フラグ25がONになると(ステップ504でYES)、プログラマブルコントローラ10のユーザプログラム11から送信する自ノードデータを共有メモリ20の通信データバッファに書き込む処理を行う(ステップ505)。
【0056】
そして、このステップ505の処理が終了すると、共有メモリ20の自ノードの受信フラグをONにし(ステップ506)、次に、自ノードの排他フラグをOFFにし(ステップ507)、次に、完了2フラグ26をONにし(ステップ509)、最後に開始フラグ24をOFFにして(ステップ510)、この処理は成功になる(ステップ511)。
【0057】
図6は、プログラマブルコントローラ10のユーザプログラム11から自ノードデータを送信する場合における通信コントローラ30の送信処理をフローチャートで示したものである。
【0058】
図6において、通信コントローラ30は、まず、共有メモリ20の開始フラグ24がONかを調べる(ステップ601)。
【0059】
ここで、開始フラグ24がONでない場合は(ステップ601でNO)、ステップ604に進む。
【0060】
また、ステップ601で、開始フラグ24がONである場合は(ステップ601でYES)、次に、共有メモリ20の完了1フラグ25がOFFかを調べる(ステップ602)。
【0061】
ここで、完了1フラグ25がOFFでない場合は(ステップ602でNO)、ステップ604に進む。
【0062】
また、ステップ602で、完了1フラグ25がOFFであると(ステップ602でYES)、完了1フラグ25をONにセットしてステップ604に進む。
【0063】
ステップ604では、自ノードの排他フラグがOFFかを調べる。ここで、自ノードの排他フラグがOFFでない場合は(ステップ604でNO)、ステップ601に戻る。
【0064】
また、ステップ604で、自ノードの排他フラグがOFFである場合は(ステップ604でYES)、次に自ノードの受信フラグがONかを調べる(ステップ605)。
【0065】
ここで、自ノードの受信フラグがONでないと(ステップ605でNO)、ステップ601に戻る。
【0066】
また、ステップ605で、自ノードの受信フラグがONであると(ステップ605でYES)、共有メモリ20の自ノードの通信データバッファに書き込まれている送信データを通信コントローラ30の送信バッファ32にコピーする処理を実行する(ステップ606)。
【0067】
そして、ステップ606の処理が終了すると、自ノードの受信フラグをOFFにし(ステップ607)、完了2フラグ26をOFFにして(ステップ608)、ステップ601に戻る。
【0068】
図7は、この発明に係わるデータ交換方法および装置を適用して構成した通信システムの他の実施の形態を概略ブロック図で示したものである。
【0069】
この図7に示す通信システムは、図1に示した通信システムのプログラマブルコントローラ10の通信ドライバ12内に全ノードエリア分の通信データバッファ(以下、これをキャッシュメモリと呼ぶ)13を追加することにより構成することができる。
【0070】
この図7に示す通信システムにおいては、共有メモリ20の通信データバッファ21上のデータを一旦プログラマブルコントローラ10の通信ドライバ12内のキャッシュメモリ13に読み出し、プログラマブルコントローラ10のユーザプログラム11に対しては、このキャッシュメモリ13の記憶内容を通知する。
【0071】
また、この通信システムでは、共有メモリ20の通信データバッファ21上に受信すべき新規のデータ受信がない場合は、キャッシュメモリ13に記憶されている前回の読み出し内容をプログラマブルコントローラ10のユーザプログラム11に対して通知する。
【0072】
また、この通信システムでは、プログラマブルコントローラ10のユーザプログラム11からみて、一度に複数ノード分のデータを操作することができる。また、この操作の間は、排他制御されていないノード分のデータは、通信コントローラ30からの新規データを共有メモリ20の通信データバッファ21に平行してコピーすることができる。
【0073】
図8は、図7に示した通信システムにおける複数ノード分の排他制御をタイムチャートで示したものである。なお、図8においては、プログラマブルコントローラ10のユーザプログラム11からノード(1)、(2)を操作する場合の操作例が示される。なお、通信コントローラ30、自ノードデータの送信処理については、図1乃至図6で説明した通信システムと同一である。
【0074】
図9は、図7に示したプログラマブルコントローラ10の通信ドライバ12による複数ノードに対する受信処理をフローチャートで示したものである。なお、図9においては、図8と同じように、プログラマブルコントローラ10のユーザプログラム11からノード(1)、(2)を操作する場合の操作例が示される。
【0075】
図9において、プログラマブルコントローラ10の通信ドライバ12は、まず、共有メモリ20のノード(1)に対応する受信フラグ22−1(受信フラグ1)がONであるか否かを調べる(ステップ901)。
【0076】
ここで、受信フラグ22−1(受信フラグ1)がONでない場合は(ステップ901でNO)、ステップ903に進む。
【0077】
また、ステップ901で、受信フラグ22−1(受信フラグ1)がONであると(ステップ901でYES)、対応する排他フラグ23−1(排他フラグ1)をONにし(ステップ902)、ステップ903に進む。
【0078】
ステップ903においては、共有メモリ20のノード(2)に対応する受信フラグ22−2(受信フラグ2)がONであるか否かを調べる。
【0079】
ここで、受信フラグ22−2(受信フラグ2)がONでない場合は(ステップ903でNO)、ステップ905に進む。
【0080】
また、ステップ903で、受信フラグ22−2(受信フラグ2)がONであると(ステップ903でYES)、対応する排他フラグ23−2(排他フラグ2)をONにし(ステップ904)、ステップ905に進む。
【0081】
ステップ905では、共有メモリ20の開始フラグ24をONにセットし、次に完了1フラグ25がONかを調べ(ステップ906)、ここで、共有メモリ20の完了1フラグ25がONでないと(ステップ906でNO)、ステップ906に戻り、完了1フラグ25がONになるまで待ち、完了1フラグ25がONになると(ステップ906でYES)、次に、排他フラグ22−1(排他フラグ1)がONかを調べる(ステップ907)。
【0082】
ここで、排他フラグ22−1(排他フラグ1)がONでないと(ステップ907でNO)、ステップ911に進む。
【0083】
また、ステップ907で、排他フラグ22−1(排他フラグ1)がONであると(ステップ907でYES)、共有メモリ20の通信データバッファ21−1からプログラマブルコントローラ10の通信ドライバ12のキャッシュメモリ13へのデータの読み出し処理を実行する(ステップ908)。
【0084】
そして、このステップ908の処理が終了すると、共有メモリ20の対応する受信フラグ22−1をOFFにし(ステップ910)、ステップ911に進む。
【0085】
ステップ911では、排他フラグ22−1(排他フラグ1)がONかを調べる。ここで、排他フラグ22−1(排他フラグ1)がONでないと(ステップ911でNO)、ステップ913に進む。
【0086】
また、ステップ911で、排他フラグ22−2(排他フラグ2)がONであると(ステップ911でYES)、共有メモリ20の通信データバッファ21−2からプログラマブルコントローラ10の通信ドライバ12のキャッシュメモリ13へのデータの読み出し処理を実行し(ステップ912)、ステップ913に進む。
【0087】
ステップ913では、共有メモリ20の対応する受信フラグ22−2をOFFにし、次に、対応する排他フラグ23−2をOFFにする(ステップ914)。
【0088】
そして、キャッシュメモリ13に読み出したデータをプログラマブルコントローラ10のユーザプログラム11に通知する処理を行う(ステップ915)。
【0089】
その後、共有メモリ20の開始フラグ24をOFFにし(ステップ916)、最後に、完了1フラグ25をOFFにして(ステップ917)、この処理を終了する。
【0090】
【発明の効果】
以上説明したように請求項1の発明によれば、複数のノードから定期的に受信した受信データを共有メモリにコピーし、該共有メモリにコピーした受信データを端末からの読み出し命令に対応して読み出して該端末に引き渡すデータ交換方法において、上記共有メモリは、上記受信データをノード単位で管理し、上記端末に引き渡す新規受信データが上記共有メモリに格納されている場合のみ該端末に対する受信データの引き渡しを可能にするように構成したので、信頼のおける通信データの読み出し/書き込みを連続して行う場合に通信サイクルタイム時間の影響をなくすとともに、通信媒体の使用条件による性能変動をなくすことができるという効果を奏する。
【0091】
また、請求項2の発明においては、請求項1の発明において、上記共有メモリは、上記受信データを各ノード毎にコピーする通信データバッファと、上記通信データバッファに対する上記各ノード単位のデータ受信を管理する受信フラグと、上記受信データを上記通信データバッファへコピーする第1の動作と上記端末からの読み出し命令に対応して上記通信データバッファから該受信データを読み出して該端末に引き渡す第2の動作との排他処理を上記ノード単位で管理する排他フラグと、上記排他処理の開始、完了を管理する開始、完了フラグと、を格納して構成したので、請求項1の発明の効果に加えて、必要な個所のみ排他機能が働くようにすることができ、排他処理完了を通信サイクルのどの部分でも行うことができる。
【0092】
また、請求項3の発明においては、請求項1の発明において、上記共有メモリにコピーされた受信データを読み出して上記端末に引き渡す動作は、上記端末に設けられたキャッシュメモリを介して行われるように構成したので、端末側から見て一度に複数ノードのデータを操作することができる。また、この操作の間は、排他制御されていないノード分のデータのコピーを平行して行うことができる。
【0093】
また、請求項4の発明においては、請求項1の発明において、上記端末は、ユーザプログラムと通信ドライバとを有するプログラマブルコントローラから構成し、また、請求項5の発明においては、請求項4の発明において、上記キャッシュメモリは、上記通信ドライバに設けるよう構成したので、プログラマブルコントローラ側から見て一度に複数ノードのデータを操作することができる。また、この操作の間は、排他制御されていないノード分のデータのコピーを平行して行うことができる。
【0094】
また、請求項6の発明においては、複数のノードを収容する通信媒体に接続される通信コントローラと、プログラマブルコントローラと、上記通信コントローラと上記プログラマブルコントローラとの間に接続され、上記通信コントローラと上記プログラマブルコントローラとの間でデータの交換を行う共有メモリと、を具備するデータ交換装置において、上記共有メモリは、上記交換するデータを上記ノード単位で格納するデータ格納手段と、上記データ格納手段に格納された上記交換するデータの排他処理を上記ノード単位で管理する管理手段と、とを具備して構成したので、信頼のおける通信データの読み出し/書き込みを連続して行う場合に通信サイクルタイム時間の影響をなくすとともにし、通信媒体の使用条件による性能変動をなくすことができるデータ交換装置を提供することができるという効果を奏する。
【0095】
また、請求項7の発明においては、請求項6の発明において、上記データ格納手段は、上記通信コントローラで受信した受信データを各ノード毎にコピーする複数の通信データバッファ、を具備し、上記管理手段は、上記通信データバッファに対する上記各ノード単位のデータ受信を管理する受信フラグと、上記通信コントローラで受信した受信データを上記通信データバッファへコピーする第1の動作と上記プログラマブルコントローラからの読み出し命令に対応して上記通信データバッファにコピーされた受信データを上記プログラマブルコントローラに読み出す第2の動作との排他処理を上記各ノード単位で管理する排他フラグと、上記排他処理の開始、完了を示す開始、完了フラグと、を具備して構成したので、請求項6の発明の効果に加えて、必要な個所のみ排他機能が働くようにすることができ、排他処理完了を通信サイクルのどの部分でも行うことができる。
【0096】
また、請求項8の発明においては、請求項6の発明において、上記プログラマブルコントローラは、ユーザプログラムを格納するユーザプログラム部と、上記共有メモリとの間で通信を行う通信ドライバと、を具備することを特徴とし、また、請求項9の発明においては、請求項8の発明において、上記通信ドライバは、上記共有メモリにコピーされた受信データを一旦読み出して格納するキャッシュメモリ、を具備することを特徴とする。この構成によれば、プログラマブルコントローラ側から見て一度に複数ノードのデータを操作することができる。また、この操作の間は、排他制御されていないノード分のデータのコピーを平行して行うことができる。
【図面の簡単な説明】
【図1】この発明に係わるデータ交換方法および装置を適用して構成した通信システムの一実施の形態を示した概略ブロック図。
【図2】図1に示した通信システムの動作を説明するタイムチャート。
【図3】図1に示したプログラマブルコントローラの通信ドライバによる特定ノードに対する受信処理を示すフローチャート。
【図4】図1に示した通信コントローラによる特定ノードに対する受信処理を示すフローチャート。
【図5】図1に示したプログラマブルコントローラのユーザプログラムから自ノードデータを送信する場合における通信ドライバの送信処理を示すフローチャート。
【図6】図1に示したプログラマブルコントローラのユーザプログラムから自ノードデータを送信する場合における通信コントローラの送信処理を示すフローチャート。
【図7】この発明に係わるデータ交換方法および装置を適用して構成した通信システムの他の実施の形態を示す概略ブロック図。
【図8】図7に示した通信システムにおける複数ノード分の排他制御を示すタイムチャート。
【図9】図7に示したプログラマブルコントローラの通信ドライバによる複数ノードに対する受信処理を示すフローチャート。
【図10】従来のサイクリック型通信(データリンク)を用いてデータ交換を行う通信システムの一例を示すブロック図。
【図11】図10に示した従来の通信システムの動作を示すタイムチャート。
【図12】図10に示した従来の通信システムにおけるプログラマブルコントローラの通信ドライバによる通信処理を示すフローチャート。
【図13】図10に示した従来の通信システムにおける通信コントローラによる通信処理を示すフローチャート。
【符号の説明】
10 プログラマブルコントローラ
11 ユーザプログラム
12 通信ドライバ
13 キャッシュメモリ
20 共有メモリ
21、21−1〜21−n 通信データバッファ
22−1〜22−n 受信フラグ
23−1〜23−n 排他フラグ
24 開始フラグ
25 完了1フラグ
26 完了2フラグ
30 通信コントローラ
31 受信バッファ
32 送信バッファ
40 通信媒体
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a data exchange method and apparatus using cyclic communication (data link).
[0002]
[Prior art]
Conventionally, a configuration shown in FIG. 10 is known as a communication system for exchanging data using cyclic communication (data link). The communication system shown in FIG. 10 reads / writes communication data to / from the user program 11 of the programmable controller 10 via the communication medium 40, the communication controller 30, and the shared memory 20. A buffer 21, an exclusion flag 22, and a completion flag 23 are provided, and the communication controller 30 is provided with a plurality of reception data buffers 31 and transmission data buffers 32.
[0003]
In FIG. 10, the communication controller 30 periodically receives communication data of other stations from the communication medium 40 regardless of the command from the user program 11 of the programmable controller 10 as shown in the time chart of FIG. -A) The received communication data is stored in the reception data buffer 31, and the transmission data stored in the transmission data buffer 32 is transmitted to the communication medium 40 in accordance with the transmission timing of the own station (WB). ).
[0004]
Further, the communication controller 30 copies the reception data stored in the reception data buffer 31 to the communication data buffer 21 of the shared memory 20 (RB) unless there is an instruction from the programmable controller 10, and the shared memory 20 The transmission data stored in the communication data buffer 21 is copied to the transmission data buffer 32 (W-A).
[0005]
When a read command is issued from the user program 11 (R-1), the communication driver 12 of the programmable controller 10 reads the received data copied to the communication data buffer 21 of the shared memory 20 from the communication data buffer 21 in the above procedure. (R-2), this is handed over to the user program 11 (R-3).
[0006]
By the way, while the received data is read from the communication data buffer 21 of the shared memory 20 and delivered to the user program 11 of the programmable controller 10, the received data shared memory 20 stored in the received data buffer 31 of the communication controller 30 is transferred. When the copy to the communication data buffer 21 occurs, the received data handed over to the user program 11 of the programmable controller 10 changes to new received data from the middle. As a result, the consistency of the data is destroyed and the reliability of the data is increased. Is lost.
[0007]
Therefore, in the communication system shown in FIG. 10, an exclusive flag 22 and a completion flag 23 are provided in the shared memory 20 provided between the programmable controller 10 and the communication controller 30, and programmable from the communication data buffer 21 of the shared memory 20. The controller 10 is configured to perform exclusive control of the received data transfer process to the user program 11 and the received data copy process from the received data buffer 31 of the communication controller 30 to the communication data buffer 21 of the shared memory 20. .
[0008]
12 and 13 are flowcharts showing the exclusive control. FIG. 12 shows a communication process of the communication driver 12 of the programmable controller 10, and FIG. 13 shows a communication process of the communication controller 30.
[0009]
That is, in FIG. 12, the communication driver 12 of the programmable controller 10 first turns on the exclusive flag 22 of the shared memory 20 (step 101), and then determines whether the completion flag 23 of the shared memory 20 is on. Check (step 102).
[0010]
If the completion flag 23 of the shared memory 20 is not ON (NO in step 102), the process returns to step 102 and waits until the completion flag 23 is turned ON. If the completion flag 23 of the shared memory 20 is ON ( In step 102, the received data is transferred from the communication data buffer 21 of the shared memory 20 to the user program 11 of the programmable controller 10 (step 103).
[0011]
When the received data transfer process from the communication data buffer 21 of the shared memory 20 to the user program 11 of the programmable controller 10 is completed, the exclusive flag 22 of the shared memory 20 is turned off (step 104), and the completion flag 23 is turned off. (Step 105), the process is terminated.
[0012]
In FIG. 13, the communication controller 30 first checks whether or not the exclusive flag 22 of the shared memory 20 is ON (step 201). Here, if the exclusive flag 22 of the shared memory 20 is not ON (step 201). In step 201, the received data is copied from the received data buffer 31 of the communication controller 30 to the communication data buffer 21 of the shared memory 20 (step 202), and then the communication data buffer 21 of the shared memory 20 communicates. The transmission data is copied to the transmission data buffer 32 of the controller 30 (step 203), and the process returns to step 201.
[0013]
If it is determined in step 201 that the exclusive flag 22 of the shared memory 20 is ON (YES in step 201), it is next checked whether or not the completion flag 23 of the shared memory 20 is OFF (step 201). 204).
[0014]
If the completion flag 23 of the shared memory 20 is not OFF (NO in step 204), the process returns to step 201. If the completion flag 23 of the shared memory 20 is OFF (YES in step 204), then the previous time It is checked whether the interval from the exclusive processing is equal to or longer than one communication cycle time (step 205).
[0015]
If the interval from the previous exclusive process is not longer than one communication cycle time (NO in step 205), the process proceeds to step 202, and reception from the reception data buffer 31 of the communication controller 30 to the communication data buffer 21 of the shared memory 20 is performed. Data copy processing is executed, and subsequently, transmission data copy processing from the communication data buffer 21 of the shared memory 20 to the transmission data buffer 32 of the communication controller 30 is executed (step 203), and the processing returns to step 201.
[0016]
If it is determined in step 205 that the interval from the previous exclusive process is equal to or longer than one communication cycle time (YES in step 205), the completion flag 23 of the shared memory 20 is turned on (step 206). Return to.
[0017]
That is, on the communication controller 30 side, a restriction is provided on the exclusive process on the communication driver 12 side of the programmable controller 10 so that the time interval from the previous exclusive process is 1 communication cycle or more. This is to prevent the time when the communication controller 30 side operates the communication data buffer 21 of the shared memory 20 when the exclusive processing from the communication driver 12 side of the programmable controller 10 is frequently performed.
[0018]
[Problems to be solved by the invention]
However, in a communication system that exchanges data using the conventional cyclic communication (data link),
1) Since exclusive control affects the communication cycle time, the user program is stopped for one communication cycle time.
2) Therefore, the performance of a user program that continuously reads / writes reliable communication data cannot be made faster than the communication cycle time. 3) The communication cycle time is the amount of data transmitted to the communication medium. The performance of the user program varies greatly depending on the usage conditions of the communication medium.
There was a problem.
[0019]
Therefore, the present invention eliminates the influence of the communication cycle time on the performance of the user program that continuously reads / writes reliable communication data, and eliminates the fluctuation of the performance of the user program due to the use condition of the communication medium. It is an object to provide an exchange method and apparatus.
[0020]
[Means for Solving the Problems]
  In order to achieve the above object, according to the first aspect of the present invention, a shared memory for exchanging data is connected between a communication controller connected to a communication medium accommodating a plurality of nodes and a terminal. The received data cyclically received from the communication medium via the communication controller is copied to the shared memory, and the received data copied to the shared memory is read in response to a read command from the terminal to the terminal. A data exchange method using cyclic communication, wherein the communication controller transmits the received data;In the above node unitStoreforA reception data buffer is provided, and reception data cyclically received from the communication medium is stored in the reception data buffer.In the above node unitThe shared memory stores received data for each node.For storingCommunication data bufferAnd a reception flag provided for each node and indicating whether or not the reception data is stored in the communication data buffer in units of nodes.As well asThatThe received data stored in the received data buffer of the communication controller is copied to the communication data buffer for each of the plurality of nodes, and the new received data delivered to the terminalCommunication data bufferStored inThe reception flag indicates storage of received dataOnly if its shared memoryCommunication data bufferIt is possible to deliver received data from the terminal to the terminal.
[0022]
  Claims2The invention of claim 1 is the invention of claim 1,
  The operation of reading the received data copied to the shared memory and delivering it to the terminal is as follows:
  It is performed through a cache memory provided in the terminal.
[0023]
  Claims3The invention of claim 1 is the invention of claim 1,
  The terminal
  It consists of a programmable controller having a user program and a communication driver.
[0024]
  Claims4The invention of claim2In the invention of
  The terminal
It consists of a programmable controller having a user program and a communication driver,
  The cache memory is
  It is provided in the communication driver.
[0025]
  Claims5In the invention, a shared memory for exchanging data between a communication controller connected to a communication medium accommodating a plurality of nodes and a programmable controller is connected, and the communication medium is connected via the communication controller. Use cyclic communication to copy the received data cyclically received from the above to the shared memory, read the received data copied to the shared memory in response to a read command from the programmable controller and deliver it to the programmable controller The communication controller includes a reception data buffer that stores reception data cyclically received from the communication medium in units of nodes, and the shared memory stores the data to be exchanged in units of nodes. Communication data buffer stored in Management means for managing exclusive processing of the exchanged data stored in the communication data buffer in units of nodes, and the management means is provided for each node and the exchanged data is stored in the node A reception flag indicating whether or not the data is stored in the communication data buffer in units is provided.
[0027]
  Claims6The invention of claim5In the invention of
  The programmable controller is
  A user program section for storing a user program;
  A communication driver for communicating with the shared memory;
  It is characterized by comprising.
[0028]
  Claims7According to the invention of claim 6,
  The communication driver
  A cache memory that once reads and stores the received data copied to the shared memory;
  It is characterized by comprising.
[0029]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
[0030]
FIG. 1 is a schematic block diagram showing an embodiment of a communication system constructed by applying a data exchange method and apparatus according to the present invention.
[0031]
The communication system shown in FIG. 1 can be configured by adding the following configuration to the shared memory 20 of the conventional communication system shown in FIG.
1) Communication data buffers 21-1 to 21-n in node units
2) Reception flags 22-1 to 22-n in node units
3) Exclusive flags 23-1 to 23-n in node units
4) Start flag 24 indicating the start of exclusive processing
5) Completion 1 flag 25 indicating completion 1
6) Completion 2 flag 26 indicating completion 2
[0032]
Here, the start flag 24 of 4) and the completion 1 flag 25 of 5) and the completion 2 flag 26 of 6) can also be configured from an interrupt notification to the communication driver 12 and the communication controller 30 of the programmable controller 10.
[0033]
As shown in the time chart of FIG. 2, the communication controller 30 periodically receives communication data of other stations (other nodes) from the communication medium 40 regardless of instructions from the user program 11 of the programmable controller 10 (Rx A) The received communication data is stored in the reception data buffer (x) 31, and the transmission data stored in the transmission data buffer 32 is transmitted to the communication medium 40 in accordance with the transmission timing of the own station ( W-B).
[0034]
Further, the communication controller 30 copies the reception data stored in the reception data buffer 31 to the communication data buffers 21-1 to 21-n of the shared memory 20 (Rx-B) unless there is an instruction from the programmable controller 10. Further, the transmission data stored in the communication data buffers 21-1 to 21-n of the shared memory 20 are copied to the transmission data buffer 32 (W-A).
[0035]
When a read command is issued from the user program 11 (R-1), the communication driver 12 of the programmable controller 10 corresponds to the communication data buffer 21 corresponding to the received data copied to the communication data buffer 21 of the shared memory 20 in the above procedure. Read from 1 to 21-n (Rx-2), and hand it over to the user program 11 (R-3).
[0036]
By the way, in the communication system shown in FIG. 1, the communication of the programmable controller 10 is performed only when there is new reception data to be read in the communication data buffers 21-1 to 21-n of the shared memory 20, as shown in FIG. The driver 12 is configured to allow the received data to be read from the communication data buffers 21-1 to 21-n of the shared memory 20.
[0037]
In addition, when there is no new received data to be read in the communication data buffers 21-1 to 21-n of the shared memory 20, the communication driver 12 of the programmable controller 10 sends a read result to the user program of the programmable controller 10. Notify as a failure.
[0038]
FIG. 3 is a flowchart showing reception processing for a specific node by the communication driver 12 of the programmable controller 10 shown in FIG.
[0039]
In FIG. 3, the communication driver 12 of the programmable controller 10 first checks whether or not the reception flag 22-2 (reception flag 2) corresponding to a specific node of the shared memory 20, for example, the node (2) is ON. (Step 301).
[0040]
Here, when the reception flag 22-2 (reception flag 2) is not ON (NO in step 301), there is no new reception data to be read out, and therefore the result of reading out to the user program of the programmable controller 10 is regarded as failure. Notification is made (step 311).
[0041]
If it is determined in step 301 that the reception flag 22-2 (reception flag 2) is ON (YES in step 301), the exclusive corresponding to this reception flag 22-2 (reception flag 2) is then performed. The flag 23-2 (exclusive flag 2) is turned on (step 302), and then the start flag 24 of the shared memory 20 is turned on (step 303).
[0042]
Next, it is checked whether the completion 1 flag 25 of the shared memory 20 is ON (step 304). If the completion 1 flag 25 of the shared memory 20 is not ON (NO in step 304), the process returns to step 304, and the shared memory 20 20 until the completion 1 flag 25 of the shared memory 20 is turned on. When the completion 1 flag 25 of the shared memory 20 is turned on (YES in step 304), the user program 11 of the programmable controller 10 is transferred from the communication data buffer 21-2 of the shared memory 20. The received data is transferred to the server (step 305).
[0043]
When the reception data transfer process from the communication data buffer 21-2 of the shared memory 20 to the user program 11 of the programmable controller 10 is completed, the corresponding reception flag 22-2 of the shared memory 20 is turned OFF (step 306). Next, the corresponding exclusive flag 23-2 is turned off (step 307), then the start flag 24 is turned off (step 308), and then the completion 1 flag 25 is turned off (step 309). Is successful (step 310).
[0044]
FIG. 4 is a flowchart showing a reception process for a specific node by the communication controller 30 shown in FIG.
[0045]
In FIG. 4, the communication controller 30 first checks whether the start flag 24 of the shared memory 20 is ON (step 401).
[0046]
If the start flag 24 of the shared memory 20 is not ON (NO in step 401), the process proceeds to step 404. If the start flag 24 of the shared memory 20 is ON (YES in step 401), then the shared memory 20 It is checked whether the 20 completion 1 flag 25 is OFF (step 402).
[0047]
If the completion 1 flag 25 is not OFF (NO in step 402), the process proceeds to step 404. If the completion 1 flag 25 is OFF (YES in step 402), the completion 1 flag 25 of the shared memory 20 is turned ON. (Step 403), the process proceeds to step 404.
[0048]
In step 404, data for the node (x) corresponding to the node (x) is received from the communication medium 40. When reception of data for the node (x) is completed, it is next checked whether or not the corresponding exclusive flag 23-x (exclusive flag x) of the shared memory 20 is OFF (step 405).
[0049]
If the exclusive flag 23-x (exclusive flag x) is not OFF (NO in step 405), the process returns to step 401.
[0050]
If it is determined in step 405 that the exclusion flag 23-x (exclusion flag x) is OFF (YES in step 405), the communication of the shared memory 20 from the reception data buffer 31 (x) of the communication controller 30 is performed. The received data is copied to the data buffer 21-x (step 406), the corresponding reception flag 22-x of the shared memory 20 is turned on (step 407), and the process returns to step 401.
[0051]
FIG. 5 is a flowchart showing the transmission process of the communication driver 12 when the local node data is transmitted from the user program 11 of the programmable controller 10.
[0052]
In FIG. 5, the communication driver 12 of the programmable controller 10 first checks whether the completion 2 flag 26 of the shared memory 20 is OFF (step 501). If the completion 2 flag 26 of the shared memory 20 is not OFF (NO in step 501), the process returns to step 501, waits until the completion 2 flag 26 of the shared memory 20 is turned OFF, and the completion 2 flag of the shared memory 20 is When 26 is turned off (YES in step 501), the exclusive flag of the own node is turned on (step 502).
[0053]
Next, the start flag 24 is turned on (step 503), and it is checked whether the completion 1 flag 25 of the shared memory 20 is on (step 504).
[0054]
If the completion 1 flag 25 of the shared memory 20 is not ON (NO in step 504), the process returns to step 504 and waits until the completion 1 flag 25 of the shared memory 20 is turned on.
[0055]
When the completion 1 flag 25 of the shared memory 20 is turned ON (YES in step 504), a process of writing the own node data transmitted from the user program 11 of the programmable controller 10 to the communication data buffer of the shared memory 20 is performed (step 505).
[0056]
When the processing in step 505 is completed, the reception flag of the own node of the shared memory 20 is turned on (step 506), the exclusion flag of the own node is then turned off (step 507), and then the completion 2 flag 26 is turned on (step 509), and finally the start flag 24 is turned off (step 510). This processing is successful (step 511).
[0057]
FIG. 6 is a flowchart showing the transmission process of the communication controller 30 when transmitting the own node data from the user program 11 of the programmable controller 10.
[0058]
In FIG. 6, the communication controller 30 first checks whether the start flag 24 of the shared memory 20 is ON (step 601).
[0059]
If the start flag 24 is not ON (NO in step 601), the process proceeds to step 604.
[0060]
If it is determined in step 601 that the start flag 24 is ON (YES in step 601), it is then checked whether the completion 1 flag 25 of the shared memory 20 is OFF (step 602).
[0061]
If the completion 1 flag 25 is not OFF (NO in step 602), the process proceeds to step 604.
[0062]
If the completion 1 flag 25 is OFF in step 602 (YES in step 602), the completion 1 flag 25 is set to ON and the process proceeds to step 604.
[0063]
In step 604, it is checked whether the exclusive flag of the own node is OFF. If the exclusive flag of the own node is not OFF (NO in step 604), the process returns to step 601.
[0064]
If the exclusive flag of the own node is OFF in step 604 (YES in step 604), it is next checked whether the reception flag of the own node is ON (step 605).
[0065]
If the reception flag of the own node is not ON (NO in step 605), the process returns to step 601.
[0066]
In step 605, if the reception flag of the own node is ON (YES in step 605), the transmission data written in the communication data buffer of the own node of the shared memory 20 is copied to the transmission buffer 32 of the communication controller 30. The processing to be executed is executed (step 606).
[0067]
When the processing in step 606 is completed, the reception flag of the own node is turned off (step 607), the completion 2 flag 26 is turned off (step 608), and the process returns to step 601.
[0068]
FIG. 7 is a schematic block diagram showing another embodiment of a communication system configured by applying the data exchange method and apparatus according to the present invention.
[0069]
The communication system shown in FIG. 7 includes a communication data buffer (hereinafter referred to as a cache memory) 13 for all node areas in the communication driver 12 of the programmable controller 10 of the communication system shown in FIG. Can be configured.
[0070]
In the communication system shown in FIG. 7, data on the communication data buffer 21 of the shared memory 20 is once read into the cache memory 13 in the communication driver 12 of the programmable controller 10, and the user program 11 of the programmable controller 10 is The contents stored in the cache memory 13 are notified.
[0071]
In this communication system, when there is no new data to be received on the communication data buffer 21 of the shared memory 20, the previous read content stored in the cache memory 13 is stored in the user program 11 of the programmable controller 10. Notify them.
[0072]
Further, in this communication system, as viewed from the user program 11 of the programmable controller 10, data for a plurality of nodes can be operated at a time. In addition, during this operation, for the data for nodes that are not exclusively controlled, new data from the communication controller 30 can be copied in parallel to the communication data buffer 21 of the shared memory 20.
[0073]
FIG. 8 is a time chart showing exclusive control for a plurality of nodes in the communication system shown in FIG. In addition, in FIG. 8, the operation example in the case of operating node (1), (2) from the user program 11 of the programmable controller 10 is shown. Note that the communication controller 30 and its own node data transmission process are the same as those in the communication system described with reference to FIGS.
[0074]
FIG. 9 is a flowchart showing reception processing for a plurality of nodes by the communication driver 12 of the programmable controller 10 shown in FIG. In addition, in FIG. 9, the operation example in the case of operating node (1), (2) from the user program 11 of the programmable controller 10 is shown like FIG.
[0075]
9, the communication driver 12 of the programmable controller 10 first checks whether or not the reception flag 22-1 (reception flag 1) corresponding to the node (1) of the shared memory 20 is ON (step 901).
[0076]
If the reception flag 22-1 (reception flag 1) is not ON (NO in step 901), the process proceeds to step 903.
[0077]
If the reception flag 22-1 (reception flag 1) is ON in step 901 (YES in step 901), the corresponding exclusive flag 23-1 (exclusive flag 1) is turned ON (step 902), and step 903 is performed. Proceed to
[0078]
In step 903, it is checked whether or not the reception flag 22-2 (reception flag 2) corresponding to the node (2) of the shared memory 20 is ON.
[0079]
If the reception flag 22-2 (reception flag 2) is not ON (NO in step 903), the process proceeds to step 905.
[0080]
If the reception flag 22-2 (reception flag 2) is ON in step 903 (YES in step 903), the corresponding exclusive flag 23-2 (exclusive flag 2) is turned ON (step 904), and step 905 is performed. Proceed to
[0081]
In step 905, the start flag 24 of the shared memory 20 is set to ON, and then it is checked whether the completion 1 flag 25 is ON (step 906). If the completion 1 flag 25 of the shared memory 20 is not ON (step 906). If the completion 1 flag 25 is turned on (YES in step 906), then the exclusive flag 22-1 (exclusive flag 1) is set. Whether it is ON is checked (step 907).
[0082]
If the exclusive flag 22-1 (exclusive flag 1) is not ON (NO in step 907), the process proceeds to step 911.
[0083]
If the exclusive flag 22-1 (exclusive flag 1) is ON in step 907 (YES in step 907), the cache memory 13 of the communication driver 12 of the programmable controller 10 is transferred from the communication data buffer 21-1 of the shared memory 20. Data reading processing is executed (step 908).
[0084]
When the processing in step 908 is completed, the corresponding reception flag 22-1 of the shared memory 20 is turned off (step 910), and the process proceeds to step 911.
[0085]
In step 911, it is checked whether or not the exclusive flag 22-1 (exclusive flag 1) is ON. If the exclusive flag 22-1 (exclusive flag 1) is not ON (NO in step 911), the process proceeds to step 913.
[0086]
If the exclusive flag 22-2 (exclusive flag 2) is ON in step 911 (YES in step 911), the cache memory 13 of the communication driver 12 of the programmable controller 10 is transferred from the communication data buffer 21-2 of the shared memory 20. The data reading process is executed (step 912), and the process proceeds to step 913.
[0087]
In step 913, the corresponding reception flag 22-2 of the shared memory 20 is turned off, and then the corresponding exclusion flag 23-2 is turned off (step 914).
[0088]
And the process which notifies the data read to the cache memory 13 to the user program 11 of the programmable controller 10 is performed (step 915).
[0089]
Thereafter, the start flag 24 of the shared memory 20 is turned off (step 916). Finally, the completion 1 flag 25 is turned off (step 917), and this process ends.
[0090]
【The invention's effect】
As described above, according to the first aspect of the present invention, received data periodically received from a plurality of nodes is copied to a shared memory, and the received data copied to the shared memory is corresponded to a read command from a terminal. In the data exchange method of reading and transferring to the terminal, the shared memory manages the received data in node units, and only when new received data to be transferred to the terminal is stored in the shared memory, Since it is configured to enable delivery, it is possible to eliminate the influence of the communication cycle time when continuously reading / writing reliable communication data, and to eliminate performance fluctuations due to the use conditions of the communication medium. There is an effect.
[0091]
According to a second aspect of the present invention, in the first aspect of the present invention, the shared memory receives a communication data buffer for copying the received data for each node, and receives data for each node with respect to the communication data buffer. A reception flag to be managed, a first operation for copying the reception data to the communication data buffer, and a second operation for reading the reception data from the communication data buffer and delivering it to the terminal in response to a read command from the terminal In addition to the effect of the invention of claim 1, since the exclusive flag for managing the exclusive process with the operation in units of nodes and the start and complete flag for managing the start and completion of the exclusive process are stored. Therefore, the exclusive function can be operated only at necessary portions, and the completion of the exclusive process can be performed in any part of the communication cycle.
[0092]
According to a third aspect of the invention, in the first aspect of the invention, the operation of reading the received data copied to the shared memory and delivering it to the terminal is performed via a cache memory provided in the terminal. Thus, it is possible to manipulate data of a plurality of nodes at a time as viewed from the terminal side. Further, during this operation, data for nodes not exclusively controlled can be copied in parallel.
[0093]
According to a fourth aspect of the invention, in the first aspect of the invention, the terminal comprises a programmable controller having a user program and a communication driver. In the fifth aspect of the invention, the terminal of the fourth aspect is provided. In the above configuration, the cache memory is provided in the communication driver, so that data of a plurality of nodes can be manipulated at a time as viewed from the programmable controller side. Further, during this operation, data for nodes not exclusively controlled can be copied in parallel.
[0094]
In the invention of claim 6, a communication controller connected to a communication medium accommodating a plurality of nodes, a programmable controller, connected between the communication controller and the programmable controller, the communication controller and the programmable controller. And a shared memory for exchanging data with the controller. The shared memory is stored in the data storage means for storing the data to be exchanged in units of nodes and the data storage means. In addition, since the management means for managing the exclusive processing of the exchanged data in units of the nodes is provided, the influence of the communication cycle time when the reliable reading / writing of the communication data is continuously performed. Performance fluctuations due to the use conditions of the communication medium. Camphor it is advantageously possible to provide a data switching apparatus can.
[0095]
According to a seventh aspect of the present invention, in the sixth aspect of the present invention, the data storage means includes a plurality of communication data buffers for copying received data received by the communication controller for each node, and the management The means includes: a reception flag for managing data reception for each node to the communication data buffer; a first operation for copying received data received by the communication controller to the communication data buffer; and a read command from the programmable controller The exclusive flag for managing the exclusive process with the second operation for reading the received data copied to the communication data buffer corresponding to the second operation to the programmable controller for each node, and the start indicating the start and completion of the exclusive process And a completion flag, so that the effect of the invention of claim 6 is achieved. In addition, only required locations can be so exclusive function operates, it is possible to perform any part of the communication cycle the exclusive process is completed.
[0096]
According to an eighth aspect of the present invention, in the sixth aspect of the present invention, the programmable controller includes a user program unit that stores a user program and a communication driver that performs communication between the shared memory. Further, in the invention of claim 9, in the invention of claim 8, the communication driver comprises a cache memory that once reads and stores the received data copied to the shared memory. And According to this configuration, data of a plurality of nodes can be manipulated at a time as viewed from the programmable controller side. Further, during this operation, data for nodes not exclusively controlled can be copied in parallel.
[Brief description of the drawings]
FIG. 1 is a schematic block diagram showing an embodiment of a communication system configured by applying a data exchange method and apparatus according to the present invention.
FIG. 2 is a time chart for explaining the operation of the communication system shown in FIG. 1;
FIG. 3 is a flowchart showing reception processing for a specific node by a communication driver of the programmable controller shown in FIG. 1;
4 is a flowchart showing reception processing for a specific node by the communication controller shown in FIG. 1;
FIG. 5 is a flowchart showing transmission processing of a communication driver in the case of transmitting own node data from the user program of the programmable controller shown in FIG. 1;
6 is a flowchart showing a transmission process of the communication controller when transmitting its own node data from the user program of the programmable controller shown in FIG. 1;
FIG. 7 is a schematic block diagram showing another embodiment of a communication system configured by applying the data exchange method and apparatus according to the present invention.
FIG. 8 is a time chart showing exclusive control for a plurality of nodes in the communication system shown in FIG. 7;
9 is a flowchart showing reception processing for a plurality of nodes by a communication driver of the programmable controller shown in FIG. 7;
FIG. 10 is a block diagram showing an example of a communication system that exchanges data using conventional cyclic communication (data link).
11 is a time chart showing the operation of the conventional communication system shown in FIG.
12 is a flowchart showing communication processing by a communication driver of a programmable controller in the conventional communication system shown in FIG.
13 is a flowchart showing communication processing by a communication controller in the conventional communication system shown in FIG.
[Explanation of symbols]
10 Programmable controller
11 User program
12 Communication driver
13 Cache memory
20 Shared memory
21, 211-1 to 21-n Communication data buffer
22-1 to 22-n reception flag
23-1 to 23-n Exclusive flag
24 Start flag
25 Completion 1 flag
26 Completion 2 flag
30 Communication controller
31 Receive buffer
32 Transmission buffer
40 Communication media

Claims (7)

複数のノードを収容する通信媒体に接続された通信コントローラと端末との間に、その間でデータの交換を行う共有メモリが接続されるとともに、上記通信コントローラを介して上記通信媒体からサイクリックに受信した受信データを上記共有メモリにコピーし、該共有メモリにコピーした受信データを上記端末からの読み出し命令に対応して読み出して該端末に引き渡す、サイクリック型通信を用いたデータ交換方法であって、
上記通信コントローラは、上記受信データを上記ノード単位で格納するための受信データバッファを備えるとともに、この受信データバッファに、上記通信媒体からサイクリックに受信した受信データを上記ノード単位で格納し、
上記共有メモリは、上記ノード単位で受信データを格納するための通信データバッファと、上記ノード毎に設けられるとともに上記通信データバッファに上記受信データが上記ノード単位で格納されたか否かを示す受信フラグとを、備えるとともに、その通信データバッファに、上記通信コントローラの受信データバッファに格納した受信データを上記複数のノード毎にコピーし、
上記端末に引き渡す新規受信データが上記共有メモリの通信データバッファに格納され上記受信フラグが受信データの格納を示している場合にのみ、その共有メモリの通信データバッファから該端末に対する受信データの引き渡しを可能にすることを特徴とするデータ交換方法。
A shared memory for exchanging data is connected between the communication controller connected to the communication medium containing a plurality of nodes and the terminal, and cyclically received from the communication medium via the communication controller. A data exchange method using cyclic communication, in which the received data is copied to the shared memory, and the received data copied to the shared memory is read in response to a read command from the terminal and delivered to the terminal. ,
The communication controller includes a reception data buffer for storing the reception data in units of nodes, and stores the reception data cyclically received from the communication medium in the reception data buffer in units of nodes.
The shared memory is a communication data buffer for storing received data in units of nodes, and a reception flag provided for each node and indicating whether the received data is stored in the communication data buffer in units of nodes. And the received data stored in the received data buffer of the communication controller is copied to the communication data buffer for each of the plurality of nodes,
Only when new reception data to be transferred to the terminal is stored in the communication data buffer of the shared memory and the reception flag indicates storage of reception data, the reception data is transferred from the communication data buffer of the shared memory to the terminal. A data exchange method characterized by enabling.
上記共有メモリにコピーされた受信データを読み出して上記端末に引き渡す動作は、
上記端末に設けられたキャッシュメモリを介して行われることを特徴とする請求項1記載のデータ交換方法。
The operation of reading the received data copied to the shared memory and delivering it to the terminal is as follows:
The data exchange method according to claim 1, wherein the data exchange method is performed via a cache memory provided in the terminal.
上記端末は、
ユーザプログラムと通信ドライバとを有するプログラマブルコントローラからなることを特徴とする請求項1記載のデータ交換方法。
The terminal
The data exchange method according to claim 1, comprising a programmable controller having a user program and a communication driver.
上記端末は、
ユーザプログラムと通信ドライバとを有するプログラマブルコントローラからなり、
上記キャッシュメモリは、
上記通信ドライバに設けられることを特徴とする請求項記載のデータ交換方法。
The terminal
It consists of a programmable controller having a user program and a communication driver,
The cache memory is
3. The data exchange method according to claim 2 , wherein the data exchange method is provided in the communication driver.
複数のノードを収容する通信媒体に接続された通信コントローラとプログラマブルコントローラとの間に、その間でデータの交換を行う共有メモリが接続されるとともに、上記通信コントローラを介して上記通信媒体からサイクリックに受信した受信データを上記共有メモリにコピーし、該共有メモリにコピーした受信データを上記プログラマブルコントローラからの読み出し命令に対応して読み出して該プログラマブルコントローラに引き渡す、サイクリック型通信を用いたデータ交換装置であって、
上記通信コントローラは、
上記通信媒体からサイクリックに受信した受信データを上記ノード単位で格納する受信データバッファを備え、
上記共有メモリは、
上記交換するデータを上記ノード単位で格納する通信データバッファと、
上記通信データバッファに格納された上記交換するデータの排他処理を上記ノード単位で管理する管理手段と、を具備し、
上記管理手段は、
上記ノード毎に設けられるとともに上記交換するデータが上記ノード単位で上記通信データバッファに格納されたか否かを示す受信フラグを具備する
ことを特徴とするデータ交換装置。
A shared memory for exchanging data between the communication controller and the programmable controller connected to a communication medium that accommodates a plurality of nodes is connected, and cyclically from the communication medium via the communication controller. A data exchange apparatus using cyclic communication that copies received data to the shared memory, reads the received data copied to the shared memory in response to a read command from the programmable controller, and delivers the read data to the programmable controller Because
The communication controller
A reception data buffer for storing reception data cyclically received from the communication medium in units of the nodes;
The shared memory is
A communication data buffer for storing the data to be exchanged in units of nodes;
Management means for managing exclusive processing of the exchanged data stored in the communication data buffer in units of nodes,
The management means is
A data exchange apparatus, comprising: a reception flag provided for each node and indicating whether or not the data to be exchanged is stored in the communication data buffer in units of nodes.
上記プログラマブルコントローラは、
ユーザプログラムを格納するユーザプログラム部と、
上記共有メモリとの間で通信を行う通信ドライバと、
を具備することを特徴とする請求項記載のデータ交換装置。
The programmable controller is
A user program section for storing a user program;
A communication driver for communicating with the shared memory;
6. The data exchange device according to claim 5 , further comprising:
上記通信ドライバは、
上記共有メモリにコピーされた受信データを一旦読み出して格納するキャッシュメモリ、
を具備することを特徴とする請求項記載のデータ交換装置。
The communication driver
A cache memory that once reads and stores the received data copied to the shared memory;
The data exchange apparatus according to claim 6 , further comprising:
JP30842696A 1996-11-19 1996-11-19 Data exchange method and apparatus Expired - Lifetime JP3791563B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP30842696A JP3791563B2 (en) 1996-11-19 1996-11-19 Data exchange method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP30842696A JP3791563B2 (en) 1996-11-19 1996-11-19 Data exchange method and apparatus

Publications (2)

Publication Number Publication Date
JPH10150467A JPH10150467A (en) 1998-06-02
JP3791563B2 true JP3791563B2 (en) 2006-06-28

Family

ID=17980917

Family Applications (1)

Application Number Title Priority Date Filing Date
JP30842696A Expired - Lifetime JP3791563B2 (en) 1996-11-19 1996-11-19 Data exchange method and apparatus

Country Status (1)

Country Link
JP (1) JP3791563B2 (en)

Also Published As

Publication number Publication date
JPH10150467A (en) 1998-06-02

Similar Documents

Publication Publication Date Title
US7130975B2 (en) Data processing system
US7143254B2 (en) Remote copy system
JP4412989B2 (en) Data processing system having a plurality of storage systems
JP3730907B2 (en) Remote data copy method between disk array devices
US20030229764A1 (en) Data storage subsystem
JP3472511B2 (en) Data transmission equipment
JP4066617B2 (en) Storage system connected to data network with data integrity
US7069305B2 (en) Computer system and a data transfer method thereof using remote direct memory access
EP1122924B1 (en) Method and apparatus for providing local path I/O in a distributed file system
JP3736305B2 (en) Disk cache system and disk cache control method
JP3791563B2 (en) Data exchange method and apparatus
JP3751536B2 (en) Data transmission equipment
US6847990B2 (en) Data transfer unit with support for multiple coherency granules
JP2738314B2 (en) Switching system of N + 1 redundant circuit controller
JP4030951B2 (en) Data duplication apparatus and method
JP2853607B2 (en) Communication system between jobs
JPH07143133A (en) Multi-layer protocol processor for common use of memory
CN107643988A (en) A kind of storage system and storage method with failover mechanism
JPH0461530A (en) Data transmission system
JPH04107660A (en) File transfer system
JPH01201763A (en) Data transfer system
JPH03185535A (en) Method for exchanging information between application programs by file transfer
JPH01181361A (en) Transmission buffer management system
JPH09326832A (en) Common use buffer device and its control method
JPH047651A (en) Storage device shaping system

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040901

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20041101

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050729

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20050927

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: 20060315

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20060328

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20100414

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20110414

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20130414

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20130414

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20140414

Year of fee payment: 8

EXPY Cancellation because of completion of term