JP4131134B2 - Control device, input circuit thereof, and signal input method of control device - Google Patents

Control device, input circuit thereof, and signal input method of control device Download PDF

Info

Publication number
JP4131134B2
JP4131134B2 JP2002200190A JP2002200190A JP4131134B2 JP 4131134 B2 JP4131134 B2 JP 4131134B2 JP 2002200190 A JP2002200190 A JP 2002200190A JP 2002200190 A JP2002200190 A JP 2002200190A JP 4131134 B2 JP4131134 B2 JP 4131134B2
Authority
JP
Japan
Prior art keywords
signal
diagnosis
self
interval period
pulse
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 - Fee Related
Application number
JP2002200190A
Other languages
Japanese (ja)
Other versions
JP2004046348A (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.)
JTEKT Corp
Original Assignee
JTEKT 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 JTEKT Corp filed Critical JTEKT Corp
Priority to JP2002200190A priority Critical patent/JP4131134B2/en
Publication of JP2004046348A publication Critical patent/JP2004046348A/en
Application granted granted Critical
Publication of JP4131134B2 publication Critical patent/JP4131134B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Programmable Controllers (AREA)
  • Tests Of Electronic Circuits (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、PLC(Programmable Logic controller)等の制御装置、その入力回路及び信号入力方法に関する。
【0002】
【従来の技術】
PLCの入力回路には、セイフティライトカーテンやセイフティエリアセンサなどの安全機器が接続される場合がある。一般に、安全機器の出力信号は、通常時にはオン信号になっており、検出エリアへの進入物を検出したときにオフ信号に切り替わる。つまり、安全機器が作動時に出力する信号は、オン状態からオフ状態に切り替わるステップ信号になっている。そして、このステップ信号を受けたPLCの本体部が所定のシーケンス処理を行い、例えばシステムに非常停止をかける。
【0003】
ところで、近年の安全機器は、定期的に自己診断用のパルス信号を出力している。このパルス信号は、極めて短いパルス幅(例えば、20μsec)のオフ信号であって、このパルス信号を安全機器自身にフィードバックして出力系統に異常なきことを確認している。ここで、受信感度が低いPLCでは、自己診断用のパルス信号は無視されるが、受信感度が高いPLC、特に、安全基準を高水準に設定した所謂安全PLCでは、自己診断用のパルス信号をも検出してしまう。
【0004】
そこで、従来例では、PLCの入力回路に応答時間を遅らせるためのコンデンサやコイルを設けたものが知られている。また、別の従来例としてPLCの入力回路で受信した信号がオフになったことを検出したら、さらに続けて3回検出動作を行い、そのうちの2回以上がオン状態であった場合には受信信号を無視し、そうではなかった場合に受信信号をPLCの本体部に取り込む構成のものが知られている。
【0005】
【発明が解決しようとする課題】
しかしながら、上述した従来のものにおいて、応答時間を遅らせるためのコンデンサやコイルを設けたものでは、安全機器が作動時に出力した信号に対しても応答性が悪くなる。また、安全機器のメーカによって自己診断用パルスの出力仕様が異なるため、3回の検出動作を行うものでは、例えば、パルス幅が大きい1つの自己診断用パルスに3回の検出動作が含まれてしまったり、或いは、連続出力された複数の自己診断パルスに3回の検出動作が重なる事態が生じ得た。このため、従来のものでは、自己診断パルスを作動信号と誤ってPLCの本体部に取り込んでしまうことが考えられた。
【0006】
本発明は、上記事情に鑑みてなされたもので、自己診断用パルス信号を出力する外部機器を接続しても、安定したシーケンス制御を行うことが可能な制御装置、その入力回路及び信号入力方法の提供を目的とする。
【0007】
【課題を解決するための手段】
上記した目的を達成するためになされた請求項1の発明に係る制御装置の信号入力方法は、外部機器から受信した自己診断用のパルス信号と作動時出力用のステップ信号とを選別して、作動時出力用のステップ信号のみを制御装置本体に取り込む制御装置の信号入力方法であって、外部機器からの受信信号が、通常状態に対して反転してからインターバル期間が経過した時点で反転したままか否かを検出し、反転したままであった場合にのみ受信信号を制御装置本体に取り込むと共に、外部機器の仕様に対応させて、自己診断用のパルス信号が発生していない時間帯に検出を行うようにインターバル期間を設定したところに特徴を有する。
【0008】
請求項2の発明に係る制御装置の入力回路は、外部機器から受信した自己診断用のパルス信号と作動時出力用のステップ信号とを選別して、作動時出力用のステップ信号のみを制御装置本体に取り込む制御装置の入力回路であって、外部機器からの受信信号が、通常状態に対して反転したことを検出する第1検出手段と、第1検出手段が反転を検出してからインターバル期間を経過した時点で、受信信号が反転したままか否かを検出する第2検出手段と、第2検出手段の検出結果を受け、受信信号が反転したままであった場合にのみ受信信号を制御装置本体に取り込む信号選別手段とを備え、インターバル期間は、外部機器の仕様に対応させて、自己診断用のパルス信号が発生していない時間帯に第2検出手段の検出が行われるように設定したところに特徴を有する。
【0009】
請求項3の発明に係る制御装置は、外部機器から受信した自己診断用のパルス信号と作動時出力用のステップ信号とを選別して、作動時出力用のステップ信号のみを制御装置本体に取り込む入力回路を備えた制御装置であって、外部機器からの受信信号が、通常状態に対して反転したことを検出する第1検出手段と、第1検出手段が反転を検出してからインターバル期間を経過した時点で、受信信号が反転したままか否かを検出する第2検出手段と、第2検出手段の検出結果を受け、受信信号が反転したままであった場合にのみ受信信号を制御装置本体に取り込む信号選別手段とを備え、インターバル期間は、外部機器の仕様に対応させて、自己診断用のパルス信号が発生していない時間帯に第2検出手段の検出が行われるように設定したところに特徴を有する。
【0010】
請求項4の発明は、請求項3に記載の制御装置において、インターバル期間を更新可能に記憶した記憶手段と、入力操作によりインターバル期間を更新するための入力操作手段を備えたところに特徴を有する。
【0011】
請求項5の発明は、請求項3に記載の制御装置において、インターバル期間を更新可能に記憶した記憶手段と、受信部が受信した信号をサンプリングして、インターバル期間を更新するインターバル期間更新手段とを備えたところに特徴を有する。
【0012】
【発明の作用及び効果】
本発明によれば、制御装置の入力回路が受信した受信信号が反転してから所定のインターバル期間を経過した時点で反転したままであるか否かを検出し、反転したままであった場合にのみ受信信号を制御装置本体に取り込む。ここで、本発明では、インターバル期間を外部機器の仕様に対応させて設定したから、受信信号が自己診断用のパルス信号であった場合には、インターバル期間を経過した時点で、確実に反転状態から元の状態に戻っている。一方、受信信号が作動時出力用のステップ信号であった場合には、インターバル期間を経過した時点でも反転したままになっている。これにより、自己診断用のパルス信号と作動時出力用のステップ信号とを確実に選別することができ、作動時出力用のステップ信号に基づいた安定したシーケンス制御を行うことができる。
【0013】
また、本発明に係るインターバル期間は、入力操作手段を用いた入力操作により更新してもよいし(請求項4の発明)、インターバル期間更新手段により、受信部が受信した信号をサンプリングして更新してもよい(請求項5の発明)。
【0014】
【発明の実施の形態】
<第1実施形態>
以下、本発明の第1実施形態を図1〜図5に基づいて説明する。
本実施形態のPLC10(本発明の「制御装置」に相当する)は、図1に基本構成が示されており、本体部11に入力回路12と出力回路13とキーボード14とを接続してなる。本体部11は、CPU15を主要部として備え、入力回路12から受け取った信号に基づき、メモリ16に記録したシーケンスプログラムをランする。そして、所定のシーケンス処理を行って、出力回路13に接続された図示しない機器を駆動する。
【0015】
また、本実施形態のPLC10はいわゆる安全PLCであって、入力回路12は、以下に説明するPLC診断用パルスを生成可能な構成になっている。即ち、入力回路12には、入力点数に応じて複数の受信回路25が設けられており、それらのうち1つの受信回路25が図1に代表的に示されている。
【0016】
受信回路25は、第1及び第2のフォトカプラ23,24を備えてなり、第1フォトカプラ23のフォトトランジスタ23Aと第2フォトカプラ24のLED24Bとが、直列接続されて外部接続回路29を構成している。詳細には、LED24BのカソードをGND接続する一方、アノードをフォトトランジスタ23Aのエミッタに接続し、さらにフォトトランジスタ23Aのコレクタをオープンにして入力回路12における外部接続端末26としてある。
【0017】
また、第1フォトカプラ23のLED23Bは、常には入力制御回路20によって駆動されており、これにより前記フォトトランジスタ23Aがオンして、外部接続回路29が外部接続端末26からGNDに向かう方向で導通状態になっている。そして、外部接続端末26に接続した外部機器の出力信号に応じて、外部接続回路29の通電状態が変化すると、その通電状態の変化に伴い、第2フォトカプラ24のフォトトランジスタ24Aが開閉する。これによりフォトトランジスタ24Aを接続した入力制御回路20に信号が取り込まれる。
【0018】
入力制御回路20は、外部接続端末26に接続した外部機器からオン信号が常時出力されている場合に、定期的かつ所定期間(例えば20μsec)に亘って第1フォトカプラ23のLED23Bをオフし、これにより受信回路25内にオフ信号としての前記PLC診断用パルスを生成する。そして、このPLC診断用パルス信号を第2フォトカプラ24が検出できるか否かに基づいて入力回路12を自己診断する。
【0019】
本実施形態のPLC10は、前述の如く安全PLCであるので、入力回路12には、本発明の外部機器として、人の安全を確保するために用いられるいわゆる安全装置が接続される。その安全装置の一例として、例えばセイフティライトカーテン30(以下、単に「ライトカーテン30」という)が接続された場合について以下説明する。
【0020】
ライトカーテン30は、投光部31と受光部32とを備え、それら投受光部31,32の間を結ぶ複数の平行な光軸が遮られたときに、検出信号(本発明の「作動信号」に相当する)を出力する。
【0021】
ライトカーテン30の出力回路は、例えばトランジスタ(以下、「出力トランジスタ」という)のオープンコレクタ回路となっており、そのコレクタに例えば24V電源が接続されかつエミッタにPLC10の前記外部接続端末26が接続される。また、前記出力トランジスタは常にはオンしており、これによりライトカーテン30が作動していないときに外部接続端末26に入力される信号の電圧は、24Vに保持されている。そして、ライトカーテン30が作動したとき、出力トランジスタがオフし、外部接続端末26に入力される信号の電圧が0Vになる。即ち、ライトカーテン30が作動時に出力する信号は、図2(A)に示すように、電位24Vのオン状態から電位0Vのオフ状態を切り替わるステップ信号になっている。
【0022】
ところで、ライトカーテン30は、自己診断用のパルス信号を定期的に出力しており、そのパルス信号をライトカーテン30自身にフィードバックして自己診断を行っている。自己診断用のパルス信号は、ライトカーテン30の前記出力トランジスタを、定期的に所定期間(例えば約25μsec)に亘ってオフすることで生成される。即ち、ライトカーテン30が自己診断時に出力する信号は、図2(B)に示すようにパルス幅が約25μsecのオフパルス信号となっている。
【0023】
入力制御回路20は、CPU21、ROM22、EEPROM27及び図示しないRAMを備えており、ROM22に記憶された信号選別プログラムをランして、前述した自己診断用のパルス信号と作動時出力用のステップ信号とを選別することができる。詳細には、例えば、受信回路25による受信信号が、オン状態(通常状態)からオフ状態に反転したときの割込処理として、図3に示した信号選別プログラムPR1の実行が割り当てられている。
【0024】
受信信号の前記反転が検出されて信号選別プログラムPR1が実行されると、図3に示すように、カウンタKが0にリセットされてから(S1)、そのカウンタKを1ずつインクリメントするループに入り(S2、S3)、カウンタKが所定の上限値K1になるまで前記インクリメントが繰り返される。
そして、カウンタKが上限値K1に達して(S3でYes)、ループを抜けた時点で、受信信号がオフ状態か否か、即ち、反転したままか否かが再検出される(S4)。そして、受信信号が反転したまま(オフ状態のまま)の場合には(S5でYes)、その受信信号を本体部11に適したレベルの信号に変換して本体部11に出力する(S6)。一方、受信信号がオンに戻っていた場合には(S5でNo)、受信信号を無視し、本体部11には何も信号を出力しない。
【0025】
以上を纏めると、信号選別プログラムPR1では、受信回路25の受信信号がオン状態からオフ状態に反転したことを検出してから、カウンタKにより計数した所定時間を経過した時点において、前記受信信号が反転したまま(オフ状態のまま)か否かを再検出し(S4)、反転したままの場合にのみ(S5のYes)、受信信号を本体部11に取り込む(S6)。
【0026】
即ち、本実施形態では、上記した信号選別プログラムPR1の実行前に、受信信号の前記反転を検出するステップ(図示せず)が本発明に係る「第1検出手段」に相当し、前記再検出を行うステップS4が本発明に係る「第2検出手段」に相当する。また、カウンタKの計数による所定時間が本発明に係る「インターバル期間」に相当し、さらに、再検出の結果を受け、受信信号が反転したままか否かに応じて、受信信号を本体部11に取り込むか否かを決定するステップ(S5)が本発明に係る「信号選別手段」に相当する。
【0027】
本実施形態の場合には、上記した上限値K1によって本発明に係るインターバル期間が特定され、この上限値K1のデータは、入力制御回路20に備えたEEPROM27(本発明の「記憶手段」に相当する)に記憶されている。そして、本体部11に連なるキーボード14(本発明の「入力操作手段」に相当する)を操作することによって、本体部11のCPU15から入力回路12のCPU21に更新命令が伝達され、EEPROM27に記憶した上限値K1が更新される。
【0028】
ところで、入力制御回路20のCPU21は、定期的に図4に示したPLC診断プログラムPR2を実行する。このプログラムPR2が実行されると、図4に示すように、前記した信号選別プログラムPR1に対する割込処理の割り当てを解除してから(S10)、PLC診断用パルスを発生させる(S11)。そして、この発生させたPLC診断用パルスを第2フォトカプラ24が受信したか否かをチェックし(S12)、受信していた場合には(S12でYes)、信号選別プログラムPR1に対する割込処理の割り当てを復帰させてから、このPLC診断プログラムPR2を抜ける。一方、第2フォトカプラ24がPLC診断用パルスを受信しなかった場合には(S12でNo)、異常である旨の報知を行ってから、このプログラムPR2から抜ける。なお、異常報知が行われた場合には、フォトカプラ23の交換作業等を行って対応すればよい。
【0029】
次に、上記構成からなる本実施形態の動作を説明する。
PLC10の入力回路12に接続する外部機器が、自己診断用のパルス信号を出力するものである場合には、その外部機器の仕様書に記載された自己診断用のパルス信号の発生間隔及びパルス幅を参照にしてインターバル期間を設定する。具体的には、図5(A)に示すように、周期が1msecでパルス幅が20μsecの自己診断用のパルス信号を出力するライトカーテン30を入力回路12に接続する場合には、インターバル期間を20μsecより大きくかつ1020μsec(=1msec+20μsec)より小さい値に設定することができる。
【0030】
ここで、処理速度を高くすることを求めた場合には、インターバル期間は短い方が好ましく、処理の確実性を求めた場合には、ばらつきを考慮して、自己診断用のパルス信号の発生から離れた時間帯にインターバル期間の終了点がくるように設定することが好ましい。そこで、例えばインターバル期間として40μsecを設定する場合を例示して以下説明する。
【0031】
本実施形態の場合、インターバル期間の設定は、キーボード14の操作により行う。キーボード14にて、「インターバル期間=40μsec」というデータを入力すると、例えば、本体部11のCPU15を通して入力回路12のCPU21にそのデータが渡され、所定の式にて40μsecが上限値K1に換算される。そして、EEPROM27に記憶された上限値K1の値が、インターバル期間の40μsecに対応した値に更新される。
【0032】
これにより、信号選別プログラムPR1を実行したときにカウンタKをインクリメントするループ回数が、ライトカーテン30が出力する自己診断用のパルス信号の仕様に適合した回数に設定される。そして、PLC10における入力回路12の受信信号がオン状態からオフ状態に反転した時点(図5のS時点)を開始点として、その開始点から40μsecを経過した時点(図5のE時点)で、受信信号が反転したまま(オフ状態のまま)か否かが検出される。
【0033】
ここで、入力回路12が受信した信号が自己診断用のパルス信号であった場合には、図5(A)に示すように、インターバル期間が経過した時点(図5のE時点)で必ずオン状態に復元している。一方、入力回路12が受信した信号が作動時出力用のステップ信号であった場合には、図5(B)に示すように、インターバル期間が経過した時点(図5のE時点)で必ずオフ状態に保持されている。これにより、自己診断用のパルス信号と作動時出力用のステップ信号とを確実に選別することができる。
【0034】
このように本実施形態によれば、入力回路12が受信した信号を2回検出し、その2回の検出の間のインターバル期間を、PLC10に接続される外部機器の仕様に対応させて設定したから、2回目の検出時に受信信号がオンかオフかによって、自己診断用のパルス信号か作動時出力用のステップ信号かを確実に選別することができる。これにより、自己診断用のパルス信号を出力する外部機器をPLC10に接続しても、そのパルス信号の影響を受けず、作動時出力用のステップ信号に基づいた安定したシーケンス制御を行うことができる。
【0035】
また、インターバル期間を設定する際に、自己診断用のパルス信号の発生間隔及びパルス幅も入力しておき、PLC診断用パルスの発生と自己診断用のパルス信号とが同期しないように制御してもよい。これにより、PLC10自体の自己診断をスムーズに行うことができる。
【0036】
さらに、図5(C)に示すように、自己診断用パルスが複数連続発生した後に、しばらく間隔を空けて再び複数連続発生するパターンを繰り返す場合には、連続発生する一群のパルスの後にインターバル期間の終了点がくるように設定してもよい。
【0037】
<第2実施形態>
前記第1実施形態では、キーボード14の操作によりインターバル期間を設定する構成であったが、本実施形態のPLCは、入力回路に外部機器を接続するだけで、その入力回路の受信信号をサンプリングして、インターバル期間を自動設定する構成になっている。以下、図6〜図9のフローチャートを用いて説明する。
【0038】
外部機器が出力する自己診断用のパルス信号の仕様を求めるために、自己診断用パルスのパルス幅の最大値と、パルス間隔の最小時間を求める。そのために、図6に示した処理では、PLCにおける入力回路への入力信号を一定周期でサンプリングしつつそのサンプリングの回数をカウントし、入力信号が切り替わってから次に切り替わるまでのサンプリング回数のカウント値を自然数nを引数とする配列変数t(n)に記憶する。
【0039】
具体的には、図6の処理を実行すると、まずは、配列カウンタnを0に初期化して(S100)、入力信号がオフ状態からオン状態になるまで待機する(S102)。この処理により、オン状態になった直後からサンプリングを開始することができ、初回の入力信号オン時間を正確に測定することができる。
【0040】
入力信号がオフ状態からオン状態になったら、待機処理(S102)を抜け、時間計測用のカウンタをクリアにしてから(S104)、入力信号をサンプリングする(S106)。そして、時間計数用のカウンタをカウントアップし(S108)、サンプリングした入力信号と前回のサンプリングした入力信号とのオン・オフが反転しているか否をチェックし(S110)、反転していれば(S110でYes)、その時のカウンタ値をt(n)に記憶してから(S118)、配列カウンタnをインクリメントする(S120)。そして、配列カウンタnが100より小さければ(S122でNo)、前記したS104に処理を戻り、配列カウンタnになるまで上記と同じ動作を繰り返す。
【0041】
一方、サンプリングした入力信号と前回のサンプリングした入力信号とのオン・オフが反転しなかった場合には(S110でNo)、時間待ち処理(S112)を実行する。この時間待ち処理は入力信号に変化があった場合でも変化がなかった場合でも同じ周期でサンプリング(S106)を行うようにするための処理である。即ち、この待ち時間はS118,S120,S122,S104の各ステップの処理に要する時間から、S114の処理に要する時間を差し引いた時間である。実際にはNOP(No operation)コマンドを所定回数繰り返すなどの処理をする。
【0042】
時間待ち処理(S112)の後、カウンタ値が定数C1を超えたか否かを判定する(S114)。この処理は何らかの原因で入力信号が切り替わらなくなった場合に無限ループとなることを防ぐための処理である。即ち、入力信号が切り替わらなくなった場合にはS106〜S114までの処理を無限に繰り返すこととなるが、これを放置するとシステムが停止し、ユーザーはその停止の原因を知ることができない。その結果、原因究明及び復旧に長い時間を要することになる。これを防ぐため、カウンタ値を監視し(S114)、所定回数(C1)を超えていたら(S114でYes)、異常が発生したとみなし、「異常終了フラグ」をオンして(S116)、一連の処理を終了する。これにより、異常の発生をその内容と共にユーザーに報知することができ、ユーザーは適切な復旧作業をすることができる。
【0043】
以上説明した図6のフローチャートの処理により、配列変数t(n)(配列カウンタn=0〜99)に入力信号が変化した時間間隔に相当するカウント値が記憶され、何らかの異常により入力信号が所定時間変化しなくなった場合には異常が報知される。
【0044】
図6に示した処理が終了したら、図7に示した処理を行う。この処理では、入力信号のオン時間の最大値と2番目に大きな値、及び最小値と2番目に小さな値を求める。以下、入力信号のオン時間の最大値をton_max1、最大値の次に大きな値をton_max2、最小値をton_min1、最小値の次に小さな値をton_min2と表すこととする。
【0045】
初めに配列カウンタnを0にし(S202)、ton_min1及びton_min2を暫定的に所定の値に設定し(S204)、さらに、ton_max1及びton_max2を0に設定する(S206)。
【0046】
そして、t(n)がton_min1以下かを判定し(S208)、t(n)がton_min1以下であった場合には(S208でYes)、ton_min2にton_min1を代入するとともに(S210)、ton_min1にt(n)を代入する(S212)。
【0047】
一方、t(n)がton_min1以下でなかった場合には、t(n)がton_min2未満かを判定し(S214)、ここで、t(n)がton_min2未満であった場合には(S214でYes)、ton_min2にt(n)を代入する(S216)。
一方、t(n)がton_min2未満でなかった場合には(S214でNo)、ton_min2を書き換えることなく次の処理に移行する。
即ち、t(n)がその時点でのton_min1よりも小さければton_min1にt(n)を代入し、ton_min1≦t(n)<ton_min2であれば、ton_min2にt(n)を代入するのである。
【0048】
続いて実行されるS218〜S226は、上記説明したS208〜S216と同様の処理により、ton_max1及びton_max2を求めるものであるので、詳細な説明は省略する。
【0049】
次に、配列カウンタnに2を加算する(S228)。t(n)には、入力信号のオン時間とオフ時間とが交互に記憶されているので、配列カウンタnを2ずつ加算することで、入力信号のオン時間のみを抽出できる。そして、配列カウンタnが100に満たなければ処理(S230でNo)、S208に戻り、配列カウンタnが100になるまで、同じ処理が繰り返される。このように各入力信号のオン時間についてS208〜S226の処理を繰り返し行うことにより、入力信号オン時間の最大の値と2番目に大きな値、及び最小の値と2番目に小さな値が求められる。
【0050】
図7に示した処理に次いで実行される図8に示した処理では、入力信号オフ時間の最大値と2番目に大きな値、及び最小値と2番目に小さな値を求める処理である。このフローチャートでは、入力信号オフ時間の最大値をtoff_max1、入力信号オフ時間の最大値の次に大きな値をtoff_max2、入力信号オフ時間の最小値をtoff_min1、入力信号オフ時間の最小値の次に小さな値をtoff_min2と表している。
【0051】
図8の処理は、図7の処理に対して、「オン時間」と「オフ時間」とが異なるのみでそれ以外は同様の処理を行うものであるので、詳細な説明は省略する。なお、S302で配列カウンタnを1に初期化しているのは、t(n)の奇数番号、即ち入力信号のオフ時間のみを抽出するためである。
【0052】
図9は、図7及び図8の処理で求めたそれぞれの値、即ち、オン時間・オフ時間の最大・最小値及び2番目に大きな値と2番目に小さな値をチェックし、異常な値となっていないかを判定するとともに、異常がない場合には自己診断用パルス幅の最大値と、自己診断用パルス間の最小時間間隔を求める処理を示すフローチャートである。
【0053】
図9の処理では、まず、tを0に初期化する(S402)。tは後の処理で自己診断用パルス幅の最大値が代入される変数である。
【0054】
次いで、S404〜S410において、オン時間・オフ時間の最大の値と2番目に大きな値との比較、及び、最小の値と2番目に小さな値との比較を行う。入力信号は、所定のデータパターンが繰り返し表れるので、これら比較される各々の値はほぼ同じ値でなければならない。比較の結果、大きな差が現れれば、回路又は配線等にノイズが混入していたり、動作が不安定になっている蓋然性が高いと考えられるので、tが0のまま処理を終了する。なお、S404〜S410におけるC2は、許容値に相当する所定の定数である。
【0055】
S404〜S410で異常が認められなければ、S412以降の処理を行う。即ち、オン時間の最大値とオフ時間の最大値とを比較することにより(S412)、外部機器の自己診断用パルスがオフンパルスなのかオンパルスなのかを判断する。そして、オン時間の最大値(ton_max1)がオフ時間の最大値(toff_max1)よりも大きければ(S412でYes)、自己診断用パルスがオフパルスであると判断し、そうでない場合には(S412でNo)、自己診断用パルスがオンパルスであると判断する。
【0056】
自己診断用パルスがオフパルスであると判断した場合には、S414〜S418の処理を行う。即ち、自己診断用パルスのパルス幅の最大値(toff_max1)と最小値(toff_min1)との差が、所定の範囲内(定数C3以下)に収まっているかをチェックする(S414)。ここで、本来、自己診断用パルスは一定のパルス幅であるので、パルス幅の最大値と最小値はほぼ等しい値であるはずである。この差が大きい場合には(S414でNo)、サンプリングの最中に外部機器が作動し、入力信号が(自己診断用パルスによるものではなく)実際に切り替わったと推定される。このような場合には、入力信号の二度読み時間間隔を精度よく求めることができないので、tに値を設定することなく処理を終了する。
【0057】
自己診断用パルスのパルス幅の最大値(toff_max1)と最小値(toff_min1)との差が、所定の範囲内(定数C3以下)に収まった場合には(S414でYes)、toff_max1に定数C4を掛けてtに代入する(S416)。toff_max1に記憶された値は、入力信号の二度読み時間間隔そのものを示すものではなく、図6の処理で使用した時間係数用のカウンタのカウンタ値であるので、toff_max1と定数C4との積により、時間を表す値に変換するのである。これにより、tには入力信号の二度読み時間間隔が、例えばμsの単位で設定される。同様に、ton_min1に定数C4を掛けてtに代入する(S418)。
【0058】
S420〜S424は、自己診断用パルスがオンパルスである場合の処理を示したものである。これらの処理はS414〜S428と同様の内容であるので、詳細な説明は省略する。
【0059】
S426は、tに定数αを加算した値とtとの大小を比較する処理である。(t+α)は、入力信号を実際に二度読みする際の時間間隔であり、定数αはこの時間間隔に余裕度を与えるためのものである。即ち、自己診断用パルス幅の最大値(t)の時間間隔で入力信号を二度読みすると、温度変化等により自己診断用パルス幅が変化した際に信号を読み誤ることとなるので、入力信号を二度読みする際の時間間隔を多めにとるのである。(t+α)<tの場合には、後に詳述するように、自己診断用パルスが連続して発生する際の連続発生数(N)を知る必要があるので、この処理を行ってからリターンする。
【0060】
自己診断用パルスが連続して発生する際の連続発生数(N)を求める処理を図10に示す。S502〜S506はton_max1とtoff_max1のいずれか大きい方に0.9を掛け、変数tに代入する処理である。これにより、tにはサンプリングした中で最も長いパルス幅のカウント数に0.9を掛けた値が代入される。自己診断用パルスの連続発生数(N)は長いパルス幅のパルス(図11(C)のP1)とその次に発生する長いパルス幅のパルス(図11(C)のP2)との間に発生した自己診断用パルスの数であるので、t以上のパルスが発生してから次にt以上のパルスが発生するまでの間に発生するパルスの数を数える。
【0061】
S508,S510では、それぞれ変数mとnとを初期化する。S512はt(n)がtより大きいか否かを判定する。t(n)がtより大きくなければS514でnをインクリメントしてS512の処理に戻る。S512でt(n)がtより大きければ、S516でmをインクリメントする。次にS518でnをインクリメントし、S520でt(n)とtとを比較して、t(n)>tでなければS516からS520の処理を繰り返し行う。
この繰り返し処理により、パルスP1とP2の間に発生するパルスの数がカウントされる。このカウント数は、オンパルスとオフパルスの両者を含むものである。
【0062】
S520でt(n)>tであれば、S522で自己診断用パルスの連続発生数Nに、mを2分の1にした値を代入する。前記したように、mはオンパルスとオフパルスの両者を含んだカウント値であるので、これを2分の1にすることで、自己診断用パルスの連続発生数Nが得られる。この処理の後、リターンする。
【0063】
以上の処理により、自己診断用パルス幅の最大値(t)と、自己診断用パルス間の最小時間間隔(t)、及び自己診断用パルスの連続発生数(N)を求めることができる。また、オン時間・オフ時間の最大・最小値などに異常が認められればtが0のまま図9に示す処理が終了するので、この場合にはユーザーに異常を報知することができる。なお、異常原因をより詳細にユーザーに示すため、S404〜S410並びにS414、S420の処理で異常と判定したら、それぞれに異なる異常コードを設定するようにしてもよい。
【0064】
<他の実施形態>
本発明は、前記実施形態に限定されるものではなく、例えば、以下に説明するような実施形態も本発明の技術的範囲に含まれ、さらに、下記以外にも要旨を逸脱しない範囲内で種々変更して実施することができる。
(1)前記第1実施形態で例示したライトカーテン30は、自己診断用パルスとしてオフパルスを出力するものであったが、自己診断用パルスとしてオンパルスを出力する外部機器が接続されるPLCに本発明を適用してもよい。
【0065】
(2)前記第1実施形態のPLC10は、PLC診断用パルスを生成する構成であったが、PLC診断用パルスを生成しないPLCに本発明を適用してもよい。
【0066】
(3)前記実施形態では、本発明に係る制御装置としてPLCを例示したが、本発明に係る制御装置はPLCに限定されるものではなく、外部機器が接続されるものであれば、例えば、CNC(数値制御)コントローラ、ロボットのコントローラ、パソコン等であってもよい。
【図面の簡単な説明】
【図1】本発明の第1実施形態に係るPLCの構成を示したブロック図
【図2】(A)作動時出力用のステップ信号を示した波形図
(B)自己診断作用のパルス信号を示した波形図
(C)自己診断用のパルス信号の変形例を示した波形図
【図3】信号選別プログラムのフローチャート
【図4】PLC診断プログラムのフローチャート
【図5】(A)作動時出力用のステップ信号とインターバル期間との関係を示したタイムチャート
(B)自己診断作用のパルス信号とインターバル期間との関係を示したタイムチャート
【図6】第2実施形態に係るインターバル期間を設定する処理のフローチャート
【図7】同インターバル期間を設定する処理のフローチャート
【図8】同インターバル期間を設定する処理のフローチャート
【図9】同インターバル期間を設定する処理のフローチャート
【図10】インターバル期間を設定する処理のフローチャート
【図11】自己診断用のパルスの波形図
【符号の説明】
10…PLC(制御装置)
11…本体部(制御装置本体)
12…入力回路
14…キーボード(入力操作手段)
27…EEPROM(記憶手段)
30…ライトカーテン(外部機器)
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a control device such as a programmable logic controller (PLC), an input circuit thereof, and a signal input method.
[0002]
[Prior art]
A safety device such as a safety light curtain or a safety area sensor may be connected to the PLC input circuit. Generally, the output signal of the safety device is normally an on signal, and is switched to an off signal when an entry to the detection area is detected. That is, the signal output when the safety device is activated is a step signal for switching from the on state to the off state. Then, the main body of the PLC that has received this step signal performs a predetermined sequence process, for example, an emergency stop of the system.
[0003]
By the way, recent safety devices regularly output pulse signals for self-diagnosis. This pulse signal is an off signal with an extremely short pulse width (for example, 20 μsec), and this pulse signal is fed back to the safety device itself to confirm that there is no abnormality in the output system. Here, in the PLC with low reception sensitivity, the pulse signal for self-diagnosis is ignored, but in the PLC with high reception sensitivity, particularly in the so-called safety PLC in which the safety standard is set to a high level, the pulse signal for self-diagnosis is used. Will also be detected.
[0004]
Therefore, in the conventional example, a PLC input circuit provided with a capacitor or a coil for delaying the response time is known. As another conventional example, when it is detected that the signal received by the PLC input circuit is turned off, the detection operation is further performed three times, and if two or more of them are in the on state, the signal is received. A configuration is known in which the signal is ignored and the received signal is taken into the main body of the PLC when it is not.
[0005]
[Problems to be solved by the invention]
However, in the conventional device described above, if a capacitor or a coil for delaying the response time is provided, the responsiveness deteriorates even with respect to a signal output by the safety device during operation. In addition, since the output specifications of the self-diagnosis pulse differ depending on the manufacturer of the safety device, in the case of performing the detection operation three times, for example, one self-diagnosis pulse having a large pulse width includes three detection operations. There could be a situation where the detection operation overlaps with a plurality of self-diagnosis pulses that are continuously output. For this reason, in the prior art, it was considered that the self-diagnosis pulse was mistakenly taken as an operation signal and was taken into the main body of the PLC.
[0006]
The present invention has been made in view of the above circumstances, and a control device capable of performing stable sequence control even when an external device that outputs a pulse signal for self-diagnosis is connected, its input circuit, and signal input method The purpose is to provide.
[0007]
[Means for Solving the Problems]
In order to achieve the above object, the signal input method of the control device according to the invention of claim 1 selects the pulse signal for self-diagnosis received from the external device and the step signal for operation output, This is a signal input method for the control device that takes only the step signal for output during operation into the control device body, and the signal received from the external device is inverted when the interval period elapses after the signal is inverted relative to the normal state. In the time zone when the self-diagnosis pulse signal is not generated, the received signal is taken into the main body of the control device only when it remains inverted. It is characterized in that the interval period is set so as to perform detection.
[0008]
An input circuit of a control device according to a second aspect of the invention selects a pulse signal for self-diagnosis received from an external device and a step signal for operation output, and controls only the step signal for operation output. An input circuit of a control device to be taken into the main body, the first detection means for detecting that the received signal from the external device is inverted with respect to the normal state, and the interval period after the first detection means detects the inversion When the time elapses, the second detection means for detecting whether or not the received signal remains inverted and the detection result of the second detecting means are received and the received signal is controlled only when the received signal remains inverted. And a signal selection means to be incorporated into the apparatus main body, and the interval period is set so that the second detection means is detected in a time zone in which a pulse signal for self-diagnosis is not generated, corresponding to the specifications of the external device. Shi Having the features in place.
[0009]
The control device according to the invention of claim 3 selects the pulse signal for self-diagnosis received from the external device and the step signal for operation output, and takes only the step signal for operation output into the control device body. A control device having an input circuit, wherein a first detection means for detecting that a received signal from an external device is inverted relative to a normal state, and an interval period after the first detection means detects the inversion. A second detecting means for detecting whether or not the received signal remains inverted when the time has elapsed; and a control device that receives the detection result of the second detecting means and controls the received signal only when the received signal remains inverted Signal selection means to be incorporated into the main body, and the interval period is set so that the detection of the second detection means is performed in a time zone in which a pulse signal for self-diagnosis is not generated, corresponding to the specifications of the external device When Furnace has a feature.
[0010]
The invention according to claim 4 is characterized in that in the control device according to claim 3, there is provided a storage means for storing the interval period in an updatable manner and an input operation means for updating the interval period by an input operation. .
[0011]
According to a fifth aspect of the present invention, there is provided the control device according to the third aspect, wherein the storage unit stores the interval period in an updatable manner, and the interval period update unit updates the interval period by sampling the signal received by the receiving unit. It has the feature in having.
[0012]
[Action and effect of the invention]
According to the present invention, it is detected whether or not the received signal received by the input circuit of the control device remains inverted when a predetermined interval period has elapsed since the received signal was inverted. Only the received signal is taken into the control device body. Here, in the present invention, since the interval period is set in accordance with the specifications of the external device, when the received signal is a pulse signal for self-diagnosis, the inversion state is surely achieved when the interval period elapses. Has returned to its original state. On the other hand, when the received signal is a step signal for output during operation, the signal remains inverted even when the interval period elapses. Thereby, the pulse signal for self-diagnosis and the step signal for operation time output can be reliably selected, and stable sequence control based on the step signal for operation time output can be performed.
[0013]
Further, the interval period according to the present invention may be updated by an input operation using the input operation means (the invention of claim 4), or the interval period update means samples and updates the signal received by the receiving unit. (Invention of claim 5).
[0014]
DETAILED DESCRIPTION OF THE INVENTION
<First Embodiment>
Hereinafter, a first embodiment of the present invention will be described with reference to FIGS.
The PLC 10 of this embodiment (corresponding to the “control device” of the present invention) has a basic configuration shown in FIG. 1, and is formed by connecting an input circuit 12, an output circuit 13, and a keyboard 14 to a main body 11. . The main body 11 includes a CPU 15 as a main part, and runs a sequence program recorded in the memory 16 based on a signal received from the input circuit 12. Then, a predetermined sequence process is performed to drive a device (not shown) connected to the output circuit 13.
[0015]
Further, the PLC 10 of the present embodiment is a so-called safety PLC, and the input circuit 12 is configured to be able to generate a pulse for PLC diagnosis described below. That is, the input circuit 12 is provided with a plurality of receiving circuits 25 according to the number of input points, and one of the receiving circuits 25 is representatively shown in FIG.
[0016]
The receiving circuit 25 includes first and second photocouplers 23 and 24, and the phototransistor 23A of the first photocoupler 23 and the LED 24B of the second photocoupler 24 are connected in series to connect the external connection circuit 29. It is composed. Specifically, the cathode of the LED 24B is connected to the GND, the anode is connected to the emitter of the phototransistor 23A, and the collector of the phototransistor 23A is opened to provide an external connection terminal 26 in the input circuit 12.
[0017]
Further, the LED 23B of the first photocoupler 23 is always driven by the input control circuit 20, whereby the phototransistor 23A is turned on, and the external connection circuit 29 becomes conductive from the external connection terminal 26 toward GND. It is in a state. When the energization state of the external connection circuit 29 changes according to the output signal of the external device connected to the external connection terminal 26, the phototransistor 24A of the second photocoupler 24 opens and closes as the energization state changes. As a result, a signal is taken into the input control circuit 20 to which the phototransistor 24A is connected.
[0018]
The input control circuit 20 turns off the LED 23B of the first photocoupler 23 periodically and over a predetermined period (for example, 20 μsec) when an ON signal is constantly output from an external device connected to the external connection terminal 26, As a result, the PLC diagnostic pulse as an OFF signal is generated in the receiving circuit 25. Then, the input circuit 12 is self-diagnosis based on whether the second photocoupler 24 can detect the pulse signal for PLC diagnosis.
[0019]
Since the PLC 10 of the present embodiment is a safety PLC as described above, a so-called safety device used for ensuring human safety is connected to the input circuit 12 as an external device of the present invention. As an example of the safety device, a case where a safety light curtain 30 (hereinafter simply referred to as “light curtain 30”) is connected will be described below.
[0020]
The light curtain 30 includes a light projecting unit 31 and a light receiving unit 32. When a plurality of parallel optical axes connecting the light projecting and receiving units 31 and 32 are blocked, a detection signal ("operation signal of the present invention" Is output).
[0021]
The output circuit of the light curtain 30 is, for example, an open collector circuit of a transistor (hereinafter referred to as “output transistor”). For example, a 24V power source is connected to the collector and the external connection terminal 26 of the PLC 10 is connected to the emitter. The Further, the output transistor is always turned on, so that the voltage of the signal input to the external connection terminal 26 when the light curtain 30 is not operating is kept at 24V. When the light curtain 30 is activated, the output transistor is turned off, and the voltage of the signal input to the external connection terminal 26 becomes 0V. That is, as shown in FIG. 2A, the signal output when the light curtain 30 is activated is a step signal for switching from the ON state of the potential 24V to the OFF state of the potential 0V.
[0022]
Incidentally, the light curtain 30 periodically outputs a pulse signal for self-diagnosis, and performs self-diagnosis by feeding back the pulse signal to the light curtain 30 itself. The pulse signal for self-diagnosis is generated by periodically turning off the output transistor of the light curtain 30 for a predetermined period (for example, about 25 μsec). That is, the signal output by the light curtain 30 during the self-diagnosis is an off-pulse signal having a pulse width of about 25 μsec as shown in FIG.
[0023]
The input control circuit 20 includes a CPU 21, a ROM 22, an EEPROM 27, and a RAM (not shown). The signal selection program stored in the ROM 22 is run, and the above-described pulse signal for self-diagnosis and the step signal for output during operation are provided. Can be sorted out. Specifically, for example, execution of the signal selection program PR1 shown in FIG. 3 is assigned as an interrupt process when the reception signal by the reception circuit 25 is inverted from the on state (normal state) to the off state.
[0024]
When the inversion of the received signal is detected and the signal selection program PR1 is executed, as shown in FIG. 3, after the counter K is reset to 0 (S1), a loop for incrementing the counter K by 1 is entered. (S2, S3) The increment is repeated until the counter K reaches a predetermined upper limit value K1.
Then, when the counter K reaches the upper limit value K1 (Yes in S3) and exits the loop, it is re-detected whether or not the received signal is in an off state, that is, whether or not it remains inverted (S4). If the received signal is inverted (off state) (Yes in S5), the received signal is converted into a signal having a level suitable for the main body 11 and output to the main body 11 (S6). . On the other hand, when the reception signal is turned back on (No in S5), the reception signal is ignored and no signal is output to the main body unit 11.
[0025]
In summary, the signal selection program PR1 detects that the reception signal of the reception circuit 25 is inverted from the on state to the off state, and when the predetermined time counted by the counter K has elapsed, It is re-detected whether or not it remains inverted (still off) (S4), and only when it remains inverted (Yes in S5), the received signal is taken into the main body 11 (S6).
[0026]
That is, in the present embodiment, the step (not shown) of detecting the inversion of the received signal before the execution of the above-described signal selection program PR1 corresponds to the “first detection means” according to the present invention, and the re-detection Step S4 of performing is equivalent to the “second detection means” according to the present invention. Further, the predetermined time according to the count of the counter K corresponds to the “interval period” according to the present invention, and the received signal is received according to whether the received signal remains inverted after receiving the result of redetection. The step (S5) for determining whether or not to capture the signal corresponds to the “signal selection means” according to the present invention.
[0027]
In the case of the present embodiment, the interval period according to the present invention is specified by the above-described upper limit value K1, and the data of the upper limit value K1 corresponds to the EEPROM 27 provided in the input control circuit 20 (the “storage means” of the present invention). To remember). Then, by operating a keyboard 14 (corresponding to “input operation means” of the present invention) connected to the main body 11, an update command is transmitted from the CPU 15 of the main body 11 to the CPU 21 of the input circuit 12 and stored in the EEPROM 27. The upper limit value K1 is updated.
[0028]
By the way, the CPU 21 of the input control circuit 20 periodically executes the PLC diagnosis program PR2 shown in FIG. When this program PR2 is executed, as shown in FIG. 4, the assignment of the interrupt process to the signal selection program PR1 is canceled (S10), and then a PLC diagnosis pulse is generated (S11). Then, it is checked whether or not the generated PLC diagnostic pulse has been received by the second photocoupler 24 (S12). If it has been received (Yes in S12), an interrupt process for the signal selection program PR1 is performed. After returning the allocation, the PLC diagnostic program PR2 is exited. On the other hand, when the second photocoupler 24 does not receive the PLC diagnostic pulse (No in S12), the program PR2 is exited after notifying that there is an abnormality. In addition, what is necessary is just to perform the replacement | exchange operation | work of the photocoupler 23 etc. when abnormality notification is performed.
[0029]
Next, the operation of the present embodiment configured as described above will be described.
When the external device connected to the input circuit 12 of the PLC 10 outputs a pulse signal for self-diagnosis, the generation interval and the pulse width of the pulse signal for self-diagnosis described in the specifications of the external device Set the interval period with reference to. Specifically, as shown in FIG. 5A, when a light curtain 30 that outputs a pulse signal for self-diagnosis having a period of 1 msec and a pulse width of 20 μsec is connected to the input circuit 12, an interval period is set. A value larger than 20 μsec and smaller than 1020 μsec (= 1 msec + 20 μsec) can be set.
[0030]
Here, when it is desired to increase the processing speed, it is preferable that the interval period is short. When the certainty of the processing is determined, the variation is taken into consideration and the pulse signal for self-diagnosis is generated. It is preferable to set so that the end point of the interval period comes in a distant time zone. Therefore, for example, a case where 40 μsec is set as the interval period will be described below.
[0031]
In the present embodiment, the interval period is set by operating the keyboard 14. When data “interval period = 40 μsec” is input using the keyboard 14, for example, the data is transferred to the CPU 21 of the input circuit 12 through the CPU 15 of the main body 11, and 40 μsec is converted into the upper limit value K1 by a predetermined formula. The Then, the value of the upper limit value K1 stored in the EEPROM 27 is updated to a value corresponding to 40 μsec of the interval period.
[0032]
As a result, the loop count for incrementing the counter K when the signal selection program PR1 is executed is set to the number that matches the specification of the pulse signal for self-diagnosis output from the light curtain 30. Then, when the reception signal of the input circuit 12 in the PLC 10 is inverted from the on state to the off state (time S in FIG. 5), when 40 μsec has elapsed from the start point (time E in FIG. 5), It is detected whether or not the received signal remains inverted (off state).
[0033]
Here, if the signal received by the input circuit 12 is a pulse signal for self-diagnosis, as shown in FIG. 5 (A), the signal must be turned on when the interval period elapses (time E in FIG. 5). It is restored to the state. On the other hand, when the signal received by the input circuit 12 is a step signal for output during operation, it is always turned off when the interval period elapses (time E in FIG. 5), as shown in FIG. Held in a state. Thereby, the pulse signal for self-diagnosis and the step signal for operation output can be reliably selected.
[0034]
Thus, according to the present embodiment, the signal received by the input circuit 12 is detected twice, and the interval period between the two detections is set in accordance with the specifications of the external device connected to the PLC 10. Thus, it is possible to reliably select the pulse signal for self-diagnosis or the step signal for operation output depending on whether the received signal is on or off at the time of the second detection. As a result, even if an external device that outputs a pulse signal for self-diagnosis is connected to the PLC 10, it is possible to perform stable sequence control based on the step signal for operation output without being affected by the pulse signal. .
[0035]
Also, when setting the interval period, the generation interval and pulse width of the pulse signal for self-diagnosis are also input, and control is performed so that the generation of the PLC diagnosis pulse and the pulse signal for self-diagnosis are not synchronized. Also good. Thereby, the self-diagnosis of PLC10 itself can be performed smoothly.
[0036]
Further, as shown in FIG. 5C, when a plurality of consecutive self-diagnostic pulses are generated and a pattern in which a plurality of consecutive pulses are generated again is repeated for a while, an interval period is repeated after a group of continuously generated pulses. It may be set so that the end point of.
[0037]
Second Embodiment
In the first embodiment, the interval period is set by operating the keyboard 14, but the PLC of the present embodiment samples the received signal of the input circuit only by connecting an external device to the input circuit. The interval period is automatically set. Hereinafter, description will be made with reference to the flowcharts of FIGS.
[0038]
In order to obtain the specifications of the pulse signal for self-diagnosis output from the external device, the maximum value of the pulse width of the self-diagnosis pulse and the minimum time of the pulse interval are obtained. For this purpose, in the processing shown in FIG. 6, the number of samplings is counted while sampling the input signal to the input circuit in the PLC at a constant period, and the count value of the number of samplings from when the input signal is switched to when it is switched to the next. Is an array variable t with a natural number n as an argument (N) To remember.
[0039]
Specifically, when the processing of FIG. 6 is executed, first, the array counter n is initialized to 0 (S100), and the process waits until the input signal changes from the off state to the on state (S102). By this processing, sampling can be started immediately after the on state is entered, and the first input signal on time can be accurately measured.
[0040]
When the input signal changes from the off state to the on state, the standby processing (S102) is exited, the time measurement counter is cleared (S104), and the input signal is sampled (S106). Then, the time counting counter is counted up (S108), and it is checked whether the ON / OFF of the sampled input signal and the previous sampled input signal is inverted (S110). Yes in S110), the counter value at that time is t (N) (S118), the array counter n is incremented (S120). If the array counter n is smaller than 100 (No in S122), the process returns to the above-described S104, and the same operation as described above is repeated until the array counter n is reached.
[0041]
On the other hand, when ON / OFF of the sampled input signal and the previous sampled input signal is not reversed (No in S110), a time waiting process (S112) is executed. This time waiting process is a process for performing sampling (S106) in the same cycle regardless of whether the input signal has changed or not. That is, this waiting time is a time obtained by subtracting the time required for the processing of S114 from the time required for the processing of each step of S118, S120, S122, and S104. In practice, processing such as repeating a NOP (No operation) command a predetermined number of times is performed.
[0042]
After the time waiting process (S112), it is determined whether or not the counter value exceeds a constant C1 (S114). This process is a process for preventing an infinite loop when the input signal is not switched for some reason. That is, when the input signal is not switched, the processing from S106 to S114 is repeated infinitely. If this is left unattended, the system stops and the user cannot know the cause of the stop. As a result, it takes a long time to investigate and recover the cause. In order to prevent this, the counter value is monitored (S114), and if it exceeds the predetermined number of times (C1) (Yes in S114), it is considered that an abnormality has occurred and the "abnormal end flag" is turned on (S116). Terminate the process. Thereby, the occurrence of the abnormality can be notified to the user together with the content thereof, and the user can perform an appropriate recovery work.
[0043]
By the processing of the flowchart of FIG. 6 described above, the array variable t (N) A count value corresponding to the time interval when the input signal changes is stored in (array counter n = 0 to 99), and an abnormality is notified when the input signal does not change for a predetermined time due to some abnormality.
[0044]
When the process shown in FIG. 6 is completed, the process shown in FIG. 7 is performed. In this process, the maximum value and the second largest value of the ON time of the input signal, and the minimum value and the second smallest value are obtained. Hereinafter, the maximum value of the on time of the input signal is expressed as t. on_max1 , The next largest value after t on_max2 , The minimum value is t on_min1 , The next smallest value after t on_min2 It shall be expressed as
[0045]
First, the array counter n is set to 0 (S202), t on_min1 And t on_min2 Is temporarily set to a predetermined value (S204), and t on_max1 And t on_max2 Is set to 0 (S206).
[0046]
And t (N) Is t on_min1 It is determined whether or not (S208) and t (N) Is t on_min1 If it is the following (Yes in S208), t on_min2 To t on_min1 Is substituted (S210), t on_min1 To t (N) Is substituted (S212).
[0047]
On the other hand, t (N) Is t on_min1 If not, t (N) Is t on_min2 It is determined whether it is less than (S214), where t (N) Is t on_min2 If it is less than (Yes in S214), t on_min2 To t (N) Is substituted (S216).
On the other hand, t (N) Is t on_min2 If not (No in S214), t on_min2 The process proceeds to the next process without rewriting.
That is, t (N) Is the current t on_min1 T is smaller than on_min1 To t (N) Is substituted and t on_min1 ≦ t (N) <T on_min2 Then t on_min2 To t (N) Is substituted.
[0048]
Subsequent S218 to S226 are executed in the same manner as S208 to S216 described above. on_max1 And t on_max2 Therefore, detailed description is omitted.
[0049]
Next, 2 is added to the array counter n (S228). t (N) Since the ON time and OFF time of the input signal are alternately stored, the ON time of the input signal can be extracted by adding the array counter n by two. If the array counter n is less than 100 (No in S230), the process returns to S208, and the same process is repeated until the array counter n reaches 100. Thus, by repeatedly performing the processing of S208 to S226 for the on time of each input signal, the maximum value and the second largest value, and the minimum value and the second smallest value of the input signal on time are obtained.
[0050]
The process shown in FIG. 8 executed after the process shown in FIG. 7 is a process for obtaining the maximum value and the second largest value and the minimum value and the second smallest value of the input signal off time. In this flowchart, the maximum value of the input signal off time is expressed as t. off_max1 , The next largest value of the maximum value of the input signal off time t off_max2 , The minimum value of the input signal off time t off_min1 , The next smallest value of the minimum value of the input signal off time t off_min2 It expresses.
[0051]
The process in FIG. 8 is the same as the process in FIG. 7 except that the “on time” and the “off time” are different, and the other processes are the same. Note that the array counter n is initialized to 1 in S302 because t (N) This is because only the odd number, i.e., the off time of the input signal is extracted.
[0052]
9 checks each value obtained by the processing of FIGS. 7 and 8, that is, the maximum / minimum value of the on time / off time, the second largest value, and the second smallest value. 7 is a flowchart showing a process for determining whether or not there is any abnormality and obtaining the maximum value of the self-diagnosis pulse width and the minimum time interval between the self-diagnosis pulses when there is no abnormality.
[0053]
In the process of FIG. 9, first, t p Is initialized to 0 (S402). t p Is a variable into which the maximum value of the pulse width for self-diagnosis is substituted in a later process.
[0054]
Next, in S404 to S410, the maximum value of the on time / off time is compared with the second largest value, and the minimum value is compared with the second smallest value. Since the input signal repeatedly shows a predetermined data pattern, the values to be compared must be almost the same value. If a large difference appears as a result of the comparison, it is considered that there is a high probability that noise is mixed in the circuit or wiring or the operation is unstable. p The process ends with 0 remaining unchanged. Note that C2 in S404 to S410 is a predetermined constant corresponding to an allowable value.
[0055]
If no abnormality is recognized in S404 to S410, the processing after S412 is performed. That is, by comparing the maximum value of the on time and the maximum value of the off time (S412), it is determined whether the self-diagnosis pulse of the external device is an off pulse or an on pulse. The maximum on-time (t on_max1 ) Is the maximum off time (t off_max1 ) (Yes in S412), it is determined that the self-diagnosis pulse is an off-pulse, and otherwise (No in S412), it is determined that the self-diagnosis pulse is an on-pulse.
[0056]
If it is determined that the self-diagnosis pulse is an off-pulse, the processing of S414 to S418 is performed. That is, the maximum value of the pulse width of the self-diagnosis pulse (t off_max1 ) And minimum value (t off_min1 ) Is within a predetermined range (constant C3 or less) (S414). Here, since the self-diagnosis pulse has a constant pulse width, the maximum value and the minimum value of the pulse width should be substantially equal. If this difference is large (No in S414), it is presumed that the external device is activated during sampling and the input signal is actually switched (not due to the self-diagnosis pulse). In such a case, the time interval for reading the input signal twice cannot be obtained with high accuracy. p The process ends without setting a value to.
[0057]
Maximum value of pulse width of self-diagnosis pulse (t off_max1 ) And minimum value (t off_min1 ) Is within a predetermined range (constant C3 or less) (Yes in S414), t off_max1 Multiplied by a constant C4 and t p (S416). t off_max1 The value stored in is not the twice reading time interval itself of the input signal itself, but is the counter value of the counter for the time coefficient used in the processing of FIG. off_max1 Is converted into a value representing time by the product of the value and the constant C4. As a result, t p Is set to a time interval of twice reading of the input signal, for example, in units of μs. Similarly, t on_min1 Multiplied by a constant C4 and t q (S418).
[0058]
S420 to S424 show processing when the self-diagnosis pulse is an on-pulse. Since these processes have the same contents as S414 to S428, detailed description is omitted.
[0059]
S426 is t p A value obtained by adding a constant α to t and t q This is a process of comparing the size of and. (T p + Α) is the time interval when the input signal is actually read twice, and the constant α is for giving a margin to this time interval. That is, the maximum value (t p If the input signal is read twice at a time interval of), the signal will be misread when the pulse width for self-diagnosis changes due to temperature changes, etc., so the time interval when reading the input signal twice is increased. It is. (T p + Α) <t q In this case, as will be described in detail later, it is necessary to know the number of consecutive occurrences (N) when the self-diagnosis pulses are continuously generated.
[0060]
FIG. 10 shows a process for obtaining the number of consecutive occurrences (N) when the self-diagnosis pulses are continuously generated. S502 to S506 are t on_max1 And t off_max1 Whichever is greater is multiplied by 0.9 and the variable t r Is a process of substituting for. As a result, t r Is substituted with a value obtained by multiplying the count of the longest pulse width by 0.9. The number of consecutive self-diagnosis pulses (N) is between the long pulse width (P1 in FIG. 11C) and the next long pulse width (P2 in FIG. 11C). Since it is the number of self-diagnosis pulses that have occurred, t r T after the above pulse occurs r The number of pulses generated until the above pulses are generated is counted.
[0061]
In S508 and S510, variables m and n are initialized, respectively. S512 is t (N) Is t r Determine if greater than. t (N) Is t r If it is not larger, n is incremented in S514 and the process returns to S512. T in S512 (N) Is t r If larger, m is incremented in S516. Next, n is incremented in S518, and t is incremented in S520. (N) And t r And t (N) > T r Otherwise, the processing from S516 to S520 is repeated.
By this repeated process, the number of pulses generated between the pulses P1 and P2 is counted. This count number includes both on-pulse and off-pulse.
[0062]
T at S520 (N) > T r If so, a value in which m is halved is substituted for the number N of consecutive self-diagnosis pulses generated in S522. As described above, since m is a count value including both the on-pulse and the off-pulse, the number N of continuous occurrences of self-diagnosis pulses can be obtained by halving this value. After this processing, return.
[0063]
Through the above processing, the maximum value of the pulse width for self-diagnosis (t p ) And the minimum time interval (t q ) And the number of consecutive self-diagnostic pulses (N). In addition, if there is an abnormality in the maximum / minimum values of on-time / off-time, t p Since the process shown in FIG. 9 ends with 0 remaining, in this case, the user can be notified of the abnormality. In order to show the cause of the abnormality to the user in more detail, if it is determined that there is an abnormality in the processes of S404 to S410 and S414 and S420, a different abnormality code may be set for each.
[0064]
<Other embodiments>
The present invention is not limited to the above-described embodiment. For example, the embodiments described below are also included in the technical scope of the present invention, and various other than the following are within the scope not departing from the gist. It can be changed and implemented.
(1) Although the light curtain 30 illustrated in the first embodiment outputs an off pulse as a self-diagnosis pulse, the present invention is applied to a PLC to which an external device that outputs an on-pulse as a self-diagnosis pulse is connected. May be applied.
[0065]
(2) Although the PLC 10 of the first embodiment is configured to generate a PLC diagnostic pulse, the present invention may be applied to a PLC that does not generate a PLC diagnostic pulse.
[0066]
(3) In the said embodiment, although PLC was illustrated as a control apparatus which concerns on this invention, the control apparatus which concerns on this invention is not limited to PLC, if an external apparatus is connected, for example, It may be a CNC (numerical control) controller, a robot controller, a personal computer or the like.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a PLC according to a first embodiment of the present invention.
FIG. 2A is a waveform diagram showing a step signal for output during operation.
(B) Waveform diagram showing pulse signal for self-diagnosis
(C) Waveform diagram showing a modified example of a self-diagnosis pulse signal
FIG. 3 is a flowchart of a signal selection program.
FIG. 4 is a flowchart of a PLC diagnostic program.
FIG. 5A is a time chart showing the relationship between the step signal for output during operation and the interval period;
(B) Time chart showing the relationship between the self-diagnosis pulse signal and the interval period
FIG. 6 is a flowchart of processing for setting an interval period according to the second embodiment.
FIG. 7 is a flowchart of processing for setting the interval period;
FIG. 8 is a flowchart of processing for setting the same interval period.
FIG. 9 is a flowchart of processing for setting the interval period.
FIG. 10 is a flowchart of processing for setting an interval period.
FIG. 11 is a waveform diagram of pulses for self-diagnosis.
[Explanation of symbols]
10 ... PLC (control device)
11 ... Main body (control device main body)
12 ... Input circuit
14 ... Keyboard (input operation means)
27 ... EEPROM (storage means)
30 ... Light curtain (external equipment)

Claims (5)

外部機器から受信した自己診断用のパルス信号と作動時出力用のステップ信号とを選別して、前記作動時出力用のステップ信号のみを制御装置本体に取り込む制御装置の信号入力方法であって、
前記外部機器からの受信信号が、通常状態に対して反転してからインターバル期間が経過した時点で反転したままか否かを検出し、反転したままであった場合にのみ前記受信信号を前記制御装置本体に取り込むと共に、
前記外部機器の仕様に対応させて、前記自己診断用のパルス信号が発生していない時間帯に前記検出を行うように前記インターバル期間を設定したことを特徴とする制御装置の信号入力方法。
A signal input method for a control device that selects a pulse signal for self-diagnosis received from an external device and a step signal for output during operation, and takes only the step signal for output during operation into the control device body,
It is detected whether or not the received signal from the external device remains inverted when the interval period elapses after being inverted with respect to the normal state, and the control is performed only when the received signal remains inverted. Incorporate into the device body,
A signal input method for a control apparatus, wherein the interval period is set so as to perform the detection in a time zone in which the pulse signal for self-diagnosis is not generated in accordance with the specification of the external device.
外部機器から受信した自己診断用のパルス信号と作動時出力用のステップ信号とを選別して、前記作動時出力用のステップ信号のみを制御装置本体に取り込む制御装置の入力回路であって、
前記外部機器からの受信信号が、通常状態に対して反転したことを検出する第1検出手段と、
前記第1検出手段が前記反転を検出してからインターバル期間を経過した時点で、前記受信信号が反転したままか否かを検出する第2検出手段と、
前記第2検出手段の検出結果を受け、前記受信信号が反転したままであった場合にのみ前記受信信号を前記制御装置本体に取り込む信号選別手段とを備え、
前記インターバル期間は、前記外部機器の仕様に対応させて、前記自己診断用のパルス信号が発生していない時間帯に前記第2検出手段の検出が行われるように設定したことを特徴とする制御装置の入力回路。
A control device input circuit that selects a pulse signal for self-diagnosis received from an external device and a step signal for output during operation, and takes only the step signal for output during operation into the control device body,
First detection means for detecting that a received signal from the external device is inverted with respect to a normal state;
Second detection means for detecting whether or not the received signal remains inverted when the interval period has elapsed since the first detection means detected the inversion;
Receiving the detection result of the second detection means, comprising a signal selection means for capturing the reception signal into the control device main body only when the reception signal remains inverted,
The control is characterized in that the interval period is set so that the detection by the second detection means is performed in a time zone in which the pulse signal for self-diagnosis is not generated, corresponding to the specification of the external device. The input circuit of the device.
外部機器から受信した自己診断用のパルス信号と作動時出力用のステップ信号とを選別して、前記作動時出力用のステップ信号のみを制御装置本体に取り込む入力回路を備えた制御装置であって、
前記外部機器からの受信信号が、通常状態に対して反転したことを検出する第1検出手段と、
前記第1検出手段が前記反転を検出してからインターバル期間を経過した時点で、前記受信信号が反転したままか否かを検出する第2検出手段と、
前記第2検出手段の検出結果を受け、前記受信信号が反転したままであった場合にのみ前記受信信号を前記制御装置本体に取り込む信号選別手段とを備え、
前記インターバル期間は、前記外部機器の仕様に対応させて、前記自己診断用のパルス信号が発生していない時間帯に前記第2検出手段の検出が行われるように設定したことを特徴とする制御装置。
A control device comprising an input circuit that selects a pulse signal for self-diagnosis received from an external device and a step signal for operation output, and takes only the step signal for operation output into the control device body. ,
First detection means for detecting that a received signal from the external device is inverted with respect to a normal state;
Second detection means for detecting whether or not the received signal remains inverted when the interval period has elapsed since the first detection means detected the inversion;
Receiving the detection result of the second detection means, comprising a signal selection means for capturing the reception signal into the control device main body only when the reception signal remains inverted,
The control is characterized in that the interval period is set so that the detection by the second detection means is performed in a time zone in which the pulse signal for self-diagnosis is not generated, corresponding to the specification of the external device. apparatus.
前記インターバル期間を更新可能に記憶した記憶手段と、
入力操作により前記インターバル期間を更新するための入力操作手段を備えたことを特徴とする請求項3に記載の制御装置。
Storage means for storing the interval period in an updatable manner;
The control device according to claim 3, further comprising an input operation means for updating the interval period by an input operation.
前記インターバル期間を更新可能に記憶した記憶手段と、
前記受信部が受信した信号をサンプリングして、前記インターバル期間を更新するインターバル期間更新手段とを備えたことを特徴とする請求項3に記載の制御装置。
Storage means for storing the interval period in an updatable manner;
The control apparatus according to claim 3, further comprising: an interval period updating unit that samples the signal received by the receiving unit and updates the interval period.
JP2002200190A 2002-07-09 2002-07-09 Control device, input circuit thereof, and signal input method of control device Expired - Fee Related JP4131134B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2002200190A JP4131134B2 (en) 2002-07-09 2002-07-09 Control device, input circuit thereof, and signal input method of control device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2002200190A JP4131134B2 (en) 2002-07-09 2002-07-09 Control device, input circuit thereof, and signal input method of control device

Publications (2)

Publication Number Publication Date
JP2004046348A JP2004046348A (en) 2004-02-12
JP4131134B2 true JP4131134B2 (en) 2008-08-13

Family

ID=31707121

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2002200190A Expired - Fee Related JP4131134B2 (en) 2002-07-09 2002-07-09 Control device, input circuit thereof, and signal input method of control device

Country Status (1)

Country Link
JP (1) JP4131134B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8479064B2 (en) 2010-01-18 2013-07-02 Kabushiki Kaisha Toshiba Safety input device
CN109459969A (en) * 2018-10-24 2019-03-12 济宁科力光电产业有限责任公司 A kind of safe light curtain IP kernel system

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4349231B2 (en) 2004-07-30 2009-10-21 株式会社ジェイテクト Programmable controller
US8798206B2 (en) * 2012-01-11 2014-08-05 Thales Canada Inc. Vital digital input
CN115231421A (en) * 2022-07-22 2022-10-25 日立楼宇技术(广州)有限公司 Light curtain control method and device, elevator light curtain and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8479064B2 (en) 2010-01-18 2013-07-02 Kabushiki Kaisha Toshiba Safety input device
CN109459969A (en) * 2018-10-24 2019-03-12 济宁科力光电产业有限责任公司 A kind of safe light curtain IP kernel system
CN109459969B (en) * 2018-10-24 2021-03-02 济宁科力光电产业有限责任公司 Safe light curtain IP nuclear system

Also Published As

Publication number Publication date
JP2004046348A (en) 2004-02-12

Similar Documents

Publication Publication Date Title
EP2228698B1 (en) Programmable controller system
US5805063A (en) Wireless security sensor transmitter
CN101523307B (en) Fault detector, fault detection method, and fault detection program
KR20020089182A (en) Apparatus of processing, slave, node, and network monitor system
JPH0632144B2 (en) Environmental abnormality alarm device
JP4131134B2 (en) Control device, input circuit thereof, and signal input method of control device
JPH11265733A (en) Condition-monitoring device for battery group
JP6939085B2 (en) Communication equipment and communication system
JP2019057239A (en) Control device
US7093167B2 (en) Control apparatus and self-diagnostic method for electronic control system
US5942981A (en) Low battery detector for a wireless sensor
KR101796841B1 (en) Building monitoring system and the operating method therefor
CN112034822A (en) Detection device and detection method for automatic switch controller
US4797664A (en) Environmental abnormality detection apparatus
JP2004038647A (en) Fire detector and fire alarm facility
JP4415885B2 (en) Programmable controller system
US5650762A (en) Fire alarm system
WO2006052426A2 (en) Camera sensor job selection method
JP2004303038A (en) Fire alarm device
JP2017130048A (en) Fire receiver and disaster prevention system using the same
JP2005078137A (en) Condition setting control panel
US10528417B2 (en) Clock signal inspection device, plant monitoring controller, and method for diagnosing clock signal inspection device
JPH09128665A (en) Detector
JP2932507B2 (en) Anomaly detection device
JP2653732B2 (en) Smoke analog fire judgment method and device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20050330

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20060301

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080324

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

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20080513

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

Free format text: PAYMENT UNTIL: 20110606

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4131134

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20120606

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20120606

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20130606

Year of fee payment: 5

LAPS Cancellation because of no payment of annual fees