JP2004015153A - Counter and counter system - Google Patents
Counter and counter system Download PDFInfo
- Publication number
- JP2004015153A JP2004015153A JP2002162487A JP2002162487A JP2004015153A JP 2004015153 A JP2004015153 A JP 2004015153A JP 2002162487 A JP2002162487 A JP 2002162487A JP 2002162487 A JP2002162487 A JP 2002162487A JP 2004015153 A JP2004015153 A JP 2004015153A
- Authority
- JP
- Japan
- Prior art keywords
- pulse
- count
- value
- counting
- count 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.)
- Granted
Links
Images
Landscapes
- Measurement Of Unknown Time Intervals (AREA)
- Programmable Controllers (AREA)
Abstract
Description
【0001】
【産業上の利用分野】
この発明は、計測制御等に用いる計数装置及び計数システム、特に、測長、測角、測量に用いる光電式エンコーダ装置等と組み合わせて、パルス信号のパルス数等を計数する計数装置、及び計数装置で計数された計数値を用いて所定の制御を行う計数システムに関する。
【0002】
【従来の技術】
測長、測角、測量に用いる機器にエンコーダがある。エンコーダを簡単に説明すると、いろいろな情報を符号化する一種の変換器といってよい。エンコーダの種類の一つにロータリエンコーダがある。ロータリエンコーダは回転軸の回転角変位をデジタル量に変換する一種の回転角センサーである。そのセンサーで長さ、角度、量等を測定する。
近年、ロータリエンコーダはもっぱら光電式になっている。光電式エンコーダは、回転軸に固定された回転円板に複数個の放射状スリットを環状に配置し、回転円板に平行に設けられた固定円板の一部に固定スリットを設け、回転円板と固定円板の両方を挟んで発光素子と受光素子を配置し、回転円板と固定円板の両スリットを通過した光を信号として回転軸の回転量を検出している。
【0003】
このように出力された光電信号はパルス状、即ちデジタル信号であるので適当なデジタルカウンタでこの信号を計数し、パルス数に対し演算を行うことで、測定対象の物理量を求めることが可能である。
具体的には
・「パルス数」×「1パルスあたりの移動量」=総移動量
・「パルス数」×「1パルスあたりの重量」=総重量
・「パルス数」×「1パルスあたりの角度量」=総変位角
・「パルス数」×「1パルスあたりの長さ」=測定物の長さ
といった具合である。
【0004】
次に図6〜図12を用いて、従来のパルス列計測制御システム(計数システム)について説明する。
図6はパルス列計測制御システムの外観を示す図、図7はパルス計数ユニット(計数装置)のカウント回路の動作タイミングチャート図である。
図6において、1001は外部から入力されたパルス列を計数する機能を実現するパルス計数ユニットで、図7に示すように、パルス列の立ち上がりでカウントし、パルスカウント値をインクリメント(+1処理)する。
1002は計数されたパルス列数を使ってシステムを制御するコントローラ、1003はコントローラ1002とパルス計数ユニット1001が動作するための電力を供給する電源ユニットである。
【0005】
図8はコントローラ1002で実行されるパルス計数ユニット1001のパルス列計数(パルスカウント)開始処理手順のフローである。
先ずカウント処理を開始する前に、ステップ1021でパルスカウント設定値を設定する。
次にステップ1022でパルスカウント開始指令を行う。
このとき、単に純粋に外部からのパルスを計数するだけであれば、ステップ1021は不要である。
【0006】
ところで、パルス計数ユニット1001の機能の一つには、単純に外部からのパルス列入力をカウントし、計数値をユニット内部に蓄えるというものもある。コントローラ1002側は任意のタイミングでその蓄えられた計数値を読み出せば、外部から入力されたパルス数を知ることができる。
【0007】
ただし、コントローラ1002はパルス列計数値を読み出すだけがその処理内容ではなく、その他の制御処理を行う必要がある。よって通常はパルス計数ユニット1001に対し、目的とするパルス入力数を設定し、パルス入力数がその設定値に達したタイミングで、パルス計数ユニット1001からコントローラ1002に割込み信号を発行し、パルス入力数がその設定値に達したことを通知したり、またはハンドシェイク用の制御信号をアサート(アクティブ状態、即ち信号として動作した状態)したりすることで通知する。
【0008】
図9はコントローラ1002に格納されるシステム制御用のユーザプログラム例である。
1031は割り込みを許可する命令、1032はメインプログラム、1033はメインプログラムの終了を意味する命令、1034は割り込みプログラムの開始を意味する割り込みポインタ、1035は割り込みプログラム本体、1036は割り込みプログラムの終了を意味する命令である。
【0009】
メインプログラム1032にはコントローラ1002として行うべき制御内容のプログラムが記述される。割り込みプログラム1035には外部からの割込みに特化した内容のプログラムが記述される。この従来例の場合は、パルス計数ユニット1001からの割込みに応答した内容のプログラムが記述される。
【0010】
図10はコントローラ1002の割込み処理の処理フローを示す。
通常 コントローラ1002は、外部からの入力処理→プログラム実行→外部への出力処理を一周期として繰り返すことでプログラムを実行している。この一周期の時間をスキャンタイムと呼ぶ。従って、スキャンタイムより短い信号は入力できない。よって、スキャンタイムより短い信号、即ちパルスを入力し、計数するために、パルス計数ユニット1001が必要になる。
また割込み処理を使えば、スキャンタイムに依存せずに割り込みが発生した時点で処理ができる。割込みが発生すると、メインプログラム1032の実行をその場で一旦中断し、割込み要因に応じた割込みプログラム1035を実行する。割込みプログラム1035が終了すると、割込み発生時の次の命令へ戻り、中断していたメインプログラム1032の処理を再開する。
【0011】
図11はパルス計数ユニット1001の処理フローを示す。
1050はパルス発生源で、具体的には先に説明した光電式エンコーダが相当する。
パルス計数ユニット1001はステップ1051でパルスカウント設定値を読み出し、ステップ1052で外部からのパルス入力を計数する。次にステップ1053でパルスカウント設定値と計数したパルスカウント値が一致するか比較する。一致しなければ再度ステップ1052に戻り、パルス計数処理を行う。ステップ1053でパルスカウント設定値と計数したパルスカウント値が一致したと判断した場合は、ステップ1054でコントローラ1002に対して、割り込みを発行する。
【0012】
このように外部からパルス計数ユニット1001に入力されたパルス列は図11の手順で処理され、計数値がユーザの設定したパルスカウント設定値に達したならば、コントローラ1002に割り込みが発行される。コントローラ1002は通常はメインプログラム1032を実行しているが、パルス計数ユニット1001からの割り込みを受けたらば、割り込みプログラム1035を実行する。
【0013】
【発明が解決しようとする課題】
本従来例の場合、予め設定しておいたパルスカウント設定値にパルス列数が達したため、コントローラ1002に割り込みが入り、該当の割込みプログラム1035が実行されるが、上述した従来のパルス計数ユニット1001においては、予め割込みを発行するタイミングのパルス数がユーザで判っていないと、この機能は使えない。且つ割込みを発生させたとしてもパルスカウント動作を停止するわけでもなく、また外部のパルス信号も停止するわけではないため、割込み発生タイミングとカウント値が一意に決まらない。
【0014】
なお、割込みを発生させて、割り込みプログラム1035中でパルス計数値を取得するようにしても、その問題は解決しない。
以下その理由を、図12を用いて説明する。
図12は従来のパルス計数ユニット1001の計数処理とコントローラ1002の割込み処理の関係を示す。
【0015】
図9に示すように、メインプログラム1032の実行中に割込み許可命令1031を実行しない限り、外部からの割込みを認識することはできない。もし割込みを許可しておかないと、即ち割込み禁止状態であると、外部からの割込みは受付けられないし、当然ながら割込みプログラム1035は実行できない。よって割り込みプログラム1035中でパルス計数値を取得するようにしても、結局はパルス計数値の取得はできない。仮に割込みを許可したとしても、図12に示すように、割込みを許可するタイミングがずれると、パルス計数値と割込み許可命令の実行タイミングによって、実際に入力できるパルス計数値と入力したいパルス計数値の値にずれが生じる。
【0016】
この発明はかかる問題点に鑑みてなされたものであって、外部から入力されたパルス列数の正確な値を最短の時間で入手できる計数装置及び計数システムを得ることを目的とする。
【0017】
【課題を解決するための手段】
この発明に係る計数装置は、前記目的を達成させるため、装置外部からパルス列を入力して該パルス列を計数し、この計数した計数値が、この計数値を用いて制御を行うコントローラにて読み取られる計数装置において、前記パルス列の計数処理中に、装置外部からのトリガ信号が印加されたときパルス列数の計数値をラッチする手段と、前記トリガ信号が印加されたとき前記コントローラに対して割り込みを発行する手段と、前記ラッチされたパルス計数値が読出し完了したとき前記ラッチされたパルス計数値をクリアする手段とを備えてなるものである。
【0018】
またこの発明に係る計数装置は、前記ラッチされたパルス計数値の読出しを完了したとき、前記パルス列の計数処理を行うカウント現在値格納レジスタに所定のプリセット値を与えるものである。
【0019】
またこの発明に係る計数システムは、装置外部からパルス列を入力して該パルス列を計数する計数装置と、この計数装置にて計数した計数値を読み取り、この読み取った計数値を用いて制御を行うコントローラとを備えてなる計数システムにおいて、前記計数装置が、前記パルス列の計数処理中に、装置外部からのトリガ信号が印加されたときパルス列数の計数値をラッチする手段と、前記トリガ信号が印加されたとき前記コントローラに対して割り込みを発行する手段と、前記ラッチされたパルス計数値が読出し完了したときラッチされたパルス計数値をクリアする手段とを有するとともに、前記コントローラが、前記計数装置より割込みを受けたとき割込みプログラムを実行し、前記計数装置にラッチされた計数値を読み取る手段を有するものである。
【0020】
またこの発明に係る計数システムは、前記ラッチされたパルス計数値の読出しを完了したとき、前記パルス列の計数処理を行うカウント現在値格納レジスタに所定のプリセット値を与えるものである。
【0021】
【発明の実施の形態】
実施の形態1.
以下にこの発明に係わるパルス計数ユニット(計数装置)及びパルス列計測制御システム(計数システム)の実施の形態1について、図1〜図5を用いて説明する。
図1はこの発明に係わるパルス列計測制御システムの回路ブロックを示したものである。
図1において、1はパルス計数ユニット、2はコントローラ、3はコントローラ2内のMPU、4はコントローラ2がMPU3で実行するプログラムを格納するためのプログラム格納部、5はパルス計数ユニット1から出力される割り込みを検出するための割込み検出部である。
【0022】
また6は外部から入力されたパルス列を計数するパルス列計数部、7はパルス列計数部6が計数したパルス数のカウント現在値を格納するカウント現在値格納レジスタ、8はカウント現在値をラッチするためのカウント現在値ラッチ部、9はカウント現在値格納レジスタ7とカウント現在値ラッチ部8を接続するバススイッチである。また10はパルス列計数中にユニット外部からのトリガを検出するトリガ検出部、11はトリガ検出部10からユニット外部トリガを受けてコントロ−ラ2に割り込みを発行する割込み発生部である。
【0023】
また12はユニット外部からのプリセット要求を検出し、カウント現在値ラッチ部8に伝えるプリセット要求検出部、13はプリセット要求検出部12から指令を受けてカウント現在値格納レジスタ7にプリセット値をセットするプリセット値格納部で、ユニット外部からプリセット要求を受付けたタイミングでプリセット動作ができるように、予めプリセット値が格納されている。14はユニット外部からの読み出し要求を検出する読出し要求検出部である。
【0024】
なお、トリガ検出部10は、ユニット外部からトリガ信号受けたタイミングでバススイッチ9と割込み発生部11に同時に信号出力する。
またバススイッチ9は、その出力を受けて内部回路の端子A−端子Cの接続を端子B−端子Cの接続に切替える。即ち、外部からトリガの入った1パルス時間だけバススイッチ接点を端子A−端子Cの接続から端子B−端子Cにつなぎかえる。
よってカウント値現在値格納レジスタ7に格納されているパルス計数値の現在値が一回だけカウント現在値ラッチ部8に入り、その結果、パルス計数値の現在値がラッチされることになる。カウント現在値ラッチ部8がラッチ中は、ラッチデータが有効な状態で新たなトリガを受けても、トリガ検出部10がそのトリガを認識しないようにインターロックをとるため、カウント現在値ラッチ部8はトリガ検出部10に対し信号出力し、「現在ラッチ動作中」であることを伝える。(端子Aはどこにも接続されていない。外部からトリガが入った1パルス時間だけ端子B−端子Cをつなぐために、平素は端子A−端子Cで定常状態にしておくために端子Aがある)
【0025】
割込み発生部11はトリガ検出部10からの信号出力を受けて、コントローラ2に対し割り込みを発行する。
コントローラ2は従来例にて説明したように、図9のプログラムはプログラム格納部4に格納されており、パルス計数ユニット1から割込みが入ったタイミングで、割り込みポインタIxxx1034から始まる割り込みプログラム1035を実行する。
【0026】
図2はパルス計数ユニット1の具体的な処理手順を示すフローである。
ユニット外部からのパルス列を入力中に、ステップ20にて外部からのトリガの有無をトリガ検出部10が確認し、外部からのトリガが無ければバススイッチ9の端子A−端子Cを端子B−端子Cにつなぎ変える必要はないため、ステップ23にてパルス列計数部6でパルスのカウントを続け、ステップ24でカウント現在値をカウント現在値格納レジスタ7へ格納する。
【0027】
ステップ20にて外部からのトリガが有ると判断した場合は、ステップ21にて、バススイッチ9の端子A−端子Cを端子B−端子Cにつなぎ変える必要があるため、トリガ検出部10の出力を受けてバススイッチ9でカウント現在値格納レジスタ7とカウント現在値ラッチ部8を接続し、ステップ22にてコントローラ2へ割込みを発行する。この割込みは外部からトリガがあり、「トリガが入ったタイミングのパルス計数値をラッチしているので読み出してよい」という読み出し指令を兼ねている。
【0028】
コントローラ2は割り込みを受けた後はメインプログラム1032の実行を一時中断し、割り込みプログラム1035を実行する。通常はこの割込みプログラム1035内でパルス計数ユニット1にアクセスし、カウント現在値ラッチ部8にラッチされているカウント値を読み出す。
このとき同時にプリセット要求で、読出し信号がディアサートしたタイミングでカウント現在値格納レジスタ7をプリセットするか、それともフリーカウンタ(カウント処理継続)にするかを決める。
【0029】
次に図3に示す、コントローラ2がラッチされたパルスカウント値を読み出した直後のパルス計数ユニット1の処理手順を、図4及び図5も参照して説明する。
【0030】
ステップ31にてラッチカウントの読み出しが完了したと判断した後は、ステップ32においてプリセット要求検出部12でプリセット要求信号のON/OFFを判別する。OFFであればプリセット要求はないものと判断し、ステップ34でカウント現在値ラッチ部8をクリアし、カウント現在値格納レジスタ7の内容はそのままとする。即ち、カウント現在値格納レジスタ7をプリセットしないフリーカウンタとして使用することになる。
ステップ32においてプリセット要求検出部12でプリセット要求がONであると判断した場合は、プリセット値格納部13に指定されたプリセット値をカウント現在値格納レジスタ7にセットする(ステップ33)。なお、プリセット値セット後はその値からパルス列カウント動作がスタートする。またこの場合であっても、ステップ34でカウント現在値ラッチ部8はクリアする。
【0031】
図4はパルス計数ユニット1のカウント回路の、プリセット動作を行わない場合の動作タイミングチャート図である。
図5はパルス計数ユニット1のカウント回路の、プリセット動作を行う場合の動作タイミングチャート図である。
カウント現在値格納レジスタ7に更新され続けるカウント値は、外部トリガ信号の印加により、カウント現在値ラッチ部8に転送される。その間もカウント現在値格納レジスタ7はカウントされ続けている。
【0032】
外部トリガ信号の印加のタイミングで1回だけカウント現在値ラッチ部8に転送されることから、転送されたカウント値はラッチ状態となる。読出し信号がアサート(アクティブ状態、即ち信号として動作した状態)されると、カウント現在値ラッチ部8より読み出される。読出し信号がディアサート(非アクティブ状態)になると、カウント現在値ラッチ部8は”0”クリアされる。単なるラッチ目的の場合、”0”クリアは必要ないが、ユーザによってはカウンタ値=0と≠0の場合で、処理を区別している場合があるので、本実施の形態1ではカウント現在値ラッチ部8は”0”クリアされる。
【0033】
本実施の形態1のカウント回路では読出しのためにカウント値をラッチしており、カウント値の読出しが終了した後、”0”クリアされる。また、カウント現在値格納レジスタ7は予め設定されたプリセット値にセットされる。
図4ではカウント値の読出しが終了した後、プリセット要求はアサートされていないことから、カウント現在値ラッチ部8が”0”クリアされても、カウント現在値格納レジスタ7は、それまでにカウントした値より引続いてカウントする。
図5ではカウント値の読出しが終了した後、プリセット要求はアサートされていることから、カウント現在値ラッチ部8が”0”クリアされると、プリセット値格納部13の値でカウント現在値格納レジスタ7はプリセットされ、そのプリセットされた値より引続いてカウントする。
【0034】
以上説明したように、この実施の形態1によれば、ユニット外部からトリガ信号が印加されたタイミングでパルス列数の計数値をラッチするため、測定対象の物理量の測定完了タイミングで正確に測定結果をユニット内に取り込むことができる。
【0035】
またユニット外部からトリガ信号が印加されたタイミングでパルス列数の計数値をラッチした直後にコントローラ2に割込みを掛け、割込みを受けたコントローラ2は割込みプログラム1035を実行できるため、コントローラ2のスキャンタイムに依存せず、ラッチされたパルス列数を演算することができる。即ち、パルス列数の制御に対し遅れ時間を最小にできる。
【0036】
また、ラッチされたパルス列数値の読出し完了タイミングでラッチされたパルス計数値を自動的にクリアするため、ユーザプログラムでクリアする余計な手間が省ける。ユーザにとっては余分な処理が不要になり、かつカウント現在値ラッチ部8が0クリアされているということは読出しが正常に完了したという保証になりユーザは安心してパルス列数の演算が可能である。
【0037】
さらにプリセット要求を使用することで、自動的にカウント現在値格納レジスタ7の値を任意の数値に書き換えることができるので、パルス列の計数動作に初期値を与えることができる。
【0038】
具体例としては下記の2点ほどが挙げられる。
▲1▼外部からトリガが印加され、パルス列数のカウント現在値を読み出した直後から、必ずユーザが所望した初期値からカウント動作が始まるため、定周期でカウンタ値を取り込む必要があるシステムではカウント現在値の変動幅が読み取りやすくなる。
▲2▼外部からトリガが入った直後にパルス列数の現在値がオーバフローした場合、プリセット要求を行わないと、フリーカウンタ(カウント処理継続)として動作するため、オーバフローしたままになってしまうが、プリセット要求によりカウント現在値格納レジスタ7はユーザの所望する値に上書きされ、その値からパルス列カウント動作がスタートすることから、そのままカウント動作を続けることができる。
【0039】
【発明の効果】
以上説明したようにこの発明によれば、ユニット外部からトリガ信号が印加されたタイミングでパルス列数の計数値をラッチするため、測定対象の物理量の測定完了タイミングで正確に測定結果をユニット内に取り込むことができる。
またユニット外部からトリガ信号が印加されたタイミングでパルス列数の計数値をラッチした直後にコントローラに割込みをかけ、割込みを受けたコントローラは割込みプログラムを実行できるため、コントローラのスキャンタイムに依存せず、ラッチされたパルス列数を演算することができる。
また、ラッチされたパルス列数値の読出し完了タイミングでラッチされたパルス計数値を自動的にクリアするため、ユーザプログラムでクリアする余計な手間が省ける。
【0040】
さらに自動的にカウント現在値格納レジスタの値を任意の数値に書き換えることができるので、パルス列の計数動作に初期値を与えることができる。
【図面の簡単な説明】
【図1】この発明の実施の形態1に係わるパルス列計測制御システム(計数システム)の回路ブロックを示す図である。
【図2】この発明の実施の形態1に係わるパルス計数ユニット(計数装置)の処理手順を示すフローチャートである。
【図3】この発明の実施の形態1に係わるコントローラがラッチされたパルスカウント値を読み出した直後のパルス計数ユニットの処理手順を示しフローチャートである。
【図4】この発明の実施の形態1に係わるパルス計数ユニットのカウント回路の、プリセット動作を行わない場合の動作タイミングチャート図である。
【図5】この発明の実施の形態1に係わるパルス計数ユニットのカウント回路の、プリセット動作を行う場合の動作タイミングチャート図である。
【図6】従来例におけるパルス列計測制御システムの外観図である。
【図7】従来例におけるパルス計数ユニットのカウント回路の動作タイミングチャート図である。
【図8】従来例におけるコントローラで実行されるパルス計数ユニットのパルス列計数開始処理手順を示すフローチャートである。
【図9】従来例におけるコントローラに格納されるシステム制御用のユーザプログラム例を示す図である。
【図10】従来例におけるコントローラの割込み処理の処理フローチャートである。
【図11】従来例におけるパルス計数ユニットの処理フローチャートである。
【図12】従来例のパルス計数ユニットの計数処理とコントローラの割込み処理の関係を示す図である。
【符号の説明】
1 パルス計数ユニット、2 コントローラ、3 MPU、4 プログラム格納部、5 割り込み検出部、6 パルス列計数部、7 カウント現在値格納レジスタ、8 カウント現在値ラッチ部、9 バススイッチ、10 外部トリガ検出部、11 割り込み発生部、12 割り込み発生部、13 プリセット値格納部、14 読出し要求検出部。[0001]
[Industrial applications]
The present invention relates to a counting device and a counting system used for measurement control and the like, in particular, a counting device and a counting device for counting the number of pulses of a pulse signal in combination with a photoelectric encoder device and the like used for length measurement, angle measurement, and surveying. The present invention relates to a counting system that performs a predetermined control using the count value counted by the counter.
[0002]
[Prior art]
Devices used for length measurement, angle measurement, and surveying include encoders. Briefly describing an encoder, it can be called a kind of converter that encodes various information. One type of encoder is a rotary encoder. A rotary encoder is a kind of rotation angle sensor that converts a rotation angle displacement of a rotation shaft into a digital amount. The sensor measures the length, angle, amount, etc.
In recent years, rotary encoders are exclusively photoelectric. The photoelectric encoder is configured such that a plurality of radial slits are annularly arranged on a rotating disk fixed to a rotating shaft, and a fixed slit is provided on a part of the fixed disk provided in parallel with the rotating disk. The light-emitting element and the light-receiving element are arranged so as to sandwich both the fixed disk and the fixed disk, and the amount of rotation of the rotating shaft is detected by using light passing through both slits of the rotating disk and the fixed disk as a signal.
[0003]
Since the photoelectric signal output in this manner is a pulse signal, that is, a digital signal, it is possible to obtain a physical quantity to be measured by counting this signal with an appropriate digital counter and performing an operation on the number of pulses. .
Specifically, "number of pulses" x "movement amount per pulse" = total movement amount "" number of pulses "x" weight per pulse "= total weight ・" number of pulses "x" angle per pulse " “Amount” = total displacement angle / “number of pulses” × “length per pulse” = length of measured object.
[0004]
Next, a conventional pulse train measurement control system (counting system) will be described with reference to FIGS.
FIG. 6 is a diagram showing the appearance of the pulse train measurement control system, and FIG. 7 is an operation timing chart of the count circuit of the pulse counting unit (counting device).
In FIG. 6,
[0005]
FIG. 8 is a flowchart of a pulse train counting (pulse count) start processing procedure of the
First, before starting the count processing, a pulse count set value is set in step 1021.
Next, in step 1022, a pulse count start command is issued.
At this time, if the pulse from the outside is simply counted, step 1021 is unnecessary.
[0006]
Incidentally, one of the functions of the
[0007]
However, the
[0008]
FIG. 9 is an example of a system control user program stored in the
1031 is an instruction for permitting an interrupt, 1032 is a main program, 1033 is an instruction for ending the main program, 1034 is an interrupt pointer for starting an interrupt program, 1035 is an interrupt program main body, and 1036 is an end for the interrupt program. It is an instruction to do.
[0009]
In the main program 1032, a program of control contents to be performed as the
[0010]
FIG. 10 shows a processing flow of the interrupt processing of the
Normally, the
Also, if the interrupt processing is used, the processing can be performed at the time when the interrupt occurs without depending on the scan time. When an interrupt occurs, the execution of the main program 1032 is temporarily interrupted on the spot, and the
[0011]
FIG. 11 shows a processing flow of the
The
[0012]
The pulse train input to the
[0013]
[Problems to be solved by the invention]
In the case of the conventional example, since the number of pulse trains has reached the preset pulse count set value, an interrupt is input to the
[0014]
Note that, even if an interrupt is generated and the pulse count value is obtained in the interrupt
Hereinafter, the reason will be described with reference to FIG.
FIG. 12 shows the relationship between the counting process of the conventional
[0015]
As shown in FIG. 9, unless an interrupt
[0016]
The present invention has been made in view of such a problem, and an object of the present invention is to provide a counting device and a counting system capable of obtaining an accurate value of the number of pulse trains input from the outside in the shortest time.
[0017]
[Means for Solving the Problems]
In order to achieve the above object, the counting device according to the present invention inputs a pulse train from the outside of the device, counts the pulse train, and reads the counted value by a controller that performs control using the counted value. A counting device that latches a count value of the number of pulse trains when a trigger signal is applied from outside the device during the counting process of the pulse train, and issues an interrupt to the controller when the trigger signal is applied And means for clearing the latched pulse count value when the latched pulse count value has been read out.
[0018]
Further, in the counting device according to the present invention, when the reading of the latched pulse count value is completed, a predetermined preset value is given to a count current value storage register that performs the pulse train counting process.
[0019]
Further, a counting system according to the present invention includes a counting device that inputs a pulse train from the outside of the device and counts the pulse train, and a controller that reads a count value counted by the counting device and performs control using the read count value. In the counting system, the counting device latches a count value of the number of pulse trains when a trigger signal is applied from outside the device during the counting process of the pulse train, and the trigger signal is applied. Means for issuing an interrupt to the controller when the counter has been read, and means for clearing the latched pulse count when the read of the latched pulse count has been completed. Means for executing an interrupt program when receiving the count value and reading the count value latched by the counting device. It is intended.
[0020]
Further, in the counting system according to the present invention, when the reading of the latched pulse count value is completed, a predetermined preset value is given to a count current value storage register for performing the pulse train counting process.
[0021]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, a first embodiment of a pulse counting unit (counting device) and a pulse train measurement control system (counting system) according to the present invention will be described with reference to FIGS.
FIG. 1 shows a circuit block of a pulse train measurement control system according to the present invention.
In FIG. 1, 1 is a pulse counting unit, 2 is a controller, 3 is an MPU in the
[0022]
[0023]
[0024]
The
The bus switch 9 receives the output and switches the connection between the terminals A and C of the internal circuit to the connection between the terminals B and C. That is, the connection of the bus switch is changed from the connection from the terminal A to the terminal C to the terminal B to the terminal C for one pulse time when a trigger is input from the outside.
Therefore, the current value of the pulse count value stored in the count value current
[0025]
The interrupt
As described in the conventional example, the
[0026]
FIG. 2 is a flowchart showing a specific processing procedure of the
During the input of the pulse train from the outside of the unit, the
[0027]
If it is determined in
[0028]
After receiving the interrupt, the
At this time, at the same time as a preset request, it is determined whether to preset the current count
[0029]
Next, the processing procedure of the
[0030]
After it is determined in step 31 that the reading of the latch count has been completed, in step 32, the
If the
[0031]
FIG. 4 is an operation timing chart of the count circuit of the
FIG. 5 is an operation timing chart when the preset operation of the count circuit of the
The count value continuously updated in the count current
[0032]
Since the count value is transferred to the current
[0033]
The count circuit of the first embodiment latches the count value for reading, and is cleared to "0" after the reading of the count value ends. The count current
In FIG. 4, since the preset request is not asserted after the reading of the count value is completed, even if the count current
In FIG. 5, since the preset request is asserted after the reading of the count value is completed, when the count current
[0034]
As described above, according to the first embodiment, since the count value of the number of pulse trains is latched at the timing when the trigger signal is applied from the outside of the unit, the measurement result can be accurately obtained at the timing when the measurement of the physical quantity to be measured is completed. Can be taken into the unit.
[0035]
In addition, immediately after the count value of the number of pulse trains is latched at the timing when a trigger signal is applied from the outside of the unit, an interrupt is issued to the
[0036]
Also, since the latched pulse count value is automatically cleared at the timing when the reading of the latched pulse train numerical value is completed, unnecessary labor for clearing by the user program can be omitted. No extra processing is required for the user, and the fact that the count current
[0037]
Further, by using the preset request, the value of the current count
[0038]
Specific examples include the following two points.
(1) Immediately after a trigger is applied from the outside and the current count value of the number of pulse trains is read out, the count operation always starts from the initial value desired by the user. The value fluctuation range becomes easier to read.
{Circle around (2)} If the current value of the number of pulse trains overflows immediately after the external trigger is input, the counter will operate as a free counter (continue count processing) unless a preset request is issued. The count current
[0039]
【The invention's effect】
As described above, according to the present invention, the count value of the number of pulse trains is latched at the timing when the trigger signal is applied from the outside of the unit, so that the measurement result is accurately taken into the unit at the timing of completing the measurement of the physical quantity to be measured. be able to.
Also, immediately after latching the count value of the number of pulse trains at the timing when a trigger signal is applied from the outside of the unit, an interrupt is issued to the controller, and the interrupted controller can execute the interrupt program, regardless of the scan time of the controller. The number of latched pulse trains can be calculated.
In addition, since the latched pulse count value is automatically cleared at the timing when the reading of the latched pulse train numerical value is completed, unnecessary work of clearing the pulse count value by the user program can be omitted.
[0040]
Further, since the value of the count current value storage register can be automatically rewritten to an arbitrary value, an initial value can be given to the pulse train counting operation.
[Brief description of the drawings]
FIG. 1 is a diagram showing circuit blocks of a pulse train measurement control system (counting system) according to
FIG. 2 is a flowchart showing a processing procedure of a pulse counting unit (counting device) according to the first embodiment of the present invention.
FIG. 3 is a flowchart illustrating a processing procedure of the pulse counting unit immediately after the controller according to the first embodiment of the present invention reads out the latched pulse count value.
FIG. 4 is an operation timing chart of the count circuit of the pulse counting unit according to the first embodiment of the present invention when a preset operation is not performed.
FIG. 5 is an operation timing chart of the count circuit of the pulse counting unit according to the first embodiment of the present invention when performing a preset operation.
FIG. 6 is an external view of a conventional pulse train measurement control system.
FIG. 7 is an operation timing chart of a count circuit of a pulse counting unit in a conventional example.
FIG. 8 is a flowchart showing a pulse train counting start processing procedure of a pulse counting unit executed by a controller in a conventional example.
FIG. 9 is a diagram showing an example of a user program for system control stored in a controller in a conventional example.
FIG. 10 is a processing flowchart of interrupt processing of a controller in a conventional example.
FIG. 11 is a processing flowchart of a pulse counting unit in a conventional example.
FIG. 12 is a diagram showing a relationship between a counting process of a conventional pulse counting unit and an interrupt process of a controller.
[Explanation of symbols]
1 pulse counting unit, 2 controller, 3 MPU, 4 program storage unit, 5 interrupt detection unit, 6 pulse train counting unit, 7 count current value storage register, 8 count current value latch unit, 9 bus switch, 10 external trigger detection unit, 11 interrupt generator, 12 interrupt generator, 13 preset value storage, 14 read request detector.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002162487A JP3985588B2 (en) | 2002-06-04 | 2002-06-04 | Counting device and counting system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002162487A JP3985588B2 (en) | 2002-06-04 | 2002-06-04 | Counting device and counting system |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2004015153A true JP2004015153A (en) | 2004-01-15 |
JP3985588B2 JP3985588B2 (en) | 2007-10-03 |
Family
ID=30431212
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002162487A Expired - Fee Related JP3985588B2 (en) | 2002-06-04 | 2002-06-04 | Counting device and counting system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3985588B2 (en) |
-
2002
- 2002-06-04 JP JP2002162487A patent/JP3985588B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP3985588B2 (en) | 2007-10-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10921767B2 (en) | Encoder system | |
JP2010043981A (en) | Angle position detector and rotational speed detector of rotor | |
US20090204841A1 (en) | Periodic signal processing apparatus | |
JP2004015153A (en) | Counter and counter system | |
JP6237303B2 (en) | Crank angle detector | |
JPH04225110A (en) | Incremental position measuring system | |
JP5353386B2 (en) | Motor drive device | |
JP2008220116A (en) | Motor driving device | |
JP2005315817A (en) | Rotation angle sensor | |
JPH061279B2 (en) | Digital speed detector | |
JP5678868B2 (en) | Signal processing device | |
JP2008089409A (en) | Rotational speed detector | |
JP2020024154A (en) | Encoder and data transmission method | |
SU1589078A1 (en) | Device for measuring temperature | |
JPH03289567A (en) | Apparatus for detecting rotational speed | |
KR100286043B1 (en) | speed detecting system and method thereof | |
JPH095112A (en) | Absolute encoder | |
JP2016080547A (en) | Position controller | |
JP2020201783A (en) | Encoder and data transmission method | |
JPH01239417A (en) | Pulse reading-in circuit for pulse encoder | |
JP2006118960A (en) | Apparatus for counting rotation speed of rotator, its method, and rotator control apparatus | |
JPH043225Y2 (en) | ||
JPS636804B2 (en) | ||
JPS63128226A (en) | Position detector | |
JPH05276776A (en) | Phase servo system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20040707 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20050119 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20070109 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20070123 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20070322 |
|
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: 20070619 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20070702 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 3985588 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100720 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100720 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110720 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110720 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120720 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120720 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130720 Year of fee payment: 6 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |