JP3951760B2 - controller - Google Patents
controller Download PDFInfo
- Publication number
- JP3951760B2 JP3951760B2 JP2002073175A JP2002073175A JP3951760B2 JP 3951760 B2 JP3951760 B2 JP 3951760B2 JP 2002073175 A JP2002073175 A JP 2002073175A JP 2002073175 A JP2002073175 A JP 2002073175A JP 3951760 B2 JP3951760 B2 JP 3951760B2
- Authority
- JP
- Japan
- Prior art keywords
- frequency
- output
- pulse
- input
- setting value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Lifetime
Links
Images
Landscapes
- Programmable Controllers (AREA)
Description
【0001】
【発明の属する技術分野】
この発明は、コントローラに関するものである。
【0002】
【従来の技術】
PLC(プログラマブルコントローラ)その他のコントローラにおける出力機器の制御方式の一つとして、PLCのCPUユニットに内蔵されたパルス出力機能に基づくパルスを出力し、出力機器は、そのパルス(ON/OFF信号)に従って動作するシステムがある。
【0003】
一例としては、例えば図1に示すように、ベルトコンベア装置1の駆動モータの動作を制御するシステムがある。すなわち、PLC2は、電源ユニット2aやCPUユニット2bを備え、CPUユニット2bのI/O端子2b′に、メインモータ(ベルトコンベア装置1と別の装置を駆動するモータ)3の回転をロータリーエンコーダ4で検出し、回転速度に応じたパルスを入力情報として与える。CPUユニット2bは、受信した入力情報(入力パルスの周波数)に基づき演算実行し、駆動モータ(ベルトコンベア装置1を駆動するモータ)の回転数等の動作条件を決定する。この演算処理は、例えば予め入力周波数に対する出力周波数の比率を「比率設定値」として与えておき、入力パルスの周波数を取得すると、比率設定値に基づいてパルス出力の周波数(出力周波数)を求め、その出力周波数になるようにパルス出力をする。
【0004】
このパルス出力に従って、モータドライバの動作が制御される。つまり、この出力されたパルスが駆動モータ用のモータドライバ5に与えられる。すると、モータドライバ5は、1つのパルスの入力に伴い駆動モータを1ステップ駆動させる。従って、出力されるパルスの周波数が高くなるほど駆動モータの回転数ひいてはベルトコンベア装置1における搬送速度が速くなる。
【0005】
これにより、メインモータ3の回転数が変更すると、入力パルスの周波数が変更されるので、それに伴い出力パルスの周波数も一定の比率で変更し、それに追従してベルトコンベア装置1の駆動モータの回転数が変更する。よって、メインモータ3の回転数と、駆動モータの回転数が一定の比率を保持しながら回転するといった同期制御が行える。
【0006】
そして、動作条件の求め方としては、例えば図2に示すように、MPUは、処理(1)として、入力されたパルス(カウンタ入力)を計数し、一定時間内に入力されたパルス数から、入力パルスの周波数を求める。次に処理(2)として、処理(1)で求めた入力周波数に対する出力周波数を求める。具体的には、入力周波数に予め設定された比率設定値を乗することにより求める。
【0007】
次いで、処理(3)として、処理(2)で求めた出力周波数でパルス出力を設定する。これにより、この設定後は、その設定した出力周波数になるように継続してパルスが出力される。
【0008】
さらに、上記したように出力周波数の設定が完了すると、処理(4)として他の処理を実行する。そして、上記した処理(1)から(4)までを、例えば、約10msec間隔で実行する。
【0009】
【発明が解決しようとする課題】
従来の制御システムでは、一度出力周波数が設定されると、制御サイクルの約10msの期間は周波数が固定されるので、理想と実際の出力周波数で誤差が生じる。さらに、一定時間内のパルス数から周波数を算出していたため、精度が低下する。
【0010】
さらにまた、従来の制御は、入力されたパルスに基づいて入力周波数を求め、そこから比率設定値を用いて演算処理をして出力周波数を求め、それに基づいて実際に出力周波数を設定するので、実際に入力周波数が変化してから、実際に出力周波数が変化するまでにタイムラグ(図2の(1)から(3)までを実行する時間)が生じ、その点でも迅速な対応(同期処理)ができない。
【0011】
この発明は、入力周波数の変化を迅速に出力周波数に反映することのできるコントローラを提供することを目的とする。
【0012】
【課題を解決するための手段】
この発明によるコントローラでは、入力されたパルスの周波数情報を求める入力周波数検出部と、その入力周波数検出部で求めた前記周波数情報を記憶する記憶手段と、その記憶手段に格納された前記周波数情報に対し、予め定めた比率設定値に基づいて演算処理をしてパルス出力の出力周波数設定値を算出する算出手段と、その算出手段から出力される前記出力周波数設定値に基づき、パルス出力を行うパルス出力手段とを備え、前記パルス出力手段は、パルス出力の状態に基づいて前記算出手段へ前記演算処理の実行を指示するリクエスト信号を出力する機能を備え、前記算出手段は、前記パルス出力手段からリクエスト信号を受信すると前記演算処理を実行するようにした。そして、前記リクエストの発行タイミングとしては、例えば、前記パルス出力が、1パルス出力される毎に行うことができる。
【0013】
ここで、パルスの周波数情報とは、周波数そのものでもよいし、実施の形態のようにカウント値(時間)でもよい。要は周波数に対応するものであればよい。入力周波数検出部は、実施の形態では周波数カウンタ部22に対応する。記憶手段は、実施の形態ではラッチ部23に対応する。算出手段は、実施の形態では比率分周部24に対応する。記憶手段は、実施の形態では、一時記憶手段の一形態であるラッチ部23に対応する。
【0014】
パルス出力手段の機能である、「パルス出力の状態に基づいて前記算出手段へ前記演算処理の実行を指示するリクエスト信号を出力すること」とは、パルス出力が所定の状態になったときにリクエストが発行されるもので、係る所定の状態としては、例えば、パルス出力の1周期の終わり(終わりを基準とした所定期間前)とすることができる。このように1周期の終わりの際にリクエストを発行すると、現在の入力パルスの周波数の状態により即したパルス出力の周波数を決定することができる。もちろん、本発明では、パルス出力側をトリガとして入力周波数を算出し、パルス出力の周波数を算出することが、特徴の1つであるので、パルス出力の必ずしも1周期の終わりに基づいてリクエストを発行するものに限らず、例えば、パルス出力の中間地点(1周期内でのONとOFFの切り替わりポイント)でリクエストを発行する等の他、任意のポイント(基準)に基づいてリクエストを発行することができる。
【0015】
さらに、本発明のコントローラは、実施の形態ではCPUユニット2bに対応するが、PLC本体全体でももちろん良い。つまり、所定周波数のパルスを入力し、その周波数に応じた任意の周波数のパルスを出力するFA用のコントローラ(制御装置)を含むものである。
【0016】
この発明によれば、記憶手段には常に最新の入力パルスの周波数情報が記憶保持される。そして、パルス出力の状態に基づいて発行されるリクエスト信号に従って算出手段を動作させ、そのリクエスト信号を受信した際に記憶されている直前の入力パルスの周波数情報に基づいてパルス出力の出力周波数設定値を求めるので、迅速かつ精度のよい同期制御が行える。
【0017】
また、前記入力されたパルスの立ち上がり或いは立ち下がりを基準変化点とした場合に、前記入力周波数検出手段は、前記基準変化点を検出してから次の基準変化点を検出するまでの期間に基づいて前記周波数情報を求めるものであり、前記期間が一定以上の場合にパルス出力を停止する機能を備えるとよい。
【0018】
すなわち、前記パルスの立ち上がりから次のパルスの立ち上がりまで、或いは立ち下がりから次の立ち下がりまでの期間に基づいて前記周波数情報を求めるようにすると、例えば、周波数が極端に低くなったり、ノイズその他の要因から次のパルスの基準変化点が発生するまでに時間がかかる場合がある。係る場合に、最新の周波数情報は、その1つ前の入力パルスに基づくもので、実際のものとずれが大きくなる。これに対し本発明のようにすると、入力パルスが停止したり、極端に低い周波数になった場合にはパルス出力が停止されるので、より精度のよい制御が行える。
【0019】
また、出力周波数下限設定値を記憶する記憶手段を備え、前記算出手段は、演算処理をして求められたパルス出力の出力周波数設定値が前記記憶手段に格納された出力周波数下限設定値よりも低い周波数になる場合に、その出力周波数下限設定値を出力周波数設定値として出力するようにすることもできる。低い周波数であるので、例えば周波数情報がカウント値(時間)の場合は大きい(長い)値となる。
【0020】
このようにすると、算出手段で求めた出力周波数設定値の周波数が低い場合には、出力周波数下限設定値に基づいて出力されるので、一定以上に低い出力周波数が出力されるおそれが無くなる。
【0021】
さらに、比率設定値を記憶する比率設定値記憶手段を備え、コントローラの動作中に、前記比率設定値記憶手段に記憶された前記比率設定値を変更する手段を備えるようにすることもできる。このようにすると、途中で条件の変更ができるので、より高精度な制御が行える。
【0022】
【発明の実施の形態】
図3は、本発明に係るコントローラの一態様であるCPUユニット2bの好適な一実施の形態を示す内部構造の一例である。図3に示すように、I/O端子11を介して与えられるカウンタ入力に対し、所定の演算処理を実行するカウンタブロック20と、そのカウンタブロック20で求めた出力パルスの出力周波数に従って実際にパルス出力をするパルスブロック30を有している。このパルスブロック30の出力は、I/O端子11に接続され、このI/O端子11を介して図外のモータドライバなどに与えられる。そして、これらカウンタブロック20とパルスブロック30は、いずれもハードウエアで構成される。
【0023】
図外のメインモータのエンコーダ(図1参照)等から入力されるパルス信号として、複数種類の信号がある。その組み合わせは各種のものがあるが、本実施の形態では、周波数を求めるための信号Aと、回転方向を求めるための信号Bがある。この2つの信号A,Bがカウンタブロック20の入力パルス変換部21に与えられ、そこにおいて所定の変換処理を経てFeed信号と、Dir信号が出力される。すなわち、図1に示す例ではエンコーダが、基準角度回転する都度1個のパルスが出力されるが、Feed信号は、係るエンコーダから出力され、CPUユニットに入力されるパルスと同期してON/OFFするパルス信号となる。また、Dir信号は、例えば図1に示す例ではメインモータの回転方向(正転/逆転)に応じてHigh/Lowとなる信号である。
【0024】
Feed信号とDir信号は、周波数カウンタ部22に与えられる。周波数カウンタ部22は、CPUクロックその他の基準クロックに従ってカウントアップするカウンタ機能を有し、Feed信号(入力パルス)の1周期、つまり、あるパルスの立ち上がりから次の立ち上がりまでをカウントする。そして、係る次の立ち上がりを検知すると、カウント値を0にし、リスタートする。
【0025】
この周波数カウンタ部22の出力は、ラッチ部23に与えられる。ラッチ部23は、最新の入力パルスの周波数に基づく値(カウント値)をラッチするもので、具体的には、入力周波数(カウント値)については、その値を監視するとともに、直前のカウント値を一時記憶し、カウント値が0になった場合に、その1つ前のカウント値(現在の入力パルスの周波数に対応するカウント値)をラッチする。
【0026】
また、周波数カウンタ部22側でカウント値をリスタートする際(次のパルスの立ち上がりを検知した際)に、その時のカウント値を次段のラッチ部23に与えるようにすると、ラッチ部23側では周波数カウンタ部22からカウント値が転送されてくるのを待ち、その転送されてきたカウント値を保持すればよい。
【0027】
さらにラッチ部23には、周波数カウンタ部22から出力される現在の方向を特定する方向信号(Dir信号)も入力される。この方向信号の取得タイミングは、例えば、入力周波数カウント値がラッチ部23にラッチされる際の方向信号を取得してラッチするようにしても良いし、周波数カウンタ部22をスルー状態で逐次ラッチ部23に入力されるようにしても良い。
【0028】
これにより、ラッチ部23は、次に周波数カウンタ部22がリスタートするまでその取得したカウント値,方向を保持する。従って、上記したようにラッチ部23には、常に最新の入力パルスの周波数に基づく値(カウント値)が記憶されることになる。
【0029】
このラッチ部23に保持された情報の内、カウント値は所定のタイミングで比率分周部24に与えられ(実際には、比率分周部24が読み出す)、Dir信号は、パルスブロック30のパルス出力部31に与えられる。比率分周部24は、ラッチ部23から取得した現在(最新)の入力パルスの周波数(カウント値)に対し、比率設定レジスタ26に格納した比率設定値(n)を用いて演算し、出力周波数設定値(カウント値)を求める。
【0030】
すなわち、比率設定レジスタ26には、n=(1/256)から256までの所定の値がセットされている。そこで、仮に、現在の入力周波数カウント値が4096で、比率設定値が1/16とすると、図4に示すように出力周波数カウント値は256となる。
【0031】
そして、この比率分周部24における上記演算処理は、パルス出力部31から比率分周部24に対して出力されるリクエスト信号をトリガとして実行される。そして、このリクエスト信号は、パルス出力部31が出力している現在のパルスの1周期が終わる際(実際には、演算処理時間を考慮して数クロック前)に発行される。
【0032】
また、このリクエスト信号を受信した比率分周部24は上記のように所定の演算処理を実行するが、その演算処理が終了すると、パルス出力部31に対して許可信号を発行するとともに、求めた出力パルス周波数設定値(カウント値)を送る。従って、パルス出力部31では、係る許可信号を受信後に受け取った出力パルス周波数設定値に従って次のパルス出力の周波数(カウント値)を設定し、パルス出力をする。また、このパルス出力とともに、方向信号も出力する。これらパルス出力と方向信号がI/O端子11を介して出力機器(モータドライバ等)に与えられる。
【0033】
上記した構成が基本構成であり、これにより図5に示すタイミングチャートのように動作する。すなわち、カウンタブロック20側では、カウンタ入力の1パルスごとに周波数カウンタ部22で周波数を計測し(1)、現在の最新の入力パルスの周波数(カウント値)が、ラッチ部23に格納される(2)。この処理(1),(2)は、他の処理とは関係無くパルスが入力される都度繰り返し実行される(図6参照)。なお、上記した括弧付き数字は、図6に示すフローチャートの各処理ステップと、その処理ステップを実行した際の図5に示すタイミングチャートにおけるタイミング位置を示している。このことは、以下に示す図5と図7の関係でも同様である。
【0034】
一方、図5,図7に示すように、パルスブロック30で同期制御としてパルス出力を起動すると(3)、パルス出力が1周期出力し終わる前(数クロック前)にパルスブロック30(パルス出力部31)からリクエスト信号を出力する(4)。
【0035】
すると、このリクエスト信号を受信したカウンタブロック20の比率分周部24が、ラッチ部23にラッチされている現在の最新の入力周波数を取得し(5)、比率設定レジスタ26から取得した入力周波数に対する出力周波数の比率(比率設定値)を用いて出力周波数を計算する(6)。
【0036】
そして、計算し終わるとカウンタブロック20(比率分周部24)からパルスブロック30(パルス出力部31)へ許可信号を返し、次の出力周波数を出力する(7)。1パルスを出力しおわると演算結果の出力周波数で継続してパルス出力をする(8)。
【0037】
上記した基本構成に加え、本実施の形態ではさらに以下の機能を付加し、より高精度で安定した制御を実行するようにしている。まず、ラッチ部23は、入力周波数下限設定レジスタ25にセットされた入力周波数下限設定値が与えられ、入力パルスの周波数が設定された周波数以下の場合には、入力周波数が0と判断し、所定の値にする機能を持たせている。
【0038】
すなわち、本実施の形態では、入力パルスの立ち上がりから次の立ち上がりまでをカウントするようにしているため、次の立ち上がりを検出できない場合には、カウント値はアップし続けることになるとともに、0にリスタートされないと、ラッチ部23に新しい入力周波数カウント値がセットされず、それ以前の入力周波数カウント値がラッチされたままとなる。従って、入力パルスの周波数が低くなると、当然のことながら次のパルスの立ち上がりまで時間がかかり、周波数カウンタ部22ではカウント値がアップし続ける。
【0039】
すると、例えば、入力パルスの周波数が、急に変動して周波数が低くなったり、停止したりした場合でも、ラッチ部23には直前の入力パルス周波数に基づくカウント値がラッチされているので、そのままではパルス出力はそのラッチされたカウント値に基づいた出力周波数で出力され続けることになる。つまり、実際の入力パルスの周波数は低い値,停止であるにも関わらず、所定の周波数と判断してパルス出力されることになり、正確な同期制御ができなくなる。
【0040】
そこで、上記したように、入力パルスの周波数が設定された周波数以下の場合には、入力周波数が0と判断し、ラッチ部23では、入力周波数カウント値として、所定の値(例えば、「0」)をセットして保持するようにしている。これにより、入力パルスの周波数が低くなったり、入力パルスが一定期間OFF状態が続いた場合でも、適当な時間(入力周波数下限設定値に相当する1パルスの時間)が経過すると、ラッチ部23の値は、入力周波数下限設定値に基づく値に更新される。
【0041】
そして、このラッチ部23にラッチされた入力周波数カウント値に基づいて出力周波数カウント値が求められるが、入力周波数下限設定値以下の周波数の場合にラッチ部23に保持される値の時は、所定の比率で演算処理するのではなく、出力停止のように制御する。なお、係るラッチ部23に保持される値を上記したように「0」にすると、比率分周部24における比率設定値(n)を用いた演算処理をしても、その演算結果は「0」となるので好ましい。
【0042】
なお、本実施の形態では、周波数に応じたカウント値で処理をするようにしたため、周波数が低くなるほどカウント値は大きくなる。従って、実際には、現在計数中の入力パルスの入力周波数が、係る入力周波数下限設定値以下の周波数か否かの判断は、周波数カウンタ部22のカウント値が、入力周波数下限設定値レジスタに格納された設定値を超えるか否かにより判断する。
【0043】
そして、具体的には、例えば、ラッチ部23が周波数カウンタ部22のカウント値を常時監視する方式を採った場合には、そのカウント値と上記設定値とを比較し、設定値を超えたか否かにより判断できる。また、周波数カウンタ部22からリスタートの際に転送されてくる場合には、転送されるまではカウント値が不明であるので、別途カウンタ等を設け前回の転送を受けてからの経過時間をカウンタで求め、それと設定値とを比較することによっても対処できる。さらには、図3に示した例では入力周波数下限設定レジスタ25の出力をラッチ部23に与えるようにしたが、周波数カウンタ部22に与えるようにし、周波数カウンタ部22側でカウント値が設定値を超えた場合に所定の値を出力するようにしても良い。
【0044】
この入力下限周波数設定機能の実際の動作は、例えば図8に示すようになる。すなわち、入力パルスが図8(a)に示すようになっているとすると、図8(b)に示すように1番目のパルス出力▲1▼の1周期の終わり(2番目のパルス出力の立ち上がり)の際(実際には、数クロック手前)には、ラッチ部には先頭の入力パルスの周波数カウント値(t)がラッチされているので、それに基づく出力周波数が求められ、その求められた出力周波数にしたがって2番目のパルス出力▲2▼が成される。
【0045】
ところで、2番目の入力パルスが入力された後一定期間入力がOFFの状態が続くと、周波数カウンタ部22はカウントアップしつづけるので、2番目のパルス出力▲2▼の終了の際のラッチ部23にラッチされた値は、1番目の入力パルスに基づく値(t)である。従って、3番目のパルス出力▲3▼も、2番目のパルス出力▲2▼と同一の周波数で出力される。4番目のパルス出力▲4▼も同様である。
【0046】
ここで、仮に入力周波数の下限を100Hzとすると、入力周波数下限設定値は、10msec相当のカウント値となる。従って、4番目のパルス出力▲4▼の1周期の終了の際には、周波数カウンタ部22におけるカウント値は、10msecに対応する値を超えていているので、ラッチ部23には所定の値(たとえば「0」)がセットされる。従って、比率分周部24から出力される出力パルス周波数設定値は「0」となり、パルス出力はOFFとなる。
【0047】
なお、本実施の形態の場合、パルス出力の動作(1周期の終わり)をトリガとして次のパルス出力の周波数を算出し、設定するようにしたため、このようにパルス出力が、OFF状態が続くとリクエスト信号が出力されず、次のパルス出力の周波数を算出できなくなる。そこで、このように入力周波数下限設定値に基づいて出力が0になった場合には、現在の状態(出力OFF)をラッチ部23はわかっているので、周波数カウンタ部22で入力パルスの周波数を計数し、入力周波数下限設定値以上の正常な値に復帰した場合には、入力側(ラッチ部23)から比率分周部24に入力周波数カウント値を与え、それに基づいて比率分周部24で出力周波数カウント値を演算するようにする。そして、この演算が終わると、許可信号とともに求めたカウント値をパルス出力部31に与えることにより、正常な動作に復帰する(パルス出力▲5▼が出力される)。
【0048】
さらに、比率分周部24に対しては、出力周波数下限設定レジスタ27にセットされた出力周波数下限設定値を与えるようにし、比率設定レジスタ26の比率設定値に従って演算して求めた出力周波数と係る出力周波数下限設定値とを比較し、演算結果の方が大きい場合には出力周波数下限設定値を出力パルス周波数設定値に決定し、係る値を出力するようにする。これにより、パルス出力の周波数が極端に低くなるのが抑制できる。
【0049】
一例を示すと、図8に示すように、出力周波数下限設定値が「256」で比率設定値が「6」とすると、入力周波数カウント値が「32」の場合には、演算結果の出力周波数カウント値のまま出力するが、入力周波数カウント値が「64」になると演算結果は「384」となるので、出力周波数下限設定値の「256」を出力周波数設定値に決定し、出力する。
【0050】
さらにまた、比率分周部24は、演算する都度比率設定レジスタ26に格納された比率設定値を読み出すので、例えばCPUユニットの稼働中に、比率設定レジスタ26に対して比率設定値を書き込む手段を設けることにより、パルス出力中に比率設定値を書き替えることができ、それにより、その後の入力周波数と出力周波数の相関(比率)を変更することができ、状況の変化に即したより高精度な制御が行える。
【0051】
以上のように、本実施の形態では、パルス出力の1パルスごとに次に出力すべき周波数を算出し、出力するようにしたため、制御サイクルの精度が極めて向上する。
【0052】
さらに、パルス出力側の動作をトリガとし、1つのパルス出力の1周期が終了(次のパルス出力の立ち上がり)する際にその直前の入力パルスの周波数を取得し、それに基づいて所定の比率設定値にしたがってパルス出力の周波数を求めるようにしたため、入力周波数の変動に伴う出力周波数の変動をリアルタイムに行うことができ、より高精度な同期制御が行える。そして、既に最新の入力パルスの周波数カウント値が求められているので、上記トリガの発生後は、比率分周部24にてラッチ部23から入力周波数を読み出すとともに、比率設定値に基づいて演算処理をするだけでよいので、パルス出力の次の立ち上がりまでの時間で十分演算処理を終了し、パルス出力部31に送ることができる。
【0053】
【発明の効果】
以上のように、この発明では、入力周波数の変化を迅速に出力周波数に反映することができる。
【図面の簡単な説明】
【図1】PLCのCPUユニットから出力される出力パルスを用いた制御システムの一例を示す図である。
【図2】従来の作用を説明するタイムチャートである。
【図3】本発明の一実施の形態を示す図である。
【図4】比率分周部の作用を説明する図である。
【図5】本実施の形態の動作を説明するタイミングチャートである。
【図6】本実施の形態の動作を説明するフローチャートの一部である。
【図7】本実施の形態の動作を説明するフローチャートの一部である。
【図8】入力周波数下限設定機能を説明する図である。
【図9】出力周波数下限設定機能を説明する図である。
【符号の説明】
10 CPUユニット
11 I/O端子
20 カウンタブロック
21 入力パルス変換部
22 周波数カウンタ部
23 ラッチ部
24 比率分周部
25 入力周波数下限設定レジスタ
26 比率設定レジスタ
27 出力周波数下限設定レジスタ
30 パルスブロック
31 パルス出力部[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a controller.
[0002]
[Prior art]
As one of the control methods of output devices in PLC (programmable controller) and other controllers, it outputs a pulse based on the pulse output function built in the CPU unit of the PLC, and the output device follows the pulse (ON / OFF signal) There is a working system.
[0003]
As an example, as shown in FIG. 1, for example, there is a system that controls the operation of the drive motor of the
[0004]
The operation of the motor driver is controlled according to this pulse output. That is, this output pulse is given to the
[0005]
As a result, when the rotation speed of the
[0006]
For example, as shown in FIG. 2, the MPU counts the input pulses (counter input) as a process (1) as shown in FIG. 2, and from the number of pulses input within a predetermined time, Find the frequency of the input pulse. Next, as processing (2), an output frequency with respect to the input frequency obtained in processing (1) is obtained. Specifically, it is obtained by multiplying the input frequency by a preset ratio setting value.
[0007]
Next, as a process (3), a pulse output is set at the output frequency obtained in the process (2). Thereby, after this setting, a pulse is continuously output so that it may become the set output frequency.
[0008]
Furthermore, when the setting of the output frequency is completed as described above, another process is executed as process (4). Then, the processes (1) to (4) described above are executed at intervals of about 10 msec, for example.
[0009]
[Problems to be solved by the invention]
In the conventional control system, once the output frequency is set, the frequency is fixed for a period of about 10 ms of the control cycle, so that an error occurs between the ideal and actual output frequency. Furthermore, since the frequency is calculated from the number of pulses within a certain time, the accuracy is lowered.
[0010]
Furthermore, the conventional control obtains the input frequency based on the input pulse, calculates the output frequency using the ratio setting value therefrom, and actually sets the output frequency based on it. There is a time lag (time to execute steps (1) to (3) in FIG. 2) from when the input frequency actually changes to when the output frequency actually changes. I can't.
[0011]
An object of the present invention is to provide a controller that can quickly reflect a change in an input frequency in an output frequency.
[0012]
[Means for Solving the Problems]
In the controller according to the present invention, an input frequency detection unit that obtains frequency information of an input pulse, a storage unit that stores the frequency information obtained by the input frequency detection unit, and the frequency information stored in the storage unit On the other hand, calculation means for calculating an output frequency setting value of pulse output by performing arithmetic processing based on a predetermined ratio setting value, and a pulse for performing pulse output based on the output frequency setting value output from the calculation means Output means, and the pulse output means has a function of outputting a request signal instructing the calculation means to execute the arithmetic processing based on a state of pulse output, the calculation means from the pulse output means When the request signal is received, the arithmetic processing is executed . The request issuance timing can be performed, for example, every time one pulse is output.
[0013]
Here, the frequency information of the pulse may be the frequency itself or a count value (time) as in the embodiment. In short, it may be anything corresponding to the frequency. The input frequency detection unit corresponds to the
[0014]
The function of the pulse output means, “to output a request signal instructing the calculation means to execute the arithmetic processing based on the state of pulse output” is a request when the pulse output is in a predetermined state. The predetermined state can be, for example, the end of one cycle of pulse output (before a predetermined period with reference to the end). As described above, when a request is issued at the end of one cycle, it is possible to determine the frequency of the pulse output in accordance with the current frequency state of the input pulse. Of course, in the present invention, calculating the input frequency using the pulse output side as a trigger and calculating the frequency of the pulse output is one of the features, and therefore, a request is issued based on the end of one cycle of the pulse output. For example, a request may be issued based on an arbitrary point (reference) in addition to issuing a request at an intermediate point of pulse output (a switching point between ON and OFF within one cycle). it can.
[0015]
Further, the controller of the present invention corresponds to the
[0016]
According to the present invention, the storage means always stores and holds the latest frequency information of the input pulse. Then, the calculation means is operated according to the request signal issued based on the state of the pulse output, and the output frequency setting value of the pulse output is based on the frequency information of the previous input pulse stored when the request signal is received. Therefore, quick and accurate synchronous control can be performed.
[0017]
Further, when the rising or falling edge of the input pulse is used as a reference change point, the input frequency detecting means is based on a period from detection of the reference change point to detection of the next reference change point. The frequency information is obtained, and it is preferable to provide a function of stopping the pulse output when the period is equal to or greater than a certain value.
[0018]
That is, if the frequency information is obtained based on the period from the rising edge of the pulse to the rising edge of the next pulse, or from the falling edge to the next falling edge, for example, the frequency becomes extremely low, noise or other It may take time for the next pulse reference change point to occur due to the factor. In this case, the latest frequency information is based on the previous input pulse, and the deviation from the actual one becomes large. On the other hand, according to the present invention, since the pulse output is stopped when the input pulse is stopped or the frequency becomes extremely low, more accurate control can be performed.
[0019]
In addition, storage means for storing the output frequency lower limit setting value is provided, and the calculation means is configured such that the output frequency setting value of the pulse output obtained by the arithmetic processing is greater than the output frequency lower limit setting value stored in the storage means. When the frequency becomes low, the output frequency lower limit set value can be output as the output frequency set value. Since the frequency is low, for example, when the frequency information is a count value (time), a large (long) value is obtained.
[0020]
In this way, when the frequency of the output frequency set value obtained by the calculating means is low, the output is performed based on the output frequency lower limit set value, so there is no possibility that an output frequency lower than a certain level is output.
[0021]
Furthermore, a ratio set value storage means for storing the ratio set value may be provided, and a means for changing the ratio set value stored in the ratio set value storage means during operation of the controller may be provided. In this way, since the condition can be changed in the middle, more accurate control can be performed.
[0022]
DETAILED DESCRIPTION OF THE INVENTION
FIG. 3 is an example of an internal structure showing a preferred embodiment of the
[0023]
There are a plurality of types of signals as pulse signals input from an encoder (see FIG. 1) of the main motor (not shown). There are various combinations, but in this embodiment, there are a signal A for obtaining the frequency and a signal B for obtaining the rotation direction. These two signals A and B are given to the
[0024]
The Feed signal and the Dir signal are given to the
[0025]
The output of the
[0026]
Further, when the count value is restarted on the
[0027]
Further, a direction signal (Dir signal) specifying the current direction output from the
[0028]
Thus, the
[0029]
Of the information held in the
[0030]
That is, a predetermined value from n = (1/256) to 256 is set in the
[0031]
The arithmetic processing in the
[0032]
The
[0033]
The above-described configuration is a basic configuration, which operates as shown in the timing chart of FIG. That is, on the
[0034]
On the other hand, as shown in FIG. 5 and FIG. 7, when the pulse output is started as the synchronous control in the pulse block 30 (3), the pulse block 30 (pulse output unit) is output before the pulse output is output for one cycle (several clocks). A request signal is output from (31) (4).
[0035]
Then, the
[0036]
When the calculation is completed, a permission signal is returned from the counter block 20 (ratio divider 24) to the pulse block 30 (pulse output unit 31), and the next output frequency is output (7). When one pulse is output, the pulse is continuously output at the output frequency of the calculation result (8).
[0037]
In addition to the basic configuration described above, the present embodiment further adds the following functions to execute more accurate and stable control. First, the
[0038]
That is, in this embodiment, since the rising edge of the input pulse is counted from the rising edge to the next rising edge, when the next rising edge cannot be detected, the count value continues to increase and is reset to 0. If not started, a new input frequency count value is not set in the
[0039]
Then, for example, even when the frequency of the input pulse suddenly fluctuates and decreases or stops, the count value based on the previous input pulse frequency is latched in the
[0040]
Therefore, as described above, when the frequency of the input pulse is equal to or lower than the set frequency, the input frequency is determined to be 0, and the
[0041]
An output frequency count value is obtained based on the input frequency count value latched in the
[0042]
In the present embodiment, since the processing is performed with the count value corresponding to the frequency, the count value increases as the frequency decreases. Therefore, in practice, whether the input frequency of the input pulse currently being counted is a frequency equal to or lower than the input frequency lower limit set value is determined by storing the count value of the
[0043]
Specifically, for example, when the
[0044]
The actual operation of this input lower limit frequency setting function is, for example, as shown in FIG. That is, if the input pulse is as shown in FIG. 8 (a), the end of one cycle of the first pulse output (1) as shown in FIG. 8 (b) (rising edge of the second pulse output). ) (Actually several clocks before), since the frequency count value (t) of the leading input pulse is latched in the latch unit, the output frequency based on the frequency count value is obtained and the obtained output is obtained. A second pulse output {circle around (2)} is generated according to the frequency.
[0045]
By the way, if the input continues for a certain period after the second input pulse is input, the
[0046]
Here, if the lower limit of the input frequency is 100 Hz, the input frequency lower limit setting value is a count value corresponding to 10 msec. Accordingly, at the end of one cycle of the fourth pulse output (4), the count value in the
[0047]
In the case of the present embodiment, since the frequency of the next pulse output is calculated and set by using the pulse output operation (end of one cycle) as a trigger, when the pulse output continues in the OFF state in this way. The request signal is not output, and the frequency of the next pulse output cannot be calculated. Therefore, when the output becomes 0 based on the input frequency lower limit setting value in this way, the
[0048]
Further, an output frequency lower limit set value set in the output frequency lower
[0049]
For example, as shown in FIG. 8, when the output frequency lower limit set value is “256” and the ratio set value is “6”, the output frequency of the calculation result is obtained when the input frequency count value is “32”. Although the count value is output as it is, since the calculation result is “384” when the input frequency count value becomes “64”, the output frequency lower limit set value “256” is determined as the output frequency set value and output.
[0050]
Furthermore, since the
[0051]
As described above, in the present embodiment, the frequency to be output next is calculated and output for each pulse of the pulse output, so that the accuracy of the control cycle is greatly improved.
[0052]
Furthermore, using the operation on the pulse output side as a trigger, when one cycle of one pulse output ends (rising of the next pulse output), the frequency of the input pulse immediately before is obtained, and a predetermined ratio setting value is obtained based on that Accordingly, the frequency of the pulse output is obtained according to the above, so that the fluctuation of the output frequency accompanying the fluctuation of the input frequency can be performed in real time, and more accurate synchronization control can be performed. Since the latest frequency count value of the input pulse has already been obtained, the ratio
[0053]
【The invention's effect】
As described above, according to the present invention, the change in the input frequency can be quickly reflected in the output frequency.
[Brief description of the drawings]
FIG. 1 is a diagram illustrating an example of a control system using output pulses output from a CPU unit of a PLC.
FIG. 2 is a time chart illustrating a conventional operation.
FIG. 3 is a diagram showing an embodiment of the present invention.
FIG. 4 is a diagram for explaining the operation of a ratio divider.
FIG. 5 is a timing chart illustrating the operation of the present embodiment.
FIG. 6 is a part of a flowchart for explaining the operation of the present embodiment;
FIG. 7 is a part of a flowchart for explaining the operation of the present embodiment;
FIG. 8 is a diagram for explaining an input frequency lower limit setting function;
FIG. 9 is a diagram for explaining an output frequency lower limit setting function;
[Explanation of symbols]
10 CPU unit 11 I /
Claims (5)
その入力周波数検出部で求めた前記周波数情報を記憶する記憶手段と、
その記憶手段に格納された前記周波数情報に対し、予め定めた比率設定値に基づいて演算処理をしてパルス出力の出力周波数設定値を算出する算出手段と、
その算出手段から出力される前記出力周波数設定値に基づき、パルス出力を行うパルス出力手段とを備え、
前記パルス出力手段は、パルス出力の状態に基づいて前記算出手段へ前記演算処理の実行を指示するリクエスト信号を出力する機能を備え、
前記算出手段は、前記パルス出力手段からリクエスト信号を受信すると前記演算処理を実行することを特徴とするコントローラ。An input frequency detector for obtaining frequency information of the input pulse;
Storage means for storing the frequency information obtained by the input frequency detector;
Calculation means for calculating the output frequency setting value of the pulse output by performing arithmetic processing based on a predetermined ratio setting value for the frequency information stored in the storage means;
Based on the output frequency setting value output from the calculation means, comprises pulse output means for performing pulse output,
The pulse output means has a function of outputting a request signal instructing the calculation means to execute the arithmetic processing based on a state of pulse output,
The controller, wherein the calculation means executes the arithmetic processing when receiving a request signal from the pulse output means.
前記期間が一定以上の場合にパルス出力を停止する機能を備えたことを特徴とする請求項1または2に記載のコントローラ。When the rising or falling edge of the input pulse is used as a reference change point, the input frequency detecting means detects the reference change point and detects the next reference change point based on a period from the detection of the reference change point. To find frequency information,
The controller according to claim 1, further comprising a function of stopping pulse output when the period is equal to or greater than a certain period.
前記算出手段は、演算処理をして求められたパルス出力の出力周波数設定値が前記記憶手段に格納された出力周波数下限設定値よりも低い周波数になる場合に、その出力周波数下限設定値を出力周波数設定値として出力するようにしたことを特徴とする請求項1〜3の何れか1項に記載のコントローラ。Storage means for storing the output frequency lower limit set value;
The calculation means outputs the output frequency lower limit setting value when the output frequency setting value of the pulse output obtained by the arithmetic processing is lower than the output frequency lower limit setting value stored in the storage means. The controller according to any one of claims 1 to 3, wherein the controller outputs the frequency setting value.
コントローラの動作中に、前記比率設定値記憶手段に記憶された前記比率設定値を変更する手段を備えたことを特徴とする請求項1〜4の何れか1項に記載のコントローラ。Providing ratio setting value storage means for storing the ratio setting value,
The controller according to any one of claims 1 to 4, further comprising means for changing the ratio setting value stored in the ratio setting value storage means during operation of the controller.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002073175A JP3951760B2 (en) | 2002-03-15 | 2002-03-15 | controller |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002073175A JP3951760B2 (en) | 2002-03-15 | 2002-03-15 | controller |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2003271206A JP2003271206A (en) | 2003-09-26 |
JP3951760B2 true JP3951760B2 (en) | 2007-08-01 |
Family
ID=29202972
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002073175A Expired - Lifetime JP3951760B2 (en) | 2002-03-15 | 2002-03-15 | controller |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3951760B2 (en) |
-
2002
- 2002-03-15 JP JP2002073175A patent/JP3951760B2/en not_active Expired - Lifetime
Also Published As
Publication number | Publication date |
---|---|
JP2003271206A (en) | 2003-09-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JPS60131465A (en) | Detector for rotating speed | |
JP2009121484A (en) | Engine crankshaft position recognition and tracking method applicable to cam and crank shaft signal with arbitrary pattern | |
JP3951760B2 (en) | controller | |
US6442704B1 (en) | Ring oscillator clock frequency measuring method, ring oscillator clock frequency measuring circuit, and microcomputer | |
JP6455247B2 (en) | Motor control circuit and electronic timepiece | |
JP6237303B2 (en) | Crank angle detector | |
JPH08214585A (en) | Motor controller | |
JP2004088987A (en) | Motor speed controller and controlling method | |
CN115001325B (en) | Timed interrupt control method and multi-step motor synchronous control system and method | |
JP2008089409A (en) | Rotational speed detector | |
JPH0573363A (en) | Watchdog timer device | |
JP2839514B2 (en) | Numerical controller with parallel processing function | |
JP3347987B2 (en) | Serial communication controller | |
JPS61257690A (en) | Controller for sewing machine | |
JPH03139191A (en) | Speed controller for induction motor | |
JPH01304360A (en) | Method for detecting speed of motor | |
JPH08194556A (en) | Controller for cam switch | |
JP2022038275A (en) | Motor control unit and motor control method | |
JP3985588B2 (en) | Counting device and counting system | |
JP2740953B2 (en) | Spindle fixed position stop control device | |
JPH01216626A (en) | Pulse count circuit | |
JPH03198679A (en) | Detecting device for arrival at steady range in motor controller | |
JPS61257689A (en) | Controller for sewing machine | |
JPH0839298A (en) | Slide stop time measuring instrument of press machine | |
JPH0632742B2 (en) | Sewing machine controller |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20041125 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20061221 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070109 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070312 |
|
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: 20070403 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070416 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 Ref document number: 3951760 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: 20100511 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110511 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120511 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130511 Year of fee payment: 6 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140511 Year of fee payment: 7 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
EXPY | Cancellation because of completion of term |