JP3659398B2 - Programmable logic controller - Google Patents

Programmable logic controller Download PDF

Info

Publication number
JP3659398B2
JP3659398B2 JP30169799A JP30169799A JP3659398B2 JP 3659398 B2 JP3659398 B2 JP 3659398B2 JP 30169799 A JP30169799 A JP 30169799A JP 30169799 A JP30169799 A JP 30169799A JP 3659398 B2 JP3659398 B2 JP 3659398B2
Authority
JP
Japan
Prior art keywords
replacement
program
user program
flag
execution
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
JP30169799A
Other languages
Japanese (ja)
Other versions
JP2001125609A (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 JP30169799A priority Critical patent/JP3659398B2/en
Publication of JP2001125609A publication Critical patent/JP2001125609A/en
Application granted granted Critical
Publication of JP3659398B2 publication Critical patent/JP3659398B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Programmable Controllers (AREA)

Description

【0001】
【発明の属する技術分野】
この発明は、運転中におけるユーザプログラムの差し替えを可能としたプログラマブルロジックコントローラに係り、特に、ユーザプログラムの全差し替えを可能とすると共に、差し替え後のユーザプログラムを電源投入時と同様な条件で起動できるようにしたプログラマブルロジックコントローラに関する。
【0002】
【従来の技術】
運転中におけるユーザプログラムの差し替えを可能としたプログラマブルロジックコントローラ(以下、PLCと言う)としては、幾つかの例が知られている。このようなPLCの構成が図6〜図9により説明されている。
【0003】
すなわち、図6は従来PLCの通常時処理を示すフローチャート、図7は従来PLCのプログラム差し替え時処理を示すフローチャート、図8は従来PLCの監視タイマ処理のフローチャート、図9は従来PLCのユーザプログラム構成を示すラダー図である。
【0004】
図6に示されるように、電源投入(Power on)により処理が開始されると、まず最初に電源ON時処理が実行される(ステップ601)。この電源ON時処理(ステップ601)では、自己診断処理などの電源ON時に必要な各種の処理を実行する。
【0005】
続くI/Oメモリクリア処理(ステップ602)では、図示しないI/Oメモリの内容(入力データ、出力データ、各種のフラグやカウンタなど)を全てクリアする(ステップ602)。
【0006】
続く運転開始時処理(ステップ603)では、運転開始時に必要なシステム上の各種のフラグやレジスタの初期設定を行うと共に、後述する1サイクルONフラグ(F1)をセット(オン)する。
【0007】
その後、サイクルタイムの監視時間に設定値(例えば数10ms)をセットした後(ステップ604)、ユーザプログラム実行処理を開始する。
【0008】
ユーザプログラム部分差し替え命令を含む従来PLCのユーザプログラム構成が図9のラダー図に示されている。同図に示されるように、このユーザプログラムには、ユーザプログラム初期値設定処理(PR1)と、固定部分のユーザプログラム(PR2)と、差し替え元ファイル名付きのプログラム差し替え命令(FILP)と、差し替え対象部分であるユーザプログラム(PR3)と、ユーザプログラムの末尾を示すエンド命令(END)とが含まれている。
【0009】
ここで大切なことは、ユーザプログラムの先頭に記述されたユーザプログラム初期値設定処理(PR1)は、先ほど説明した、運転開始時1サイクルONフラグ(F1)を起動条件として実行されることである。後述するように、1サイクルONフラグ(F1)は、ユーザプログラムの一巡実行サイクルに限りオンとなる。
【0010】
又、この例では、プログラム差し替え命令(FILP)は、入出力装置に接続された外部スイッチ(SW1)を起動条件として実行される。
【0011】
このようなプログラム差し替え命令(FILP)を含むユーザプログラムが実行されると、電源投入後、最初のユーザプログラム一巡実行処理では、1サイクルONフラグ(F1)がオンすることによって、ユーザプログラム初期値設定処理(PR1)が実行され、その後固定部分のユーザプログラム(PR2)並びに差し替え対象部分のユーザプログラム(PR3)が繰り返し実行される。この状態において、外部スイッチ(SW1)がオンされると、プログラム差し替え命令(FILP)が実行される結果、プログラム差し替え命令(FILP)とエンド命令(END)とで挟まれて存在する差し替え対象部分であるユーザプログラム(PR3)は、プログラム差し替え命令(FILP)に付された差し替え元ファイル名で指定されるユーザプログラム(図示せず)と自動的に差し替えられることとなる。
【0012】
図6に戻って、この間の処理を詳細に説明すると、先ず監視時間に設定値をセットした後(ステップ604)、ユーザプログラムカウンタをプログラム先頭にセットし(ステップ605)、その後プログラムカウンタの値を歩進させながら(ステップ609)、図示しないユーザプログラムより各命令を順次に読み出しこれを解読実行する(ステップ606)。
【0013】
先に説明したように、電源投入後における最初のユーザプログラム一巡実行処理に際しては、運転開始時処理(ステップ603)において1サイクルONフラグがセットされているため、ユーザプログラム初期値設定処理(PR1)が実行される(図9参照)。
【0014】
その後、ユーザプログラム初期値設定処理(PR1)に続くユーザプログラム(PR2,PR3)が順次に実行されていき(ステップ606)、END命令の解読実行により最終命令と判定されると(ステップ608YES)、1サイクルONフラグ(F1)はリセット(オフ)される(ステップ610)。
【0015】
その後、公知のI/Oリフレッシュ処理(ステップ611)並びに周辺サービス処理(ステップ612)を経由した後、以上の処理(ステップ604〜612)が繰り返されるわけである。
【0016】
これに対して、ユーザプログラムの実行中に、プログラム差し替え命令(FILP)が実行されると(ステップ607YES)、図7に示されるプログラム差し替え時処理が実行される。
【0017】
図7に示されるプログラム差し替え時処理では、監視時間に設定値(数10ms)をセットした後(ステップ701)、プログラム差し替え命令(FILP)に付された差し替え元ファイル名に基づいてプログラム差し替え処理(ステップ702)を実行する。このプログラム差し替え処理(ステップ702)は、I/Oリフレッシュ処理(ステップ703)並びに周辺サービス処理(ステップ704)を実行しつつ、何回かに分けて時分割的に行われる。その間、プログラム差し替え処理(ステップ702)、I/Oリフレッシュ処理(ステップ703)、周辺サービス処理(ステップ704)からなる一連の処理の開始毎に、監視時間に設定値が再セットされる(ステップ706)。
【0018】
このようにしてプログラム差し替え処理が完了すると(ステップ705YES)、再び図6のフローチャートに戻って、ユーザプログラムの先頭からユーザプログラムの実行は開始される。
【0019】
ここで重要なことは、以後のユーザプログラム一巡実行処理では、運転開始時処理(ステップ603)は、スキップされるため、1サイクルONフラグはリセット状態(オフ状態)に維持される。そのため、ユーザプログラムの差し替えが完了したとしても、その起動に際して、ユーザプログラム初期値設定処理(PR1)が実行されることはない。このような制御手順を採用したのは、従来のプログラム差し替え命令(FILP)は、プログラムの全体差し替えを意図するものではなく、プログラム差し替え命令(FILP)とエンド命令(END)で挟まれたユーザプログラム(PR3)についてのみの部分差し替えを意図したものであるからである。
【0020】
尚、図8に示されるように、ステップ604,701,706でセットされた監視時間は、10μsec単位の割込みにより、順次減算されていき(ステップ801)、その減算結果が零若しくは零以下になると(ステップ802YES)、システム異常処理が実行される(ステップ803)。
【0021】
【発明が解決しようとする課題】
しかしながら、このような従来の運転時ユーザプログラム差し替え処理を可能としたPLCにあっては、電源投入後、最初のユーザプログラム一巡実行処理に先立って、1サイクルONフラグをオンすると共に(ステップ603)、ユーザプログラムの一巡実行処理後、次のユーザプログラム一巡実行処理に先立って、前記1サイクルONフラグをオフすることにより(ステップ610)、最初のユーザプログラム一巡実行処理の場合に限り、1サイクルONフラグ(F1)がオン状態となるように構成したため、ユーザプログラムの全差し替えを意図すべく、プログラム差し替え命令(FILP)をユーザプログラムの先頭に挿入したとしても、ユーザプログラム初期値設定処理(PR1)を実行させることができず、結局、プログラム全差し替えを行うことができないという問題点が指摘されている。
【0022】
さらに、サイクルタイム監視用の監視時間は、通常のユーザプログラム実行処理時もユーザプログラム差し替え処理時も変わりがないため、ユーザプログラム差し替え処理時に誤ってシステム異常が発生することを回避するため、プログラム差し替え処理時に先立って、サポートツールなどを介して、監視時間を長めに若しくは監視処理を停止させるなどの調整を行うことが必要となり、使い勝手が悪いという問題点も指摘されている。
【0023】
この発明は、このような従来の問題点に着目されてなされたものであり、その目的とするところは、運転中におけるユーザプログラムの全差し替えを可能としたプログラマブルロジックコントローラを提供することにある。
【0024】
又、この発明の他の目的とするところは、ユーザプログラムの運転中における全差し替えに際して、負荷の状態をオフ状態若しくはそれまでの状態のいずれにも設定可能なプログラマブルロジックコントローラを提供することにある。
【0025】
さらに、この発明の他の目的は、プログラム差し替え処理の開始に先立って、サイクルタイム監視時間の変更操作などを不要とした使い勝手の良好なプログラマブルロジックコントローラを提供することにある。
【0026】
本発明のプログラマブルロジックコントローラは、電源投入後、最初のユーザプログラム一巡実行処理に先立って、1サイクルオンフラグをオンすると共に、ユーザプログラムの一巡実行処理、次のユーザプログラム一巡実行処理に先だって、前記1サイクルオンフラグをオフすることにより、最初のユーザプログラム一巡実行処理の場合に限り、ユーザプログラムで使用可能な1サイクルオンフラグがオン状態となるようにした構成を前提としている。
【0027】
以上の前提に加えて、本発明のプログラマブルロジックコントローラは、差し替え用プログラム記憶手段と、プログラム全差し替え実行手段と、1サイクルオンフラグ強制操作手段とを新たに設けている。
【0028】
差し替え用プログラム記憶手段は、差し替え用のユーザプログラムを予め記憶したものである。好ましい実施の形態では、差し替え用プログラム記憶手段は、着脱可能な外部記憶媒体で構成することができる。外部記憶媒体としては、例えばフラッシュメモリカードなどを使用することができる。差し替え用のユーザプログラムは、例えば、メーカーサイドあるいはベンダーサイドなどで用意することができる。
【0029】
プログラム全差し替え実行手段は、プログラム全差し替え指示手段によりユーザプログラム全体の差し替えが指示されたとき、現在のユーザプログラムの全体を前記差し替え用ユーザプログラム記憶手段に記憶されたユーザプログラムにより差し替える。
【0030】
好ましい実施の形態では、プログラム全体の書き替えを指示する指示手段としては、ユーザプログラム上で使用可能な差し替え元ファイル名指定付きの特定出力命令と、該特定命令の解読に応答して所定のプログラム差し替え開始フラグをオンさせるフラグ操作手段とを含むことができる。好ましい実施の形態では、プログラム差し替え実行手段は、プログラム差し替え開始フラグがオンされたとき、現在のユーザプログラムの全体を前記差し替え用プログラム記憶手段に記憶されたユーザプログラムのうちで、前記特定出力命令に付された差し替え用ファイル名で指定の差し替え用ユーザプログラムにより差し替える処理を含むことができる。
【0031】
1サイクルオンフラグ強制操作手段は、プログラム全差し替え実行手段によりユーザプログラムの全差し替えが完了した後、該差し替え後のユーザプログラムの最初の一巡実行処理に先立って、前記1サイクルオンフラグを強制的にオンすると共に、ユーザプログラムの一巡実行処理後、次のユーザプログラム一巡実行処理に先だって、前記1サイクルオンフラグをオフさせる。
【0032】
以上のプログラマブルロジックコントローラのさらに好ましい実施の形態では、通常時には、ユーザプログラム一巡実行処理と、I/Oリフレッシュ処理と、周辺サービス処理とを含む一連の処理を繰り返し実行すると共に、プログラム差し替え時には、ユーザプログラム一巡実行処理の途中からプログラム差し替え処理へと移行した後、プログラム差し替え処理と、I/Oリフレッシュ処理と、周辺サービス処理とを含む一連の処理を繰り返し実行するものであり、且つユーザプログラム実行処理を開始するに際しては、ユーザプログラムの毎一巡処理の開始時に所定の監視タイマに規定の監視時間をセットすると共に、前記一連の処理の実行中に関しタイマがタイムアップしたとき、異常と認識するように構成されていることを前提とする。
【0033】
以上の前提の下に、このプログラマブルロジックコントローラでは、さらに、ユーザプログラムの実行中に特定出力命令が解読されたことにより、プログラム差し替え処理を開始するに際しては、プログラム差し替え処理が完了するまでの間、前記監視タイマによるサイクルタイムの監視を停止するように構成することができる。
【0034】
さらに、以上のプログラマブルロジックコントローラのさらに好ましい実施の形態では、プログラム差し替え処理を開始するに先立って、I/Oメモリの内容をクリアするか又は保存するかを指示するための差し替え時I/Oメモリ状態指示手段と、前記差し替え時I/Oメモリ状態指示手段の指示内容に応じて、プログラム差し替え時におけるI/Oメモリの状態を決定する差し替え時I/Oメモリ状態決定手段を具備することができる。
【0035】
以上のプログラマブルロジックコントローラのさらに好ましい実施の形態では、差し替え時I/Oメモリ状態指示手段が、ユーザプログラム上で使用可能な特定出力命令と、該特定出力命令の解読に応答して所定の負荷クリア指定フラグをオンさせるフラグ操作手段とを含むと共に、差し替え時I/Oメモリ状態決定手段が、前記負荷クリア指定フラグがオンされたとき、プログラム差し替え処理が開始するに先立って、I/Oメモリの内容をクリアするか又は保存するかを決定する処理を含むことができる。
【0036】
そして、以上説明した本発明によれば、ユーザプログラムの全差し替えが完了した後、該差し替え後のユーザプログラムの最初の一巡実行処理に先立って、1サイクルオンフラグを強制的にオンさせるようにしたため、差し替え完了後の新たなユーザプログラムの起動に際しては、そのユーザプログラムの先頭に通常1サイクルオンフラグを起動条件として記述されているユーザプログラム初期値設定処理を最初の一巡実行処理に限り実行させることができ、運転中でありながらも、電源投入直後と同様にユーザプログラムを取り扱うことができる。
【0037】
又、本発明によれば、プログラム差し替え処理に際して、負荷をオフ状態とするか又は保持状態とするかを予め選択設定することができ、制御負荷の性質に応じて最適な対応が可能となる。
【0038】
さらに、この発明によれば、プログラム差し替え処理中にあっては、サイクルタイム監視は自動的に停止されることから、プログラム差し替え処理中に誤ってシステム異常が発生することがなくなる。
また、本発明のプログラマブルロジックコントローラのプログラム差し替え方法は、ユーザプログラムの実行中にプログラム全差し替え条件が成立したとき、現在のユーザプログラムの全体を予め規定された別のユーザプログラムにより差し替えると共に、該差し替えに続いて、差し替え後の新たなユーザプログラムを実行するに際しては、これを運転開始時と同一の条件で起動することを特徴とするものである。
【0039】
【発明の実施の形態】
以下に、本発明に係るプログラマブルロジックコントローラの実施の一形態を添付図面に従って詳細に説明する。
【0040】
図1は本発明に係るPLC全体のハードウェア構成を示すブロック図、図2は本発明PLCの通常時処理を示すフローチャート、図3は本発明PLCのプログラム差し替え時処理を示すフローチャート、図4は本発明PLCの監視タイマ処理のフローチャート、図5は本発明PLCのユーザプログラム構成を示すラダー図である。
【0041】
まず、図1を参照して、本発明の一実施形態に係るPLC全体のハードウェア構成を説明する。
【0042】
同図に示されるように、このPLC1は、CPU101と、I/Oメモリ102と、ユーザプログラムメモリ103と、システムプログラムメモリ104と、パラメータメモリ105と、ワークメモリ106と、I/Oインタフェース107と、入出力装置108と、インタフェース(物理的にはコネクタに相当する)109と、フラッシュメモリカード110とを備えている。
【0043】
CPU101はマイクロプロセッサを主体として構成されており、システムプログラムメモリ104に格納された各種のシステムプログラムを実行することにより、PLCとしての各種の機能を実現する。代表的な機能としては、当業者によく知られているように、ユーザプログラム実行処理、I/Oリフレッシュ処理、周辺サービス処理などである。
【0044】
I/Oメモリ102は、ユーザプログラムの実行に必要な入力データ並びにユーザプログラムの実行結果である出力データなどを格納するものであり、書き換え可能なRAMで構成されている。
【0045】
ユーザプログラムメモリ103は、ユーザ側の制御仕様に対応するユーザプログラムを格納するものであり、記憶媒体としては、プログラムの全差し替えを容易とするために、実装状態において書き換えが容易なフラッシュメモリ(FROM)が採用されている。
【0046】
システムプログラムメモリ104はPLC本来の機能を実現するための各種のシステムプログラムを格納するものであり、その記憶媒体としては、EEPROMやFROM等の不揮発性メモリが採用されている。
【0047】
パラメータメモリ105は、ユーザプログラム並びにシステムプログラムの実行に際して必要な各種のパラメータを記憶するものである。
【0048】
ワークメモリ106は、CPU101における演算の際における途中結果の格納領域などとして使用される。
【0049】
入出力装置108は、外部入出力機器(リレー、スイッチなど)に接続されるものであり、この例ではプログラム全差し替え指示手段を構成するスイッチSW1が接続されている。
【0050】
インタフェース109は、PLCの図示しないハウジングに設けられたカードスロットに内蔵されたものであり、このインタフェース109には外部記憶媒体であるフラッシュメモリカード110が着脱可能に装着される。フラッシュメモリカード110には、差し替え用のユーザプログラムが予め記憶されている。フラッシュメモリカード110に対する差し替え用プログラムの書き込みは、例えばメーカーサイドあるいはベンダーサイドで行うことができる。つまり、PLCのユーザは、メーカーやベンダーから提供されたフラッシュメモリカード110をカードスロットを介してインタフェース109に装着した後、スイッチSW1をオンさせるだけで、ユーザプログラムの運転中における全差し替え動作を自動的に行なうことができる。
【0051】
次に、本発明PLCの通常時処理を示すフローチャートが図2に示されている。同図に示されるように、電源投入(Power on)により処理が開始されると、先ほど説明した従来例と同様にして、電源ON時処理(ステップ201)並びにI/Oメモリクリア処理(ステップ202)が実行され、その後運転開始時処理(ステップ203)において、1サイクルONフラグ(F1)がセット(オン)される。
【0052】
その後、先に説明した従来例と同様に、監視時間に設定値(例えば数10ms)をセットした後(ステップ204)、後述するプログラム差し替え開始フラグ(F2)がOFFであることを条件として(ステップ205YES)、ユーザプログラム実行処理(ステップ206,207)、I/Oリフレッシュ処理(ステップ208)、周辺サービス処理(ステップ209)を順次に実行する。このとき、ユーザプログラム実行処理(ステップ207)の最後では、先に説明した1サイクルONフラグ(F1)をリセット(オフ)する。
【0053】
すなわち、電源投入後、最初のユーザプログラム一巡実行処理に先だって、1サイクルONフラグ(F1)を運転開始時処理でオンすると共に(ステップ203)、ユーザプログラムの一巡実行処理を、次のユーザプログラム一巡実行処理に先だって、前記1サイクルONフラグ(F1)をオフすることにより(ステップ207)、最初のユーザプログラム一巡実行処理の場合に限り、1サイクルONフラグ(F1)がオン状態となるようにしている。その後、2回目以降の一巡実行処理に際しては、以上の処理(ステップ204〜209)が繰り返される。
【0054】
ユーザプログラム全差し替え処理を含む本発明PLCのユーザプログラム構成の一例を示すラダー図が図5に示されている。
【0055】
同図に示されるように、このユーザプログラムには、ユーザプログラム初期値設定処理(PR1)と、本体部分であるユーザプログラム(PR4)と、プログラム差し替え指示用の特定出力命令OP1と、負荷クリア指定用の特定出力命令OP2が含まれている。
【0056】
又、従来例と同様にして、ユーザプログラム初期値設定処理(PR1)は、1サイクルONフラグ(F1)を起動条件として実行される。
【0057】
又、プログラム差し替え開始フラグ(F2)をオンさせるための特定出力命令(OP1)と、負荷クリア指定フラグ(F3)をオンさせるための特定出力命令(OP2)についても、外部スイッチSW1を起動条件として実行される。
【0058】
図5のユーザプログラムを前提として、図2のフローチャートにおけるユーザプログラム実行処理(ステップ207)を説明すると、先に説明したように、1サイクルONフラグ(F1)は最初のユーザプログラム一巡実行処理の場合に限り、オン状態となるため、ユーザプログラム初期値設定処理(PR1)は、所望のタイミングで1回に限り実行される。
【0059】
又、入出力装置108に接続されたプログラム差し替え用外部スイッチSW1がオンされると、プログラム差し替え開始フラグ(F2)並びに負荷クリア指定フラグ(F3)はセット(オン)される。
【0060】
すると、図2のフローチャートにおいて、プログラム差し替えフラグ(F2)がOFF→ONと判定され(ステップ205YES)、図3に示すプログラム差し替え時の処理が開始される。
【0061】
図3において処理が開始されると、サイクルタイム監視用のタイマには、監視時間として数10ms(システムで規定された最大値)がセットされる(ステップ301)。これは、監視時間を最大値にセットすることにより、実質的にサイクルタイムの監視を停止したことに相当する。
【0062】
その後、負荷クリア指定フラグ(F3)の状態を判定する(ステップ302)。ここで、負荷クリア指定フラグ(F3)がセット状態であれば、負荷クリア指定有りと判定されて(ステップ302YES)、I/Oメモリクリア処理が実行される(ステップ303)。これにより、入出力装置108の負荷はすべてオフされる。
【0063】
これに対して、負荷クリア指定フラグ(F3)がリセット状態であれば、負荷クリア指定無しと判定されて(ステップ302NO)、I/Oメモリクリア処理(ステップ303)はスキップされる。
【0064】
従って、ユーザプログラム中で、負荷クリア指定フラグ(F3)の操作のたのめの特定出力命令(OP2)を記述するか否かにより、ユーザプログラムの全差し替え時に、負荷の状態をオフ状態とするかそれまでの状態に維持するかを選択的にユーザは設定することができる。
【0065】
その後、従来例と同様にして、プログラム差し替え処理(ステップ304)、I/Oリフレッシュ処理(ステップ305)、周辺サービス処理(ステップ306)がタイムスライスで時分割的に実行され、その間監視時間はシステムの最大値に毎サイクルの先頭でセットされる(ステップ308)。
【0066】
従って、プログラム差し替え処理中に、誤ってシステム異常が発生することはなくなる。
【0067】
その後、プログラム差し替え処理が完了すると(ステップ307YES)、図2のフローチャートに戻って、電源投入直後と同様にして、運転開始時処理(ステップ203)が実行される。ここで重要な点は、図6に示した従来例においては、プログラム差し替え処理が完了後、運転開始時処理(ステップ603)ではなくて、監視時間設定処理(ステップ604)へと処理が移行するのに対し、本発明にあっては、電源投入時と同様に、運転開始時処理(ステップ203)が再度実行されるのである。
【0068】
その結果、本発明にあっては、差し替え後のユーザプログラムの起動に際しては、最初のユーザプログラム一巡実行処理に先立って、1サイクルオンフラグは再度オンされることとなり、図5に示されるユーザプログラムの先頭に記述されたユーザプログラム初期値設定処理(PR1)を適切に実行れる。
【0069】
そのため、従来のプログラム差し替え命令(FILP)では、仮にユーザプログラムの先頭に記述したとしても、差し替え後のユーザプログラムに含まれるユーザプログラム初期値設定処理(PR1)を実行させることができなかったのに対し、本発明にあっては、差し替え後のユーザプログラムの先頭に記述されたユーザプログラム初期値設定処理(PR1)を1サイクルONフラグ(F1)の状態変化に応じて、最初の一巡実行サイクルに限り、適切に実行させることができるのである。
【0070】
尚、図4に示されるように、ステップ(301,308,204)でセットされた監視時間は、本発明にあっても、10μmsec毎の割り込みに応答して、減算されていき(ステップ401)、その減算結果がゼロになると共に(ステップ402YES)、システム異常処理が実行される(ステップ403)。しかし、ここで言うシステム異常処理(ステップ403)は、システムで規定された最大時間にわたって監視時間再設定が行われなかったということで、本来のサイクル異常とは意味合いの違ったものとなる。
【0071】
以上の実施形態によれば、PLCのオペレータは、フラッシュメモリカード110に格納された差し替え用のユーザプログラムを、装置本体ハウジングのカードスロットに装着して、インタフェース109で内部バスと接続させ、その状態で外部スイッチSW1をオンさせさえすれば、図2並びに図3に示されるシステムプログラムの実行により、フラッシュメモリカード110に格納された差し替え用ユーザプログラムは、ユーザプログラムメモリ103へと転送されて、それまでのユーザプログラムと全差し替えが行われる。その後、差し替え完了後のユーザプログラムの起動に際しては、電源投入時と同様にして、運転開始時処理(ステップ203)が再度実行されることから、ユーザプログラムの先頭部分に、1サイクルONフラグ(F1)を起動条件として、ユーザプログラム初期値設定処理(PR1)が記述されていたとすれば、このユーザプログラム初期値設定処理(PR1)を適切に1サイクル実行させることができる。
【0072】
そのため、従来の部分差し替えが可能なPLCとは異なり、本発明にあっては、ユーザプログラムの全体を運転中に自動的に全差し替えすることができ、しかも全差し替え後のユーザプログラムを適切に起動させることができる。
【0073】
又、以上の実施形態においては、差し替え対象となるユーザプログラムそれ自体の中に、図5に示されるように、プログラム差し替え元ファイル名を記述できるため、メーカー乃至ベンダー側においては、単にフラッシュメモリカード110に差し替え用ユーザプログラムを格納し、これをユーザに手渡すだけで、ユーザ側の単純な操作を通して、誤りなく現在のユーザプログラムの全体を差し替え用ユーザプログラムの内容で置き換えることができる。つまり、ユーザ側における誤操作のおそれを可及的に回避することができる。
【0074】
又、ユーザプログラム中において、負荷クリア指定フラグ(F3)操作用の特定出力命令(OP2)を記述しておけば、プログラムの全差し替えに際して、負荷の状態をオフ状態とするかそれまでの状態に保持するかを任意に選択することでき、制御対象負荷の性質に応じた最適な対応が可能となる。
【0075】
さらに、以上の実施形態においては、ユーザプログラムの差し替え処理に先立って、サイクルタイム監視用のタイマに関する監視時間は、自動的に当該システムに規定された最大値(数10s)に設定されて、実質的にサイクルタイムの監視が停止されるため、プログラム差し替え動作中に長時間監視時間設定処理がとどまる状態が生じたとしても、誤ってシステム異常が発生することがなくなり、従来のようにプログラム差し替えに先立って、手動操作でメンテナンスツールなどを利用して、監視時間を書き換えるといった煩雑さもなくなり、その分使い勝手が向上する。
【0076】
尚、以上の実施形態では、プログラム差し替え用の命令語を定義するのではなく、プログラム差し替えフラグ(F2)をオンさせるための特定出力命令(OP1)を定義したが、これは従来と同様に、専用のプログラム差し替え用命令を定義しても良いことは勿論である。もっとも、このようにプログラム差し替え開始フラグ(F2)とそれをオンするための特定出力命令(OP1)とを分離すれば、メンテナンスツールを利用して、プログラム差し替え開始フラグ(F2)を操作することによっても、プログラム差し替え動作を開始させることができるという利点がある。
【0077】
又、以上の実施形態では、差し替え用のユーザプログラムを外部記憶媒体であるフラッシュメモリカード110に格納したが、それとは別に、PLC1内にファイルメモリを設け、このファイルメモリに格納された差し替え用のユーザプログラムを、所定の起動条件に基づいて、ユーザプログラムメモリ103へと転送し、ユーザプログラムの全差し替えを行うように構成しても良いことは勿論である。
【0078】
又、以上の実施の形態では、実質的にサイクルタイムの監視を停止するために、システムの最大値を監視時間にセットするようにしたが、これに代えて、別途サイクルタイム監視タイマの出力をマスクしても良いことは勿論である。
【0079】
【発明の効果】
以上の説明で明らかなように、この発明によれば、運転中におけるユーザプログラムの全差し替えが可能なPLCを提供することができる。
【図面の簡単な説明】
【図1】PLC全体のハードウェア構成を示すブロック図。
【図2】本発明PLCの通常時処理を示すフローチャート。
【図3】本発明PLCのプログラム差し替え時処理を示すフローチャート。
【図4】本発明PLCの監視タイマ処理のフローチャート。
【図5】本発明PLCのユーザプログラム構成を示すラダー図。
【図6】従来PLCの通常時処理を示すフローチャート。
【図7】従来PLCのプログラム差し替え時処理を示すフローチャート。
【図8】従来PLCの監視タイマ処理のフローチャート。
【図9】従来PLCのユーザプログラム構成を示すラダー図。
【符号の説明】
1 PLC
101 CPU
102 I/Oメモリ
103 ユーザプログラムメモリ
104 システムプログラムメモリ
105 パラメータメモリ
106 ワークメモリ
107 I/Oインターフェイス
108 入出力装置
109 インタフェース
110 外部記憶媒体であるフラッシュメモリカード
SW1 プログラム差し替え用外部スイッチ
F1 1サイクルONフラグ
F2 プログラム差し替え開始フラグ
F3 負荷クリア指定フラグ
PR1 ユーザプログラム初期値設定処理
PR2,PR3,PR4 ユーザプログラム
FILP プログラム差し替え命令
OP1 プログラム差し替え開始フラグ操作用の特定出力命令
OP2 負荷クリア指定フラグ操作用の特定出力命令
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a programmable logic controller capable of replacing a user program during operation, and in particular, enables all replacement of a user program and can start the user program after replacement under the same conditions as when the power is turned on. The present invention relates to a programmable logic controller.
[0002]
[Prior art]
Several examples are known as programmable logic controllers (hereinafter referred to as PLCs) that can replace user programs during operation. Such a PLC configuration is described with reference to FIGS.
[0003]
That is, FIG. 6 is a flowchart showing a normal PLC normal process, FIG. 7 is a flowchart showing a conventional PLC program replacement process, FIG. 8 is a flowchart of a conventional PLC monitoring timer process, and FIG. 9 is a conventional PLC user program configuration. FIG.
[0004]
As shown in FIG. 6, when the process is started by turning on the power (Power on), first, the process when the power is turned on is executed (step 601). In the power-on process (step 601), various processes required when the power is turned on, such as self-diagnosis, are executed.
[0005]
In the subsequent I / O memory clear process (step 602), all the contents (input data, output data, various flags, counters, etc.) of an I / O memory not shown are cleared (step 602).
[0006]
In subsequent operation start processing (step 603), various flags and registers on the system necessary for the start of operation are initialized, and a 1-cycle ON flag (F1) described later is set (ON).
[0007]
Thereafter, after setting a set value (for example, several tens of milliseconds) as the monitoring time of the cycle time (step 604), the user program execution process is started.
[0008]
A ladder program diagram of FIG. 9 shows a user program configuration of a conventional PLC including a user program partial replacement instruction. As shown in the figure, this user program includes a user program initial value setting process (PR1), a fixed part user program (PR2), a program replacement instruction (FILP) with a replacement source file name, and replacement The target part includes a user program (PR3) and an end command (END) indicating the end of the user program.
[0009]
What is important here is that the user program initial value setting process (PR1) described at the top of the user program is executed using the 1 cycle ON flag (F1) at the start of operation described above as a start condition. . As will be described later, the one-cycle ON flag (F1) is turned on only in one cycle of the user program.
[0010]
In this example, the program replacement instruction (FILP) is executed using the external switch (SW1) connected to the input / output device as a start condition.
[0011]
When a user program including such a program replacement instruction (FILP) is executed, the user program initial value is set by turning on the 1-cycle ON flag (F1) in the first round of user program execution processing after the power is turned on. The process (PR1) is executed, and thereafter the fixed part user program (PR2) and the replacement target part user program (PR3) are repeatedly executed. In this state, when the external switch (SW1) is turned on, the program replacement instruction (FILP) is executed. As a result, the replacement target portion sandwiched between the program replacement instruction (FILP) and the end instruction (END) A certain user program (PR3) is automatically replaced with a user program (not shown) designated by the replacement source file name attached to the program replacement instruction (FILP).
[0012]
Returning to FIG. 6, the process during this time will be described in detail. First, after setting a set value for the monitoring time (step 604), the user program counter is set at the head of the program (step 605), and then the value of the program counter is set. While stepping (step 609), each command is sequentially read from a user program (not shown) and decoded and executed (step 606).
[0013]
As described above, in the first user program round execution process after the power is turned on, the 1-cycle ON flag is set in the operation start process (step 603), so the user program initial value setting process (PR1) Is executed (see FIG. 9).
[0014]
Thereafter, the user program (PR2, PR3) following the user program initial value setting process (PR1) is sequentially executed (step 606), and when it is determined as the final instruction by decoding and executing the END instruction (YES in step 608). The one-cycle ON flag (F1) is reset (turned off) (step 610).
[0015]
Thereafter, after passing through the known I / O refresh process (step 611) and the peripheral service process (step 612), the above processes (steps 604 to 612) are repeated.
[0016]
In contrast, if a program replacement instruction (FILP) is executed during execution of the user program (YES in step 607), the program replacement processing shown in FIG. 7 is executed.
[0017]
In the program replacement process shown in FIG. 7, after setting a set value (several tens of ms) to the monitoring time (step 701), the program replacement process (based on the replacement source file name attached to the program replacement instruction (FILP)) ( Step 702) is executed. This program replacement process (step 702) is performed in a time-division manner divided into several times while executing the I / O refresh process (step 703) and the peripheral service process (step 704). Meanwhile, the set value is reset to the monitoring time each time a series of processes including the program replacement process (step 702), the I / O refresh process (step 703), and the peripheral service process (step 704) are started (step 706). ).
[0018]
When the program replacement process is completed in this way (step 705 YES), the process returns to the flowchart of FIG. 6 again, and the execution of the user program is started from the top of the user program.
[0019]
What is important here is that in the subsequent user program round execution process, the process at the start of operation (step 603) is skipped, so that the one-cycle ON flag is maintained in the reset state (off state). Therefore, even if the replacement of the user program is completed, the user program initial value setting process (PR1) is not executed when the user program is started. Such a control procedure is adopted because the conventional program replacement instruction (FILP) is not intended to replace the entire program, but is a user program sandwiched between the program replacement instruction (FILP) and the end instruction (END). This is because partial replacement is intended only for (PR3).
[0020]
As shown in FIG. 8, the monitoring time set in steps 604, 701, and 706 is sequentially subtracted by interruption in units of 10 μsec (step 801), and when the subtraction result becomes zero or less than zero. (YES in step 802), system abnormality processing is executed (step 803).
[0021]
[Problems to be solved by the invention]
However, in the conventional PLC that enables the user program replacement process during operation, after turning on the power, the 1-cycle ON flag is turned on prior to the first round of user program execution (step 603). After the user program round execution process, by turning off the one cycle ON flag before the next user program round execution process (step 610), only in the case of the first user program round execution process, one cycle is ON. Since the flag (F1) is configured to be in the ON state, even if a program replacement instruction (FILP) is inserted at the head of the user program in order to completely replace the user program, a user program initial value setting process (PR1) Can not be executed, after all, the entire program A problem that can not be carried out replacement and it has been pointed out.
[0022]
Furthermore, since the monitoring time for cycle time monitoring does not change during normal user program execution processing or user program replacement processing, it is necessary to replace the program in order to avoid erroneous system abnormalities during user program replacement processing. Prior to processing, it is necessary to make adjustments such as extending the monitoring time or stopping the monitoring process via a support tool or the like, and it has been pointed out that the usability is poor.
[0023]
The present invention has been made paying attention to such conventional problems, and an object of the present invention is to provide a programmable logic controller that can replace all user programs during operation.
[0024]
Another object of the present invention is to provide a programmable logic controller capable of setting the load state to either the off state or the previous state when the user program is completely replaced during operation. .
[0025]
Furthermore, another object of the present invention is to provide a programmable logic controller with good usability that eliminates the need to change the cycle time monitoring time prior to the start of the program replacement process.
[0026]
The programmable logic controller of the present invention, after turning on the power, turns on the 1-cycle on flag prior to the first round of user program execution processing, and before the round trip execution processing of the user program and the next round of user program execution, By turning off the 1-cycle on flag, only in the case of the first round of user program execution processing, Available in user program It is assumed that the 1-cycle on flag is turned on.
[0027]
In addition to the above premise, the programmable logic controller of the present invention newly includes a replacement program storage means, a full program replacement execution means, and a one-cycle on flag forcible operation means.
[0028]
The replacement program storage means stores a replacement user program in advance. In a preferred embodiment, the replacement program storage means can be composed of a removable external storage medium. For example, a flash memory card can be used as the external storage medium. The user program for replacement can be prepared on the manufacturer side or the vendor side, for example.
[0029]
The program total replacement execution unit replaces the entire current user program with the user program stored in the replacement user program storage unit when the replacement of the entire user program is instructed by the program total replacement instruction unit.
[0030]
In a preferred embodiment, the instruction means for instructing rewriting of the entire program includes a specific output instruction with a replacement source file name designation usable on the user program, and a predetermined program in response to decoding of the specific instruction. Flag operation means for turning on the replacement start flag. In a preferred embodiment, when the program replacement start flag is turned on, the program replacement execution means outputs the entire current user program to the specific output instruction among the user programs stored in the replacement program storage means. It is possible to include a process of replacing with a specified replacement user program using the attached replacement file name.
[0031]
The one-cycle on flag forcible operation means forcibly sets the one-cycle on flag before the first one-round execution process of the user program after the replacement after the complete replacement of the user program is completed by the program total replacement execution means. on In addition, after the one-round execution processing of the user program, the one-cycle on flag is turned off before the next round of user program execution processing. Let
[0032]
In the further preferred embodiment of the programmable logic controller described above, a series of processes including a user program round execution process, an I / O refresh process, and a peripheral service process are repeatedly executed in a normal state, and a user is replaced when a program is replaced. After shifting from the middle of the program round execution process to the program replacement process, a series of processes including the program replacement process, the I / O refresh process, and the peripheral service process are repeatedly executed, and the user program execution process When a user program is started, a predetermined monitoring time is set to a predetermined monitoring timer at the start of each round of the user program, and an abnormality is recognized when the timer expires during execution of the series of processes. Assumes it is configured .
[0033]
Under the above premise, in this programmable logic controller, when starting the program replacement process due to the specific output instruction being decoded during the execution of the user program, until the program replacement process is completed, The monitoring of the cycle time by the monitoring timer can be stopped.
[0034]
Further, in a further preferred embodiment of the programmable logic controller described above, the replacement-time I / O memory for instructing whether to clear or save the contents of the I / O memory prior to starting the program replacement process A replacement state I / O memory state determination unit that determines a state of the I / O memory at the time of program replacement according to the instruction content of the replacement time I / O memory state instruction unit can be provided. .
[0035]
In a further preferred embodiment of the programmable logic controller described above, the replacement I / O memory state instruction means clears a predetermined load in response to a specific output instruction usable on the user program and decoding of the specific output instruction. And a flag operation means for turning on the designation flag, and the I / O memory state determination means at the time of replacement, when the load clear designation flag is turned on, before starting the program replacement process, A process for determining whether to clear or save the contents can be included.
[0036]
Then, according to the present invention described above, the 1-cycle on flag is forcibly turned on after the completion of the replacement of the user program and prior to the first round execution process of the user program after the replacement. When starting a new user program after completion of replacement, the user program initial value setting process, which is usually described with a one-cycle on flag at the beginning of the user program, is executed only for the first round execution process. The user program can be handled in the same manner as immediately after the power is turned on, even during operation.
[0037]
Further, according to the present invention, it is possible to select and set in advance whether the load is to be turned off or to be held in the program replacement process, and an optimum response can be made according to the nature of the control load.
[0038]
Further, according to the present invention, since the cycle time monitoring is automatically stopped during the program replacement process, no system abnormality is erroneously generated during the program replacement process.
The programmable logic controller program replacement method of the present invention replaces the entire current user program with another predefined user program when the program total replacement condition is satisfied during execution of the user program. Subsequently, when the new user program after replacement is executed, it is activated under the same conditions as when the operation was started.
[0039]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, an embodiment of a programmable logic controller according to the present invention will be described in detail with reference to the accompanying drawings.
[0040]
FIG. 1 is a block diagram showing the hardware configuration of the entire PLC according to the present invention, FIG. 2 is a flowchart showing normal processing of the PLC of the present invention, FIG. 3 is a flowchart showing program replacement processing of the PLC of the present invention, and FIG. FIG. 5 is a ladder diagram showing a user program configuration of the PLC of the present invention.
[0041]
First, a hardware configuration of the entire PLC according to an embodiment of the present invention will be described with reference to FIG.
[0042]
As shown in the figure, the PLC 1 includes a CPU 101, an I / O memory 102, a user program memory 103, a system program memory 104, a parameter memory 105, a work memory 106, and an I / O interface 107. , An input / output device 108, an interface (physically equivalent to a connector) 109, and a flash memory card 110.
[0043]
The CPU 101 is mainly composed of a microprocessor, and implements various functions as a PLC by executing various system programs stored in the system program memory 104. Typical functions include user program execution processing, I / O refresh processing, peripheral service processing, and the like, as is well known to those skilled in the art.
[0044]
The I / O memory 102 stores input data necessary for executing the user program, output data that is the execution result of the user program, and the like, and is configured by a rewritable RAM.
[0045]
The user program memory 103 stores user programs corresponding to user-side control specifications. As a storage medium, a flash memory (FROM) that can be easily rewritten in the mounted state in order to facilitate replacement of all programs. ) Is adopted.
[0046]
The system program memory 104 stores various system programs for realizing the original functions of the PLC, and a nonvolatile memory such as EEPROM or FROM is adopted as the storage medium.
[0047]
The parameter memory 105 stores various parameters necessary for executing the user program and the system program.
[0048]
The work memory 106 is used as a storage area for intermediate results during calculation in the CPU 101.
[0049]
The input / output device 108 is connected to an external input / output device (relay, switch, etc.). In this example, a switch SW1 that constitutes a program total replacement instruction unit is connected.
[0050]
The interface 109 is built in a card slot provided in a housing (not shown) of the PLC, and a flash memory card 110 as an external storage medium is detachably attached to the interface 109. The flash memory card 110 stores a user program for replacement in advance. The replacement program can be written to the flash memory card 110 on the manufacturer side or the vendor side, for example. In other words, the PLC user automatically installs the flash memory card 110 provided by the manufacturer or vendor to the interface 109 via the card slot and then turns on the switch SW1 to automatically perform all replacement operations during the operation of the user program. Can be done automatically.
[0051]
Next, FIG. 2 shows a flowchart showing normal processing of the PLC of the present invention. As shown in the figure, when the processing is started by turning on the power (Power on), the power-on processing (Step 201) and the I / O memory clear processing (Step 202) are performed in the same manner as the conventional example described above. ) Is then executed, and then the one-cycle ON flag (F1) is set (turned on) in the operation start process (step 203).
[0052]
After that, as in the conventional example described above, after setting a set value (for example, several tens of ms) for the monitoring time (step 204), on condition that a program replacement start flag (F2), which will be described later, is OFF (step) 205 YES), user program execution processing (steps 206 and 207), I / O refresh processing (step 208), and peripheral service processing (step 209) are sequentially executed. At this time, at the end of the user program execution process (step 207), the 1-cycle ON flag (F1) described above is reset (turned off).
[0053]
That is, after the power is turned on, prior to the first round of user program execution processing, the 1-cycle ON flag (F1) is turned on at the start of operation processing (step 203), and the round-up execution processing of the user program is changed to the next round of user program Prior to the execution process, the 1-cycle ON flag (F1) is turned off (step 207) so that the 1-cycle ON flag (F1) is turned on only in the case of the first round of user program execution processing. Yes. Thereafter, the above processing (steps 204 to 209) is repeated in the second and subsequent round execution processing.
[0054]
FIG. 5 shows a ladder diagram showing an example of the user program configuration of the PLC of the present invention including the user program total replacement process.
[0055]
As shown in the figure, the user program includes a user program initial value setting process (PR1), a main body user program (PR4), a program output instruction specific output instruction OP1, and a load clear designation. Specific output instruction OP2 is included.
[0056]
Similarly to the conventional example, the user program initial value setting process (PR1) is executed using the one-cycle ON flag (F1) as a starting condition.
[0057]
Also, for the specific output instruction (OP1) for turning on the program replacement start flag (F2) and the specific output instruction (OP2) for turning on the load clear designation flag (F3), the external switch SW1 is used as a start condition. Executed.
[0058]
The user program execution process (step 207) in the flowchart of FIG. 2 will be described on the assumption of the user program of FIG. 5. As described above, the 1-cycle ON flag (F1) is the case of the first user program round execution process. The user program initial value setting process (PR1) is executed only once at a desired timing.
[0059]
When the program replacement external switch SW1 connected to the input / output device 108 is turned on, the program replacement start flag (F2) and the load clear designation flag (F3) are set (turned on).
[0060]
Then, in the flowchart of FIG. 2, it is determined that the program replacement flag (F2) is OFF → ON (step 205 YES), and the processing at the time of program replacement shown in FIG. 3 is started.
[0061]
When the processing is started in FIG. 3, a monitoring time is set to several tens of ms (maximum value defined by the system) in the cycle time monitoring timer (step 301). This is equivalent to substantially stopping the monitoring of the cycle time by setting the monitoring time to the maximum value.
[0062]
Thereafter, the state of the load clear designation flag (F3) is determined (step 302). Here, if the load clear designation flag (F3) is in the set state, it is determined that there is a load clear designation (YES in step 302), and an I / O memory clear process is executed (step 303). Thereby, all the loads of the input / output device 108 are turned off.
[0063]
In contrast, if the load clear designation flag (F3) is in the reset state, it is determined that there is no load clear designation (NO in step 302), and the I / O memory clear process (step 303) is skipped.
[0064]
Therefore, depending on whether or not a specific output instruction (OP2) for the operation of the load clear designation flag (F3) is described in the user program, the load state is turned off when the user program is completely replaced. The user can selectively set whether to maintain the above state.
[0065]
Thereafter, similar to the conventional example, the program replacement process (step 304), the I / O refresh process (step 305), and the peripheral service process (step 306) are executed in a time-sharing manner in a time slice, during which the monitoring time is Is set at the beginning of every cycle (step 308).
[0066]
Therefore, no system abnormality occurs erroneously during the program replacement process.
[0067]
Thereafter, when the program replacement process is completed (YES in step 307), the process returns to the flowchart in FIG. 2 and the operation start process (step 203) is executed in the same manner as immediately after the power is turned on. The important point here is that, in the conventional example shown in FIG. 6, after the program replacement process is completed, the process shifts to the monitoring time setting process (step 604) instead of the operation start process (step 603). On the other hand, in the present invention, the operation start time process (step 203) is executed again in the same manner as when the power is turned on.
[0068]
As a result, in the present invention, when the user program after replacement is started, the 1-cycle on flag is turned on again before the first round of user program execution processing, and the user program shown in FIG. The user program initial value setting process (PR1) described at the beginning of the program can be appropriately executed.
[0069]
Therefore, even if the conventional program replacement instruction (FILP) is described at the top of the user program, the user program initial value setting process (PR1) included in the replaced user program cannot be executed. On the other hand, in the present invention, the user program initial value setting process (PR1) described at the head of the replaced user program is changed to the first round execution cycle in accordance with the state change of the 1-cycle ON flag (F1). As long as it can be executed properly.
[0070]
As shown in FIG. 4, the monitoring time set in step (301, 308, 204) is subtracted in response to an interrupt every 10 μmsec (step 401) even in the present invention. The subtraction result becomes zero (step 402 YES), and system abnormality processing is executed (step 403). However, the system abnormality processing (step 403) mentioned here has a different meaning from the original cycle abnormality because the monitoring time is not reset for the maximum time defined by the system.
[0071]
According to the embodiment described above, the PLC operator attaches the user program for replacement stored in the flash memory card 110 to the card slot of the apparatus main body housing, connects it to the internal bus through the interface 109, and As long as the external switch SW1 is turned on, the user program for replacement stored in the flash memory card 110 is transferred to the user program memory 103 by executing the system program shown in FIG. 2 and FIG. All user programs are replaced. Thereafter, when starting the user program after completion of the replacement, the operation start time process (step 203) is executed again in the same manner as when the power is turned on, so that the one cycle ON flag (F1) is displayed at the head of the user program. If the user program initial value setting process (PR1) is described using the above as a starting condition, the user program initial value setting process (PR1) can be appropriately executed for one cycle.
[0072]
Therefore, unlike a conventional PLC that can be partially replaced, in the present invention, the entire user program can be automatically replaced during operation, and the user program after the complete replacement can be started appropriately. Can be made.
[0073]
In the above embodiment, since the program replacement source file name can be described in the user program itself to be replaced as shown in FIG. 5, the manufacturer or the vendor simply uses the flash memory card. By simply storing the replacement user program in 110 and handing it over to the user, the entire current user program can be replaced with the contents of the replacement user program without error through a simple operation on the user side. That is, the possibility of erroneous operation on the user side can be avoided as much as possible.
[0074]
In addition, if a specific output instruction (OP2) for operating the load clear designation flag (F3) is described in the user program, the load state is set to the off state or the state until then when the program is completely replaced. It is possible to arbitrarily select whether to hold, and it is possible to optimally cope with the characteristics of the load to be controlled.
[0075]
Further, in the above embodiment, prior to the user program replacement process, the monitoring time related to the cycle time monitoring timer is automatically set to the maximum value (several tens of seconds) defined in the system, Since the monitoring of the cycle time is stopped, even if the long monitoring time setting process stays during the program replacement operation, the system error will not occur by mistake, and the program replacement can be performed as before. Prior to using the maintenance tool or the like manually, the trouble of rewriting the monitoring time is eliminated, and the usability is improved accordingly.
[0076]
In the above embodiment, the program replacement instruction word is not defined, but the specific output instruction (OP1) for turning on the program replacement flag (F2) is defined. Of course, a dedicated program replacement instruction may be defined. However, if the program replacement start flag (F2) and the specific output instruction (OP1) for turning it on are separated in this way, the program replacement start flag (F2) is operated by using a maintenance tool. Also, there is an advantage that the program replacement operation can be started.
[0077]
In the above embodiment, the replacement user program is stored in the flash memory card 110 which is an external storage medium. Separately, a file memory is provided in the PLC 1, and the replacement user program stored in the file memory is provided. It goes without saying that the user program may be transferred to the user program memory 103 based on a predetermined activation condition, and the user program may be completely replaced.
[0078]
In the above embodiment, in order to substantially stop the monitoring of the cycle time, the maximum value of the system is set to the monitoring time. Instead, the output of the cycle time monitoring timer is separately provided. Of course, it may be masked.
[0079]
【The invention's effect】
As apparent from the above description, according to the present invention, it is possible to provide a PLC capable of completely replacing user programs during operation.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a hardware configuration of an entire PLC.
FIG. 2 is a flowchart showing normal processing of the PLC of the present invention.
FIG. 3 is a flowchart showing a program replacement process of the PLC of the present invention.
FIG. 4 is a flowchart of monitoring timer processing of the PLC of the present invention.
FIG. 5 is a ladder diagram showing a user program configuration of the PLC of the present invention.
FIG. 6 is a flowchart showing normal processing of a conventional PLC.
FIG. 7 is a flowchart showing a conventional PLC program replacement process;
FIG. 8 is a flowchart of conventional PLC monitoring timer processing.
FIG. 9 is a ladder diagram showing a user program configuration of a conventional PLC.
[Explanation of symbols]
1 PLC
101 CPU
102 I / O memory
103 User program memory
104 System program memory
105 Parameter memory
106 Work memory
107 I / O interface
108 I / O device
109 interface
110 Flash memory card as an external storage medium
SW1 External switch for program replacement
F1 1 cycle ON flag
F2 Program replacement start flag
F3 Load clear specification flag
PR1 User program initial value setting process
PR2, PR3, PR4 User program
FILP program replacement instruction
OP1 Specific output instruction for program replacement start flag operation
OP2 Specific output instruction for load clear designation flag operation

Claims (4)

電源投入後、最初のユーザプログラム一巡実行処理に先立って、1サイクルオンフラグをオンすると共に、ユーザプログラムの一巡実行処理後、次のユーザプログラム一巡実行処理に先だって、前記1サイクルオンフラグをオフすることにより、ユーザプログラムの最初の一巡実行処理の場合に限り、ユーザプログラム上で使用可能な1サイクルオンフラグがオン状態となるようにしたプログラマブルロジックコントローラにおいて、
差し替え用のユーザプログラムをあらかじめ記憶させた差し替え用プログラム記憶手段と、
ユーザプログラム全体の差し替えが指示されたとき、現在のユーザプログラムの全体を前記差し替え用プログラム記憶手段に記憶されたユーザプログラムにより差し替えるプログラム全差し替え実行手段と、
前記プログラム全差し替え実行手段によりユーザプログラムの全差し替えが完了した後、該差し替え後のユーザプログラムの最初の一巡実行処理に先立って、前記1サイクルオンフラグを強制的にオンすると共に、ユーザプログラムの一巡実行処理後、次のユーザプログラム一巡実行処理に先だって、前記1サイクルオンフラグを強制的にオフさせる1サイクルオンフラグ強制操作手段と、
を具備し、
それにより、差し替え用プログラム記憶手段に記憶される差し替え用のユーザプログラムの先頭に、1サイクルオンフラグ(F1)を起動条件としてユーザプログラム初期値設定処理(PR1)を記述しておくことにより、差し替え用プログラムの起動時においても初期値設定処理が1サイクルに限り実行されるようにした、ことを特徴とするプログラマブルロジックコントローラ。
After the power is turned on, the 1-cycle on flag is turned on prior to the first round of user program execution processing, and the 1-cycle on flag is turned off prior to the next round of user program execution processing after the round-up execution processing of the user program. Thus, in the programmable logic controller in which the 1-cycle on flag that can be used on the user program is turned on only in the case of the first round execution process of the user program ,
Replacement program storage means for storing a user program for replacement in advance;
A program total replacement execution means for replacing the entire current user program with the user program stored in the replacement program storage means when an instruction to replace the entire user program is given;
After the complete replacement of the user program is completed by the program total replacement execution means, the one-cycle on flag is forcibly turned on and the user program is switched once before the first round execution process of the user program after the replacement. A one-cycle on flag forcible operating means for forcibly turning off the one-cycle on flag prior to the next round of user program execution processing after execution processing ;
Comprising
As a result, the user program initial value setting process (PR1) is described using the 1-cycle on flag (F1) as a starting condition at the head of the user program for replacement stored in the replacement program storage means. A programmable logic controller characterized in that an initial value setting process is executed only for one cycle even when a computer program is started .
ユーザプログラムの全差し替えを指示するためのプログラム全差し替え指示手段を有し、該プログラム全差し替え指示手段が、ユーザプログラム上で使用可能な差し替え元ファイル名指定付の特定出力命令と、該特定出力命令の解読に応答して所定のプログラム差し替え開始フラグをオンさせるフラグ操作手段と、を含むと共に、
プログラム差し替え実行手段が、前記プログラム差し替え開始フラグがオンされたとき、現在のユーザプログラムの全体を前記差し替え用プログラム記憶手段に記憶されたユーザプログラムの内で、前記特定出力命令に付された差し替え用ファイル名で指定の差し替え用ユーザプログラムにより差し替える処理を含む、請求項1に記載のプログラマブルロジックコントローラ。
A program total replacement instruction means for instructing the total replacement of the user program, the program total replacement instruction means including a specific output instruction with replacement source file name specification usable on the user program, and the specific output instruction; And a flag operation means for turning on a predetermined program replacement start flag in response to the decryption of
When the program replacement execution flag is turned on, the program replacement execution means replaces the entire current user program with the specific output instruction in the user program stored in the replacement program storage means. The programmable logic controller according to claim 1, comprising a process of replacing with a replacement user program specified by a file name.
通常時には、ユーザプログラム一巡実行処理と、I/Oリフレッシュ処理と、周辺サービス処理とを含む一連の処理を繰り返し実行すると共に、プログラム差し替え時には、ユーザプログラム一巡実行処理の途中からプログラム差し替え処理へと移行した後、プログラム差し替え処理と、I/Oリフレッシュ処理と、周辺サービス処理とを含む一連の処理を繰り返し実行するものであり、かつユーザプログラム実行処理を開始するに際しては、ユーザプログラムの毎一巡実行処理の開始時に所定の監視タイマに既定の監視時間をセットすると共に、前記一連の処理の実行中に監視タイマがタイムアップしたとき、異常と認識するように構成されており、
ユーザプログラムの実行中に特定出力命令が解読されたことにより、プログラム差し替え処理を開始するに際しては、プログラム差し替え処理が完了するまでの間、サイクルタイムの監視を停止するように構成される、
請求項2に記載のプログラマブルロジックコントローラ。
At normal times, a series of processes including a user program round execution process, an I / O refresh process, and a peripheral service process are repeatedly executed, and at the time of program replacement, a transition is made from the middle of the user program round execution process to the program replacement process. Thereafter, a series of processes including a program replacement process, an I / O refresh process, and a peripheral service process are repeatedly executed. A predetermined monitoring time is set to a predetermined monitoring timer at the start of the operation, and when the monitoring timer expires during execution of the series of processes, it is configured to recognize an abnormality.
When starting the program replacement process due to the decoding of the specific output instruction during the execution of the user program, the cycle time monitoring is stopped until the program replacement process is completed.
The programmable logic controller according to claim 2.
プログラム差し替え処理を開始するに先だって、I/Oメモリの内容をクリアするか又は保存するかを指示するための差し替え時I/Oメモリ状態指示手段と、
前記差し替え時I/Oメモリ状態指示手段の指示内容に応じて、プログラム差し替え時におけるI/Oメモリの状態を決定する差し替え時I/Oメモリ状態決定手段と、
を具備する請求項1に記載のプログラマブルロジックコントローラ。
Prior to starting the program replacement process, replacement I / O memory state instruction means for instructing whether to clear or save the contents of the I / O memory;
A replacement I / O memory state determining means for determining the state of the I / O memory at the time of program replacement according to the instruction content of the replacement I / O memory state instruction means;
The programmable logic controller according to claim 1, comprising:
JP30169799A 1999-10-22 1999-10-22 Programmable logic controller Expired - Lifetime JP3659398B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP30169799A JP3659398B2 (en) 1999-10-22 1999-10-22 Programmable logic controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP30169799A JP3659398B2 (en) 1999-10-22 1999-10-22 Programmable logic controller

Publications (2)

Publication Number Publication Date
JP2001125609A JP2001125609A (en) 2001-05-11
JP3659398B2 true JP3659398B2 (en) 2005-06-15

Family

ID=17900072

Family Applications (1)

Application Number Title Priority Date Filing Date
JP30169799A Expired - Lifetime JP3659398B2 (en) 1999-10-22 1999-10-22 Programmable logic controller

Country Status (1)

Country Link
JP (1) JP3659398B2 (en)

Also Published As

Publication number Publication date
JP2001125609A (en) 2001-05-11

Similar Documents

Publication Publication Date Title
US7110837B2 (en) Control system and method for on-line editing of user program
JP4097649B2 (en) Numerical controller
JP3659398B2 (en) Programmable logic controller
US9805153B2 (en) PLD editor and method for editing PLD code
JP4305740B2 (en) Programmable controller system and connection guarantee method
JPH0219902A (en) Programmable controller
JP3207333B2 (en) Programmable controller
JPH09282030A (en) Sequence controller
JPH10283171A (en) Information processor and control method therefor
JPH0332803B2 (en)
JP2005339018A (en) Numerical control device
JP3367197B2 (en) Programmable controller
KR100582750B1 (en) Reprogramming method
JP2006338304A (en) Process controller and program rewriting method for controller
KR20000000888A (en) Memory program changing and reading method
JPH08194507A (en) Programmable controller
JP2958470B2 (en) Sequence controller
JP2001030579A (en) Printer, control method therefor and data recording medium
JP2000099117A (en) Control unit
JPH07287660A (en) Interruption processing method for programmable controller
JPH0685124B2 (en) Programmable controller
JP2001209412A (en) Simulator for sequence program
JPH05224729A (en) Numerical controller containing control program changing function
JPH06139102A (en) Digital control device and its debugging method
JPS58221405A (en) Programmable controller

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20041014

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041018

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20041215

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050309

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 3659398

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20090325

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090325

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100325

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100325

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20110325

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110325

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120325

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120325

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20130325

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20140325

Year of fee payment: 9

EXPY Cancellation because of completion of term