JP5580185B2 - Rotary encoder signal processing method - Google Patents

Rotary encoder signal processing method Download PDF

Info

Publication number
JP5580185B2
JP5580185B2 JP2010283390A JP2010283390A JP5580185B2 JP 5580185 B2 JP5580185 B2 JP 5580185B2 JP 2010283390 A JP2010283390 A JP 2010283390A JP 2010283390 A JP2010283390 A JP 2010283390A JP 5580185 B2 JP5580185 B2 JP 5580185B2
Authority
JP
Japan
Prior art keywords
switching
chattering
time
value
detection
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.)
Active
Application number
JP2010283390A
Other languages
Japanese (ja)
Other versions
JP2012132722A (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.)
Stanley Electric Co Ltd
Original Assignee
Stanley Electric Co Ltd
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 Stanley Electric Co Ltd filed Critical Stanley Electric Co Ltd
Priority to JP2010283390A priority Critical patent/JP5580185B2/en
Publication of JP2012132722A publication Critical patent/JP2012132722A/en
Application granted granted Critical
Publication of JP5580185B2 publication Critical patent/JP5580185B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Transmission And Conversion Of Sensor Element Output (AREA)

Description

本発明は、ロータリエンコーダが出力するパルス信号の処理方法に関する。   The present invention relates to a method for processing a pulse signal output from a rotary encoder.

種々様々の回転体の回転状態(回転速度や回転角度位置、回転方向など)を観測するために用いられるロータリエンコーダは、例えば、特許文献1に見られるように、回転体が所定の角度だけ回転する毎に、レベル値(電圧値)が切替わるパルス信号を生成して出力する。なお、特許文献1のものは、回転体の回転に応じて、所定の回転角度毎に、摺動部材と金属との接触導通及びその遮断を行なう接触式のロータリエンコーダであるが、光学式のロータリエンコーダも従来より一般に知られている。   A rotary encoder used for observing the rotation state (rotation speed, rotation angle position, rotation direction, etc.) of various rotating bodies is, for example, as shown in Patent Document 1, the rotating body rotates by a predetermined angle. Each time, a pulse signal whose level value (voltage value) is switched is generated and output. In addition, the thing of patent document 1 is a contact-type rotary encoder which performs the contact conduction and the interruption | blocking with a sliding member and a metal for every predetermined rotation angle according to rotation of a rotary body. A rotary encoder is also generally known.

この種のロータリエンコーダが出力するパルス信号は、そのレベル値の切替わりの近辺等において、チャタリング現象あるいはバウンス現象あるいは瞬時的なノイズが発生する場合がある。ここで、「チャタリング現象」は、より詳しくは、オンされている接点が外部からの原因により開閉を反復する現象である。また、「バウンス現象」は、接点をオンまたはオフさせるときに生じる好ましくない間欠的開閉現象である。なお、本明細書では、以降、特にことわらない限り、「チャタリング現象」という用語は、便宜上、本来の意味でのチャタリング現象の他、バウンス現象も含むものとして使用する。   A pulse signal output from this type of rotary encoder may cause chattering, bounce, or instantaneous noise in the vicinity of the level value switching. Here, more specifically, the “chattering phenomenon” is a phenomenon in which an ON contact repeatedly opens and closes due to an external cause. The “bounce phenomenon” is an undesirable intermittent switching phenomenon that occurs when a contact is turned on or off. In the present specification, unless otherwise specified, the term “chattering phenomenon” is used for the sake of convenience to include a bounce phenomenon in addition to the chattering phenomenon in its original meaning.

そして、上記のようなチャタリング現象又は瞬時的なノイズが発生すると、回転体の回転角度位置がほとんど変化していなくても、短い時間内でパルス信号のレベル値の複数回の切替わりが発生してしまい、パルス信号のレベル値の切替わりと回転体の実際の回転角度位置との対応関係が崩れてしまう。   When the chattering phenomenon or instantaneous noise occurs as described above, the level value of the pulse signal is switched multiple times within a short time even if the rotational angle position of the rotating body has hardly changed. As a result, the correspondence between the switching of the level value of the pulse signal and the actual rotational angle position of the rotating body is destroyed.

このため、ロータリエンコーダが出力するパルス信号から直接的にCPU等の演算処理装置により回転体の回転状態を把握するようにすると、該回転状態を正しく認識することができなくなる。   For this reason, if the rotational state of the rotating body is grasped directly from the pulse signal output from the rotary encoder by an arithmetic processing unit such as a CPU, the rotational state cannot be correctly recognized.

そこで、従来は、ロータリエンコーダが出力するパルス信号をCPU等の演算処理装置に入力して、該演算処理装置により回転体の回転状態を把握するような場合には、ロータリエンコーダが回転体の回転に応じて出力するパルス信号のレベル値の切替わりのうち、該切替わり後に事前に設定された所定のチャタリング排除時間の期間内で該レベル値を復帰させる切替わりを伴う切替わり(チャタリング排除時間の期間内に含まれる短いパルス幅を有する1つ又は複数のパルスによる切替わり)を、チャタリング現象又は瞬時的なノイズに起因する除外対象切替わりとして除外してなる該レベル値の切替わりである検知対象切替わりの発生を検知する切替わり検知処理を演算処理装置で実行することで、ロータリエンコーダが出力したパルス信号から上記除外対象切替わりを除去した形態のパルス信号波形を認識するようにして、このパルス信号波形から、前記回転体の回転状態を把握することが行なわれていた。   Therefore, conventionally, when the pulse signal output from the rotary encoder is input to an arithmetic processing device such as a CPU and the rotational state of the rotating body is grasped by the arithmetic processing device, the rotary encoder rotates the rotating body. Among the switching of the level value of the pulse signal to be output in response to the switching, the switching with the switching for returning the level value within a predetermined chattering exclusion time period set in advance after the switching (chattering exclusion time Switching of one or a plurality of pulses having a short pulse width included in the period of time) is excluded as switching to be excluded due to chattering phenomenon or instantaneous noise. The pulse output by the rotary encoder by executing the switching detection process that detects the occurrence of switching of the detection target in the arithmetic processing unit. So as to recognize the pulse signal waveform in the form of removal of the excluded switching despite the items, from the pulse signal waveform, it has been conducted to ascertain the rotational state of the rotating body.

特開2005−195579号公報JP 2005-195579 A

ところで、回転体の回転速度が高速になると、該回転体の回転角度位置に依存して発生するパルス信号のレベル値の切替わり(上記検知対象切替わり)は、短い時間間隔で繰り返されることとなる。   By the way, when the rotational speed of the rotating body becomes high, the switching of the level value of the pulse signal generated depending on the rotational angle position of the rotating body (the switching of the detection target) is repeated at short time intervals. Become.

一方、従来における前記切替わり検知処理では、前記チャタリング排除時間は、一定値(固定値)の時間に設定されていた。そして、この一定値は、実際に発生し得るチャタリング現象の継続時間が該チャタリング排除時間の期間内に確実に収まるように、長めの時間に設定されていた。   On the other hand, in the conventional switching detection process, the chattering exclusion time is set to a constant value (fixed value). This constant value is set to a longer time so that the duration of the chattering phenomenon that can actually occur is surely within the period of the chattering exclusion time.

このため、従来の切替わり検知処理では、回転体の回転速度が高速になると、検知対象切替わりとして検知されるべきパルス信号のレベル値の本来の切替わり(回転体の回転角度位置が、ロータリエンコーダの構造によって規定される所定の角度位置であるとき発生すべき切替わり)が、前記チャタリング排除時間の期間内で繰り返されることとなる場合がある。そして、このような場合には、当該本来の切替わりが、チャタリング現象又は一時的なノイズに起因するものと同じように除外対象切替わりとして除外されることとなる。   For this reason, in the conventional switching detection process, when the rotational speed of the rotating body becomes high, the original switching of the level value of the pulse signal to be detected as the detection target switching (the rotational angle position of the rotating body is the rotary There is a case in which the switching to be generated at a predetermined angular position defined by the structure of the encoder is repeated within the chattering exclusion time period. In such a case, the original switching is excluded as an exclusion target switching in the same manner as the chattering phenomenon or temporary noise.

従って、従来は、回転体の高速回転時において、回転体の実際の回転状態に対応するパルス信号波形を正しく認識することができない場合があり、ひいては、該回転体の回転状態を正しく把握することができない場合があった。   Therefore, conventionally, when the rotating body rotates at high speed, the pulse signal waveform corresponding to the actual rotating state of the rotating body may not be correctly recognized, and as a result, the rotating state of the rotating body may be correctly grasped. There was a case that could not be.

本発明は、かかる背景に鑑みてなされたものであり、回転体の回転状態に応じてロータリエンコーダが出力するパルス信号を基に該回転体の回転状態を把握する場合に、回転体の回転速度が高速である場合を含む幅広い速度範囲において、回転体の実際の回転状態に整合したパルス信号のレベル値の切替わりを検知することができ、ひいては、回転体の回転状態の把握を高い信頼性で行なうことができる信号処理方法を提供することを目的とする。   The present invention has been made in view of such a background, and when the rotational state of the rotating body is grasped based on the pulse signal output from the rotary encoder according to the rotating state of the rotating body, the rotational speed of the rotating body is determined. In a wide range of speeds, including high speeds, it is possible to detect changes in the level value of the pulse signal that matches the actual rotating state of the rotating body, and thus, it is highly reliable to know the rotating state of the rotating body. An object of the present invention is to provide a signal processing method that can be performed by the above method.

本発明のロータリエンコーダの信号処理方法は、かかる目的を達成するために、ロータリエンコーダが回転体の回転に応じて出力するパルス信号のレベル値の切替わりのうち、該切替わり後に事前に設定された所定のチャタリング排除時間の期間内で該レベル値を復帰させる切替わりを伴う切替わりを、チャタリング現象又は瞬時的なノイズに起因する除外対象切替わりとして除外してなる該レベル値の切替わりである検知対象切替わりの発生を検知する切替わり検知処理を実行しつつ、前記回転体の回転状態を把握するために用いる前記パルス信号の波形を認識する信号処理方法であって、
前記ロータリエンコーダが出力したパルス信号を観測しつつ、前記チャタリング排除時間を用いて前記切替わり検知処理を実行する切替わり検知ステップと、
前記検知対象切替わりの発生を検知してから、次の前記検知対象切替わりの発生を検知するまでの経過時間を計時する計時ステップと、
前記検知対象切替わりの発生を検知する毎に、以後の前記切替わり検知処理に使用する前記チャタリング排除時間を可変的に設定するチャタリング排除時間設定ステップと、
前記検知対象切替わりの発生を検知する毎に、今回の検知対象切替わりの発生を検知したときの前記切替わり検知処理で使用した前記チャタリング排除時間の設定値と、前回の検知対象切替わりの発生を検知したときの前記切替わり検知処理で使用した前記チャタリング排除時間の設定値との偏差に応じて、前回の検知対象切替わりの発生を検知してから今回の検知対象切替わりの発生を検知するまでに前記計時ステップで計時した前記経過時間を補正することにより、今回の検知対象切替わりの発生の直前における前記パルス信号のパルス幅を推定するパルス幅推定ステップとを備え、
前記チャタリング排除時間設定ステップでは、前記検知対象切替わりの発生を検知する毎に、前記回転体の回転速度が速いほど、前記チャタリング排除時間を短くするように、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの少なくとも最新値に応じて前記チャタリング排除時間を可変的に設定することを特徴とする(第1発明)。
In order to achieve this object, the rotary encoder signal processing method of the present invention is set in advance after the switching of the level values of the pulse signal output by the rotary encoder according to the rotation of the rotating body. The switching of the level value is performed by excluding the switching accompanied by the switching to restore the level value within the predetermined chattering exclusion time period as the switching to be excluded due to chattering phenomenon or instantaneous noise. A signal processing method for recognizing a waveform of the pulse signal used for grasping a rotation state of the rotating body while executing a switching detection process for detecting occurrence of switching of a detection target,
A switching detection step of performing the switching detection process using the chattering exclusion time while observing the pulse signal output from the rotary encoder;
A time measuring step of measuring an elapsed time from detection of the occurrence of the detection target switching to detection of the next detection target switching;
A chattering exclusion time setting step for variably setting the chattering exclusion time used for the subsequent switching detection processing every time the occurrence of the detection target switching is detected;
Each time the occurrence of switching of the detection target is detected, the set value of the chattering exclusion time used in the switching detection process when the occurrence of the current detection target switching is detected, and the previous detection target switching Depending on the deviation from the set value of the chattering exclusion time used in the switching detection process when an occurrence is detected, the occurrence of the current detection target switching is detected after the detection of the previous detection target switching is detected. A pulse width estimating step for estimating the pulse width of the pulse signal immediately before the occurrence of the current detection target switching by correcting the elapsed time measured in the time measuring step until detection,
In the chattering exclusion time setting step, each time the occurrence of switching of the detection target is detected, it is estimated in the pulse width estimation step so as to shorten the chattering exclusion time as the rotational speed of the rotating body increases. The chattering exclusion time is variably set according to at least the latest value of the estimated pulse widths (first invention).

この第1発明によれば、前記チャタリング排除時間設定ステップによって、前記チャタリング排除時間が可変的に設定される。そして、前記切替わり検知ステップでは、この設定されたチャタリング排除時間を使用し、ロータリエンコーダが回転体の回転に応じて出力するパルス信号のレベル値の切替わりのうち、該切替わり後に事前に設定された所定のチャタリング排除時間の期間内で該レベル値を復帰させる切替わりを伴う切替わりを、チャタリング現象又は瞬時的なノイズに起因する除外対象切替わりとして除外してなる該レベル値の切替わりである検知対象切替わりの発生を検知する切替わり検知処理を実行する。   According to the first aspect of the present invention, the chattering exclusion time is variably set by the chattering exclusion time setting step. In the switching detection step, the set chattering elimination time is used, and among the switching of the level value of the pulse signal output by the rotary encoder according to the rotation of the rotating body, the switching detection step sets in advance after the switching. The switching of the level value is performed by excluding the switching accompanied by the switching for restoring the level value within the predetermined chattering exclusion time period as the switching of the exclusion target due to chattering phenomenon or instantaneous noise. The switching detection process for detecting the occurrence of switching of the detection target is executed.

なお、この切替わり検知処理で検知する検知対象切替わりは、チャタリング現象やノイズが無い場合に、ロータリエンコーダから出力されるはずの本来のパルス信号(回転体の既定の回転角度位置でのみレベル値が切替わるパルス信号)のレベル値の切替わりを意味するものである。   Note that the detection target switching detected by this switching detection process is the original pulse signal that should be output from the rotary encoder when there is no chattering phenomenon or noise (level value only at the predetermined rotation angle position of the rotating body). This means that the level value of the pulse signal is switched.

また、本発明における前記「チャタリング現象」は、前記した通り、本来の意味でのチャタリング現象の他、バウンス現象も含むものである。   In addition, as described above, the “chattering phenomenon” in the present invention includes a bounce phenomenon in addition to the chattering phenomenon in the original meaning.

ここで、本願発明者の各種実験、検討に基づく知見によれば、パルス信号のチャタリング現象や瞬時的なノイズは、一般に、前記回転体の実際の回転角度位置が、本来のパルス信号のレベル値の切替わりの近辺のある角度範囲内にあるときに発生し易いので、それらのチャタリング現象等が発生し得る時間幅は、前記回転体の回転速度が高速になるほど、短くなる。   Here, according to the knowledge based on various experiments and examinations of the inventors of the present application, the chattering phenomenon and instantaneous noise of the pulse signal are generally determined by the actual rotation angle position of the rotating body being the level value of the original pulse signal. Therefore, the time width during which the chattering phenomenon and the like can occur becomes shorter as the rotational speed of the rotating body becomes higher.

そこで、第1発明では、前記チャタリング排除時間設定ステップでは、前記回転体の回転速度が速いほど、前記チャタリング排除時間を短くするように設定することを、該チャタリング排除時間の設定の基本的な指針とする。   Therefore, in the first invention, in the chattering exclusion time setting step, the basic guideline for setting the chattering exclusion time is to set the chattering exclusion time to be shorter as the rotational speed of the rotating body is faster. And

この場合、前記回転体の回転速度が速くなるほど、本来のパルス信号のパルス幅(パルス信号のレベル値の検知対象切替わりと次の検知対象切替わりとの間の時間幅)は短くなる。   In this case, the higher the rotational speed of the rotating body, the shorter the pulse width of the original pulse signal (the time width between the detection target switching of the level value of the pulse signal and the next detection target switching).

また、該パルス幅は、前記検知対象切替わりの発生を検知する毎に、前記パルス幅推定ステップの処理によって推定することが可能である。すなわち、今回の検知対象切替わりの発生を検知したときの前記切替わり検知処理で使用した前記チャタリング排除時間の設定値と、前回の検知対象切替わりの発生の検知したときの前記切替わり検知処理で使用した前記チャタリング排除時間の設定値との偏差に応じて、前回の検知対象切替わりの発生を検知してから今回の検知対象切替わりの発生を検知するまでに前記計時ステップで計時した前記経過時間を補正することにより、今回の検知対象切替わりの発生の直前における前記パルス信号のパルス幅を推定することができる。   The pulse width can be estimated by the process of the pulse width estimation step every time the occurrence of switching of the detection target is detected. That is, the set value of the chattering exclusion time used in the switching detection process when the occurrence of the current detection target switching is detected, and the switching detection process when the previous detection target switching is detected. According to the deviation from the set value of the chattering exclusion time used in the above, the time measured in the timing step from the detection of the previous detection target switching to the detection of the current detection target switching By correcting the elapsed time, it is possible to estimate the pulse width of the pulse signal immediately before the occurrence of the current detection target switching.

この場合、より具体的には、今回の検知対象切替わりの発生を検知したときの前記切替わり検知処理で使用した前記チャタリング排除時間の設定値をTc1、前回の検知対象切替わりの発生を検知したときの前記切替わり検知処理で使用した前記チャタリング排除時間の設定値をTc0とし、それらの偏差を(Tc0−Tc1)とすると、この偏差(Tc0−Tc1)を、前回の検知対象切替わりの発生を検知してから今回の検知対象切替わりの発生を検知するまでに前記計時ステップで計時した前記経過時間に加算する(換言すれば、該経過時間から(Tc1−Tc0)を減算する)ことによって、前記パルス幅を推定することができる。   In this case, more specifically, the setting value of the chattering exclusion time used in the switching detection process when the occurrence of the current detection target switching is detected is Tc1, and the previous occurrence of the switching of the detection target is detected. When the setting value of the chattering exclusion time used in the switching detection process at this time is Tc0 and the deviation is (Tc0-Tc1), this deviation (Tc0-Tc1) is used as the previous detection target switching. Addition to the elapsed time measured in the timing step from detection of occurrence to detection of occurrence of the current detection target switching (in other words, subtract (Tc1-Tc0) from the elapsed time) Thus, the pulse width can be estimated.

なお、前記計時ステップで計時した前記経過時間を、上記の如く補正するのは、今回及び前回の検知対象切替わりの発生の検知は、それぞれ、パルス信号の実際のレベル値の切替わりから互いに異なるチャタリング排除時間の設定値Tc0、Tc1の時間分、遅れたタイミングで行なわれるからである。   It should be noted that the correction of the elapsed time measured in the timing step as described above is that the detection of the occurrence of switching of the detection target this time and the previous time is different from the switching of the actual level value of the pulse signal, respectively. This is because the chattering exclusion time is set at a timing delayed by the set values Tc0 and Tc1.

そこで、第1発明では、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの少なくとも最新値に応じて前記チャタリング排除時間を可変的に設定する。この場合、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値は、今回の検知対象切替わりの発生の直前における前記パルス信号のパルス幅の推定値であるので、前記回転体の概ね現状の回転速度を反映したものとなる。   Therefore, in the first invention, the chattering exclusion time is variably set according to at least the latest value of the estimated pulse width values estimated in the pulse width estimating step. In this case, the latest value of the estimated values of the pulse width estimated in the pulse width estimating step is the estimated value of the pulse width of the pulse signal immediately before the occurrence of the current detection target switching, so the rotation It reflects the current rotation speed of the body.

従って、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの少なくとも最新値に応じて前記チャタリング排除時間を可変的に設定することによって、前記回転体の回転速度が速いほど、前記チャタリング排除時間を短くするように該チャタリング排除時間を設定することを適切に実現できることとなる。   Therefore, the chattering exclusion time is variably set according to at least the latest value of the estimated pulse widths estimated in the pulse width estimation step, so that the higher the rotational speed of the rotating body, the higher the chattering speed. Setting the chattering exclusion time so as to shorten the exclusion time can be appropriately realized.

なお、前記チャタリング排除時間の設定に反映させる前記パルス幅の推定値は、最新値だけでもよいが、後述するように、この最新値とそれ以前の1つ以上の推定値に応じて(換言すれば、該パルス幅の推定値の履歴を反映させて)、前記チャタリング排除時間を設定するようにしてもよい。   Note that the estimated value of the pulse width to be reflected in the setting of the chattering exclusion time may be only the latest value. However, as will be described later, according to the latest value and one or more estimated values before that (in other words, For example, the chattering exclusion time may be set by reflecting the history of the estimated value of the pulse width.

そして、第1発明は、前記切替わり検知処理を、上記のように設定されたチャタリング排除時間を用いて行なうので、回転体が比較的高速で回転し、前記本来のパルス信号のパルス幅(検知対象切替わりと次の検知対象切替わりとの間の時間幅)が、比較的短くなるような場合であっても、チャタリング現象や瞬時的なノイズに起因するパルス信号のレベル値の切替わりを、検知対象切替わりとして検知してしまうのを防止しつつ、本来のパルス信号のレベル値の切替わりを、検知対象切替わりとして検知するようにすることができる。   In the first invention, since the switching detection process is performed using the chattering exclusion time set as described above, the rotating body rotates at a relatively high speed and the pulse width (detection of the original pulse signal) is detected. Even if the time width between the target switching and the next detection target switching) is relatively short, the level value of the pulse signal can be switched due to chattering or instantaneous noise. Thus, it is possible to detect the switching of the original pulse signal level value as the detection target switching while preventing the detection target switching.

換言すれば、本来のパルス信号のレベル値の切替わりを検知対象切替わりとして正常に検知し得る回転体の回転速度の上限を高めることができる。   In other words, it is possible to increase the upper limit of the rotational speed of the rotating body that can be normally detected by switching the level value of the original pulse signal as the detection target switching.

また、回転体が比較的低速で回転している場合であっても、チャタリング現象や瞬時的なノイズに起因するパルス信号のレベル値の切替わりを、検知対象切替わりとして誤検知してしまうのを防止しつつ、本来のパルス信号のレベル値の切替わりを、検知対象切替わりとして検知するようにすることができる。   In addition, even when the rotating body rotates at a relatively low speed, the switching of the level value of the pulse signal due to chattering phenomenon or instantaneous noise is erroneously detected as the switching of the detection target. It is possible to detect the switching of the original level value of the pulse signal as the detection target switching.

従って、第1発明によれば、回転体の回転速度が高速である場合を含む幅広い速度範囲において、回転体の実際の回転状態に整合したパルス信号のレベル値の切替わり(検知対象切替わり)を検知することができ、ひいては、回転体の回転状態の把握を高い信頼性で行なうことができる。   Therefore, according to the first aspect of the present invention, the level value switching of the pulse signal matched with the actual rotation state of the rotating body (switching of the detection target) is performed in a wide speed range including the case where the rotating speed of the rotating body is high. Can be detected, and as a result, the rotation state of the rotating body can be grasped with high reliability.

前記切替わり検知ステップで実行する切替わり検知処理は、前記チャタリング排除時間の時間内に含まれることとなるような短いパルス幅の1つ又は複数のパルスにおけるレベル値の切替わりを除外対象切替わりとして除外するようにして、前記検知対象切替わりを検知し得る手法であればどのような手法を用いてもよいが、代表的な手法としては、例えば次のような手法を採用することができる。   The switching detection process executed in the switching detection step includes switching of level values in one or a plurality of pulses having a short pulse width that are included in the chattering exclusion time. Any method may be used as long as it is a method that can detect the switching of the detection target, but as a typical method, for example, the following method can be adopted. .

その1つの手法では、前記切替わり検知ステップは、前記ロータリエンコーダが出力したパルス信号の実際のレベル値の切替わりを検知する第1ステップと、該検知後、前記チャタリング排除時間の期間が経過した直後における該パルス信号の実際のレベル値を観測する第2ステップとを備え、第2ステップで観測したレベル値が、第1ステップでの切替わりの検知の直前における前記パルス信号の実際のレベル値と異なるレベル値であるか否かを判断し、該判断結果が肯定的である場合に、前記検知対象切替わりの発生を検知する(第2発明)。   In the one method, the switching detection step includes a first step of detecting switching of an actual level value of a pulse signal output from the rotary encoder, and a period of the chattering exclusion time has elapsed after the detection. A second step of observing the actual level value of the pulse signal immediately after, and the level value observed in the second step is the actual level value of the pulse signal immediately before the switching detection in the first step. It is determined whether or not the level value is different from the above, and when the determination result is affirmative, the occurrence of switching of the detection target is detected (second invention).

あるいは、他の1つの手法では、前記切替わり検知ステップは、前記ロータリエンコーダが出力したパルス信号の実際のレベル値を所定の周期で逐次観測しつつ、前記チャタリング排除時間の期間分の該レベル値の複数の観測値が互いに同一の値であるか否かを判断する処理を逐次実行し、該判断結果が否定的となる状況から肯定的となる状況に変化した場合に、前記検知対象切替わりの発生を検知する(第3発明)。   Alternatively, in another method, in the switching detection step, the level value corresponding to the chattering exclusion time period is obtained by sequentially observing an actual level value of the pulse signal output from the rotary encoder at a predetermined period. The process of determining whether or not a plurality of observed values are the same as each other is sequentially executed, and when the determination result changes from a negative situation to a positive situation, the detection target switching is performed. Is detected (third invention).

上記第2発明又は第3発明によれば、簡易な手法で、前記除外対象切替わりが検知対象切替わりとして検知されないようにしつつ、前記切替わり検知処理を適切に実行できる。   According to the second invention or the third invention, the switching detection process can be appropriately executed by a simple method while preventing the exclusion target switching from being detected as the detection target switching.

また、以上の第1〜第3発明では、前記チャタリング排除時間設定ステップのより具体的な態様の一例としては、次のような態様を採用できる。すなわち、前記チャタリング排除時間設定ステップでは、例えば、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値により示される前記回転体の回転速度が速いほど、前記チャタリング排除時間を短くするように該最新値に応じて該チャタリング排除時間を設定する(第4発明)。   In the above first to third inventions, the following aspects can be adopted as an example of a more specific aspect of the chattering exclusion time setting step. That is, in the chattering exclusion time setting step, for example, as the rotational speed of the rotating body indicated by the latest value of the estimated pulse widths estimated in the pulse width estimation step increases, the chattering exclusion time decreases. Thus, the chattering exclusion time is set according to the latest value (fourth invention).

この第4発明によれば、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値に応じてチャタリング排除時間を設定するので、回転体の現状の回転速度に整合するチャタリング排除時間を設定できる。また、パルス幅の推定値のうちの最新値だけを使用するので、チャタリング排除時間の設定処理を容易に行うことができる。   According to the fourth aspect of the invention, since the chattering exclusion time is set according to the latest value of the estimated pulse width values estimated in the pulse width estimation step, the chattering exclusion that matches the current rotational speed of the rotating body You can set the time. Further, since only the latest value of the estimated pulse width is used, the chattering exclusion time setting process can be easily performed.

また、第1〜第3発明では、前記チャタリング排除時間設定ステップの態様のより好ましい例としては、次のような態様を採用することが好適である。すなわち、前記チャタリング排除時間設定ステップでは、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値とそれ以前の少なくとも1つの過去値とを基に、前記今回の検知対象切替わりの発生の検知以後の前記回転体の将来の回転速度、又は該回転速度に対応する前記パルス信号のパルス幅、又は該回転速度もしくはパルス幅と一定の相関関係を有するパラメータ値を予測し、その予測値が示す前記回転体の回転速度が速いほど、前記チャタリング排除時間を短くするように、該予測値に応じて該チャタリング排除時間を設定する(第5発明)。   In the first to third aspects of the invention, as a more preferable example of the chattering exclusion time setting step, it is preferable to employ the following aspects. That is, in the chattering exclusion time setting step, the current detection target switching is changed based on the latest value of the estimated pulse width values estimated in the pulse width estimation step and at least one past value before that. Predicting the future rotational speed of the rotating body after the detection of the occurrence of, or the pulse width of the pulse signal corresponding to the rotational speed, or the parameter value having a certain correlation with the rotational speed or pulse width, The chattering exclusion time is set according to the prediction value so as to shorten the chattering exclusion time as the rotation speed of the rotating body indicated by the prediction value increases (fifth invention).

なお、上記パラメータ値としては、典型的には、前記回転速度もしくはパルス幅と比例関係にあるパラメータ値を使用することができる。   As the parameter value, typically, a parameter value proportional to the rotational speed or the pulse width can be used.

この第5発明によれば、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値とそれ以前の少なくとも1つの過去値とを基に、予測した回転体の将来の回転速度、又は該回転速度に対応する前記パルス信号のパルス幅、又は該回転速度もしくはパルス幅と一定の相関関係を有するパラメータ値の予測値に応じて前記チャタリング排除時間を設定するので、前記今回の検知対象切替わりの発生の検知以後の将来の前記切替わり検知処理で使用するチャタリング排除時間を、回転体の将来の回転速度に整合するように設定することができることとなる。   According to the fifth aspect of the present invention, based on the latest value of the pulse width estimation values estimated in the pulse width estimation step and at least one past value before that, the predicted future rotational speed of the rotating body is determined. Or the chattering exclusion time is set in accordance with a pulse width of the pulse signal corresponding to the rotational speed or a predicted value of a parameter value having a certain correlation with the rotational speed or pulse width. The chattering elimination time used in the future switching detection process after the detection of the occurrence of the target switching can be set to match the future rotational speed of the rotating body.

このため、回転体の回転速度が急増するような場合であっても、パルス信号のレベル値の検知対象切替わりの発生時刻近辺での回転体の実際の回転速度に対して、既に設定されたチャタリング排除時間が長くなり過ぎるものとなって、該検知対象切替わりが検知されることから除外されてしまうような事態が生じるのを防止することができる。   For this reason, even when the rotational speed of the rotating body increases rapidly, the actual rotational speed of the rotating body in the vicinity of the generation time of the detection target switching of the level value of the pulse signal has already been set. It can be prevented that the chattering exclusion time becomes too long and the detection target switching is detected and thus excluded.

従って、第5発明によれば、回転体の回転速度のより幅広い速度範囲において、回転体の実際の回転状態に整合したパルス信号のレベル値の切替わり(検知対象切替わり)を検知することができる。ひいては、回転体の回転状態の把握をより一層高い信頼性で行なうことができる。   Therefore, according to the fifth aspect of the present invention, it is possible to detect switching of the level value of the pulse signal (detection target switching) that matches the actual rotation state of the rotating body in a wider speed range of the rotating speed of the rotating body. it can. As a result, the rotation state of the rotating body can be grasped with higher reliability.

また、以上説明した第1〜第5発明では、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値により示される前記回転体の回転速度が所定値以上の高速であるか否かを判断するステップをさらに備え、該判断結果が肯定的である場合には、前記切替わり検知ステップで検知した検知対象切替わりを反映させて認識されるパルス信号の波形に基づいて前記回転体の回転状態を把握する処理を禁止するようにしてもよい(第6発明)。   In the first to fifth inventions described above, is the rotational speed of the rotating body indicated by the latest value of the estimated values of the pulse width estimated in the pulse width estimating step higher than a predetermined value? A step of determining whether or not the rotation is based on a waveform of a pulse signal recognized by reflecting the detection target switching detected in the switching detection step when the determination result is affirmative. You may make it prohibit the process which grasps | ascertains the rotation state of a body (6th invention).

すなわち、回転体の回転速度が非常に速い速度になると、本来のパルス信号の検知対象切替わりと次の検知対象切替わりとの間のパルス幅が微小なものとなるため、チャタリング現象や、瞬時的なノイズに起因するパルスとの区別がつき難くなる。   That is, when the rotational speed of the rotating body becomes very high, the pulse width between the switching of the original detection target of the pulse signal and the next switching of the detection target becomes very small. It becomes difficult to distinguish from pulses caused by noise.

そこで、第6発明では、前記回転体の回転速度が所定値以上の高速であるか否かの判断結果が肯定的である場合には、前記切替わり検知ステップで検知した検知対象切替わりを反映させて認識されるパルス信号の波形に基づいて前記回転体の回転状態を把握する処理を禁止する。これにより、回転体の回転状態が誤って把握させることを防止することができる。   Therefore, in the sixth aspect of the invention, when the result of determination as to whether or not the rotational speed of the rotating body is higher than a predetermined value is affirmative, the detection object switching detected in the switching detection step is reflected. Thus, the process of grasping the rotation state of the rotating body based on the waveform of the pulse signal recognized is prohibited. Thereby, it is possible to prevent the rotating state of the rotating body from being erroneously grasped.

本発明の実施形態におけるロータリエンコーダの回路構成を示す図。The figure which shows the circuit structure of the rotary encoder in embodiment of this invention. 図1に示すスイッチに係わるロータリエンコーダの機構的構造の概略を示す図。The figure which shows the outline of the mechanical structure of the rotary encoder regarding the switch shown in FIG. 図1に示すCPUの第1実施形態における演算処理を示すフローチャート。The flowchart which shows the arithmetic processing in 1st Embodiment of CPU shown in FIG. 図3のSTEP1、2の処理の第1の例を説明するための図。The figure for demonstrating the 1st example of the process of STEP1,2 of FIG. 図3のSTEP1、2の処理の第2の例を説明するための図。The figure for demonstrating the 2nd example of the process of STEP1,2 of FIG. 図3のSTEP7の処理を説明するための図。The figure for demonstrating the process of STEP7 of FIG. 図3のSTEP29でのチャタリング排除時間の設定例を示す図。The figure which shows the example of a setting of chattering exclusion time in STEP29 of FIG. 図1に示すCPUの第1実施形態における演算処理を示すフローチャート。The flowchart which shows the arithmetic processing in 1st Embodiment of CPU shown in FIG. 図8のSTEP29でのチャタリング排除時間の設定例を示す図。The figure which shows the example of a setting of the chattering exclusion time in STEP29 of FIG.

[第1実施形態]
本発明の第1実施形態を以下に図1〜図7を参照して説明する。
[First Embodiment]
A first embodiment of the present invention will be described below with reference to FIGS.

まず、図1及び図2を参照して本実施形態におけるロータリーエンコーダ1の概略構成を説明する。このロータリーエンコーダ1は、3相の接触式ロータリエンコーダであり、A相、B相、C相の3相分のパルス信号を生成するためのスイッチ3a,3b,3cを構成するスイッチ機構部2を備える。   First, a schematic configuration of the rotary encoder 1 in the present embodiment will be described with reference to FIGS. 1 and 2. The rotary encoder 1 is a three-phase contact rotary encoder, and includes a switch mechanism unit 2 that constitutes switches 3a, 3b, and 3c for generating pulse signals for three phases of A phase, B phase, and C phase. Prepare.

スイッチ機構2の各スイッチ3a,3b,3c(以下、これらを区別する必要がないときは、総称的にスイッチ3という)は、図2に概略的に示す機構的構造によって、回転体4の回転に応じて電気的な導通・遮断が行なわれるスイッチである。   Each switch 3a, 3b, 3c of the switch mechanism 2 (hereinafter collectively referred to as the switch 3 when it is not necessary to distinguish between them) is rotated by the rotating body 4 by the mechanical structure schematically shown in FIG. This is a switch that is electrically connected and disconnected according to the condition.

なお、図2は、1つの相のスイッチ3の機構的構造を代表的に示している。そして、図2では、図示の便宜上、回転体4及びこれと一体に回転する部分と、回転しない固定部分とを区別するために、前者を破線で表し、後者を実線で表している。   FIG. 2 representatively shows the mechanical structure of the switch 3 of one phase. In FIG. 2, for the convenience of illustration, the former is represented by a broken line and the latter is represented by a solid line in order to distinguish between the rotating body 4 and a portion that rotates integrally with the rotating body 4 and a fixed portion that does not rotate.

図2に示す如く、各スイッチ3は、回転体4に取付けられた金属等の導体材質の摺動子5と、この摺動子5を摺接させる部分として、回転体4の回転軸4aと同軸心に固定部6に形成された円環状部7とを備え、摺動子5が、円環状部7に摺接しつつ、回転体4と一体に固定部6に対して回転するようになっている。   As shown in FIG. 2, each switch 3 includes a slider 5 made of a conductive material such as a metal attached to the rotating body 4, and a rotating shaft 4 a of the rotating body 4 as a portion that makes the sliding contact with the slider 5. And an annular portion 7 formed on the fixed portion 6 on the same axis, and the slider 5 rotates integrally with the rotating body 4 with respect to the fixed portion 6 while being in sliding contact with the annular portion 7. ing.

上記円環状部7には、所定弧長の複数の円弧状の導体部分8(金属等の導体材質の部分)が周方向に一定間隔で配列されており、周方向に隣合う導体部分8,8の間の部分9が絶縁体部分(樹脂等の絶縁体材質の部分)となっている。   In the annular portion 7, a plurality of arc-shaped conductor portions 8 (portions made of a conductor material such as metal) having a predetermined arc length are arranged at regular intervals in the circumferential direction, and adjacent conductor portions 8, A portion 9 between 8 is an insulator portion (a portion made of an insulator material such as resin).

このため、各スイッチ3の摺動子5は、回転体4が時計周り方向及び反時計周り方向のいずれか一方向に回転したとき、一定の回転角度周期で導体部分8及び絶縁体部分9に交互に摺接するようになっている。これにより、回転体4が時計周り方向及び反時計周り方向のいずれかに回転したとき、各スイッチ3の電気的な導通(摺動子5と導体部分8との接触)と、電気的な遮断(摺動子5と絶縁体部分9との接触)とが交互に行なわれることとなる。   For this reason, the slider 5 of each switch 3 is placed on the conductor portion 8 and the insulator portion 9 at a constant rotation angle period when the rotating body 4 rotates in any one of the clockwise direction and the counterclockwise direction. It comes in sliding contact with each other. As a result, when the rotating body 4 rotates in either the clockwise direction or the counterclockwise direction, the electrical conduction of each switch 3 (contact between the slider 5 and the conductor portion 8) and the electrical disconnection are achieved. (Contact between the slider 5 and the insulator portion 9) is performed alternately.

また、このとき、各スイッチ3の電気的な導通は、回転体4と一体に回転する摺動子5の回転角度位置が、円環状部7の周方向での導体部分8の配置位置及び該導体部分8の弧長により規定される所定の角度範囲に在るときに行なわれ、同様に、各スイッチ3の電気的な遮断は、摺動子5の回転角度位置が、円環状部7の周方向での絶縁体部分9の配置位置及び該絶縁体部分9の弧長により規定される所定の角度範囲に在るときに行なわれるようになっている。   At this time, the electrical continuity of each switch 3 is such that the rotational angle position of the slider 5 that rotates integrally with the rotating body 4 depends on the arrangement position of the conductor portion 8 in the circumferential direction of the annular portion 7 and This is performed when a predetermined angle range defined by the arc length of the conductor portion 8 is present. Similarly, the electrical disconnection of each switch 3 is performed when the rotational angle position of the slider 5 is set at the annular portion 7. This is performed when the angle is within a predetermined angular range defined by the arrangement position of the insulator portion 9 in the circumferential direction and the arc length of the insulator portion 9.

なお、各スイッチ3の導体部分8の弧長又はその配置位置、あるいは、摺動子5の配置位置(回転体4に対する周方向での配置位置)は、スイッチ3a,3b,3cの相互間で異なるものとされている。このため、各スイッチ3の電気的な導通と遮断とがそれぞれ行なわれる回転体4の回転角度位置の範囲又はその範囲の幅は、スイッチ3a,3b,3cの相互間で異なるものとなっている。   In addition, the arc length of the conductor portion 8 of each switch 3 or its arrangement position, or the arrangement position of the slider 5 (arrangement position in the circumferential direction with respect to the rotating body 4) is between the switches 3a, 3b, 3c. It is different. For this reason, the range of the rotational angle position of the rotating body 4 where the electrical continuity and interruption of each switch 3 are performed or the width of the range are different among the switches 3a, 3b, 3c. .

また、図2では、図示の便宜上、各スイッチ3の導体部分8及び絶縁体部分9の弧長を長めに記載したが、実際には、それらの弧長は、より短いものとされる。   In FIG. 2, for convenience of illustration, the arc lengths of the conductor portion 8 and the insulator portion 9 of each switch 3 are described as being long, but in reality, these arc lengths are shorter.

また、回転体4の回転角度範囲が所定の範囲に制限されるような場合には、前記円環状部7のうちの所定の角度範囲の領域にだけ、導体部分8及び絶縁体部分9の配列を形成するようにしてもよい。そして、この場合、円環状部7の所定の角度範囲の領域以外の領域に、接地電極等を形成するようにしてもよい。   Further, when the rotation angle range of the rotating body 4 is limited to a predetermined range, the arrangement of the conductor portion 8 and the insulator portion 9 is provided only in a predetermined angle range region of the annular portion 7. May be formed. In this case, a ground electrode or the like may be formed in a region other than the region in the predetermined angular range of the annular portion 7.

図1に戻って、各スイッチ3の摺動子5及び導体部分8のいずれか一方(スイッチ3の一端)は接地され、他方は(スイッチ3の他端)は、図示しない直流電源(電池等)から直流電圧が印加される電源電圧入力部10に、抵抗11及びコンデンサ12の並列回路を介して接続されている。これにより、電源電圧入力部10に直流電圧を印加した状態で、回転体4が一方向に回転して、各スイッチ3の導通・遮断が交互に行なわれると、上記並列回路と各スイッチ3との間の信号出力部13から、高低2値レベルのパルス信号が出力されるようになっている。   Returning to FIG. 1, one of the slider 5 and the conductor portion 8 of each switch 3 (one end of the switch 3) is grounded, and the other (the other end of the switch 3) is a DC power source (battery or the like) not shown. ) To a power supply voltage input unit 10 to which a DC voltage is applied, via a parallel circuit of a resistor 11 and a capacitor 12. Thus, when the rotating body 4 rotates in one direction with the DC voltage applied to the power supply voltage input unit 10 and the switches 3 are turned on and off alternately, the parallel circuit and the switches 3 The signal output unit 13 between the two outputs a pulse signal of high and low binary levels.

図示例では、各スイッチ3に対応する信号出力部13から出力されるパルス信号のレベル値は、該スイッチ3が導通状態(ON状態)であるとき、低レベル(接地レベル)、該スイッチ3が遮断状態(OFF状態)であるとき、高レベルとなる。但し、該スイッチ3が導通状態(ON状態)であるときのパルス信号のレベル値が高レベル、該スイッチ3が遮断状態(OFF状態)であるときのパルス信号のレベル値が低レベルとなるようにしてもよい。また、パルス信号を生成するための回路は、図1に示す回路構成に限られず、例えば、上記コンデンサ12を省略することも可能である。   In the illustrated example, the level value of the pulse signal output from the signal output unit 13 corresponding to each switch 3 is low level (ground level) when the switch 3 is in a conductive state (ON state), and the switch 3 When in the shut-off state (OFF state), the level is high. However, the level value of the pulse signal when the switch 3 is in the conductive state (ON state) is high, and the level value of the pulse signal when the switch 3 is in the cutoff state (OFF state) is low. It may be. Further, the circuit for generating the pulse signal is not limited to the circuit configuration shown in FIG. 1, and for example, the capacitor 12 can be omitted.

以上が、本実施形態におけるロータリエンコーダ1の概略構成である。   The above is the schematic configuration of the rotary encoder 1 in the present embodiment.

本実施形態では、上記ロータリエンコーダ1の各相の信号出力部13は、回転体4の回転状態(回転速度や回転方向)を把握するための演算処理を行う演算処理装置としてのCPU20に接続され、該信号出力部13から出力されるパルス信号が、CPU20に入力されるようになっている。   In this embodiment, the signal output unit 13 for each phase of the rotary encoder 1 is connected to a CPU 20 as an arithmetic processing unit that performs arithmetic processing for grasping the rotation state (rotational speed and direction) of the rotating body 4. The pulse signal output from the signal output unit 13 is input to the CPU 20.

このCPU20は、本発明を適用した演算処理を、あらかじめROM(図示省略)に実装されたプログラムに従って実行する。   The CPU 20 executes arithmetic processing to which the present invention is applied in accordance with a program mounted in advance in a ROM (not shown).

以下、このCPU20の演算処理を詳細に説明する。   Hereinafter, the arithmetic processing of the CPU 20 will be described in detail.

本実施形態では、CPU20は、前記各相のパルス信号のレベル値を観測(サンプリング)しつつ、図3のフローチャートに示す処理を所定の演算処理周期で逐次実行する。   In the present embodiment, the CPU 20 sequentially executes the processing shown in the flowchart of FIG. 3 at a predetermined arithmetic processing cycle while observing (sampling) the level value of the pulse signal of each phase.

CPU20は、ロータリエンコーダ1から入力される各相のパルス信号毎に、検知対象切替わりの発生を検知する切替わり検知処理をSTEP1で実行する。そして、CPU20は、この切替わり検知処理の結果を基に、STEP2において、パルス信号のレベル値(回転体4の回転状態を把握するために使用するレベル値)を確定し、パルス信号の整形波形を認識する。   The CPU 20 executes the switching detection process for detecting the occurrence of switching of the detection target in STEP 1 for each phase pulse signal input from the rotary encoder 1. Then, based on the result of the switching detection process, the CPU 20 determines the level value of the pulse signal (level value used for grasping the rotation state of the rotating body 4) in STEP2, and forms the waveform of the pulse signal. Recognize

ここで、検知対象切替わりは、CPU20にロータリエンコーダ1から入力される各相毎の実際のパルス信号のレベル値の切替わりのうち、回転体4の回転角度位置に応じて規定される前記摺動子5の円環状部7に対する接触位置が、チャタリング現象(バウンス現象を含む)や、瞬時的なノイズに起因する切替わりとしての除外対象切替わりを除外したものを意味する。   Here, the detection target switching is the sliding specified in accordance with the rotation angle position of the rotating body 4 among the switching of the level value of the actual pulse signal for each phase input from the rotary encoder 1 to the CPU 20. The contact position of the moving element 5 with respect to the annular portion 7 means that the chattering phenomenon (including the bounce phenomenon) and the exclusion target switching as switching due to instantaneous noise are excluded.

この検知対象切替わりは、換言すれば、チャタリング現象や、瞬時的なノイズが発生しない場合に、回転体4の回転角度位置の変化(摺動子5の円環状部7に対する接触位置の変化)に依存してロータリエンコーダ1から出力されるはずのパルス信号(すなわち、摺動子5の接触位置が導体部分8及び絶縁体部分9の一方から他方に移行する瞬間にだけレベル値が切替わるパルス信号)のレベル値の切替わりを意味する。そして、パルス信号の整形波形というのは、その波形のレベル値の切替わりが検知対象切替わりだけから構成されるパルス信号(実際のパルス信号から除外対象切替わりを除去したパルス信号)の波形を意味する。   In other words, this detection target switching is a change in the rotation angle position of the rotating body 4 (change in the contact position of the slider 5 with respect to the annular portion 7) when no chattering phenomenon or instantaneous noise occurs. Depending on the pulse signal to be output from the rotary encoder 1 (that is, a pulse whose level value is switched only at the moment when the contact position of the slider 5 shifts from one of the conductor portion 8 and the insulator portion 9 to the other). Signal) level value switching. The waveform of the pulse signal is a waveform of a pulse signal (a pulse signal obtained by removing the exclusion target switching from the actual pulse signal) in which the switching of the level value of the waveform is only the detection target switching. means.

上記STEP1の切替わり検知処理は、種々様々の手法で実行することが可能であるが、本実施形態では、代表的な2種類の例をSTEP2の処理と併せて以下に説明する。   The switching detection process of STEP1 can be executed by various methods. In the present embodiment, two typical examples will be described below together with the process of STEP2.

STEP1の切替わり検知処理の第1の例では、CPU20は、入力されたパルス信号の実際のレベル値のステップ状の切替わりとしてのエッジ(実際のパルス信号の波形の立ち上がり又は立下り)を検出し、そのエッジ検出に応じて次のような割り込み処理を実行することによって、検知対象切替わりの発生を検知する。   In the first example of the switching detection process of STEP 1, the CPU 20 detects an edge (rising edge or falling edge of the actual pulse signal waveform) as a step-like switching of the actual level value of the input pulse signal. In response to the edge detection, the following interrupt processing is executed to detect the occurrence of switching of the detection target.

すなわち、CPU20は、エッジが検出された後、現在設定されているチャタリング排除時間が経過した直後の時点でパルス信号の実際のレベル値を観測(サンプリング)する。なお、現在設定されているチャタリング排除時間は、CPU20が今回の切替わりの検知処理の以前に既に実行した切替わり検知処理で、検知対象切替わりの発生を検知した場合に、後述の処理によって設定された時間のうちの最新値である。該チャタリング排除時間は、基本的には、チャタリング現象や瞬時的なノイズに起因して発生する1つ又は連続する複数のパルス(幅が短いパルス)が該チャタリング排除時間の時間幅内に収まるように設定されたものである。   That is, after detecting the edge, the CPU 20 observes (samples) the actual level value of the pulse signal immediately after the currently set chattering exclusion time has elapsed. The currently set chattering exclusion time is set by the process described later when the CPU 20 detects the occurrence of switching of the detection target in the switching detection process already executed before the current switching detection process. It is the latest value of the recorded time. Basically, the chattering exclusion time is such that one or a plurality of continuous pulses (pulses having a short width) generated due to chattering phenomenon or instantaneous noise are within the time width of the chattering exclusion time. Is set.

そして、CPU20は、STEP1の切替わり検知処理では、チャタリング排除時間が経過した直後の時点で取得したパルス信号のレベル値の観測値が、エッジ検出の直前のレベル値と同じである場合(換言すれば、エッジ検出の直後のレベル値と異なる場合)には、上記エッジが検出されてから、チャタリング排除時間が経過するまでの期間内で発生したパルス信号のレベル値の切替わりが、検出されたエッジを含めて、チャタリング現象又は瞬時的なノイズに起因する除外対象切替わりであるとし、検知対象切替わりが発生していないものとみなす。   Then, in the switching detection process of STEP 1, the observed value of the level value of the pulse signal acquired immediately after the chattering exclusion time has elapsed is the same as the level value immediately before the edge detection (in other words, For example, when the level value is different from the level value immediately after the edge detection), the switching of the level value of the pulse signal generated within the period from the detection of the edge until the chattering exclusion time elapses is detected. It is assumed that the exclusion target switching due to chattering phenomenon or instantaneous noise is included, including the edge, and that the detection target switching has not occurred.

そして、この場合には、CPU20は、STEP2において、上記チャタリング排除時間の期間内でのパルス信号のレベル値が、エッジ検出の直前のレベル値と同じレベル値に保持されていたものとして、パルス信号の整形波形を認識する。   In this case, the CPU 20 determines in STEP 2 that the level value of the pulse signal within the chattering elimination time period is held at the same level value as the level value immediately before the edge detection. Recognize the shaped waveform.

例えば図4を参照して、図4の上段に示すような波形のパルス信号がCPU20に入力された場合を想定する。そして、時刻t10でこのパルス信号のエッジが検出され、その後、チャタリング排除時間が経過するまでの期間内の時刻t11で実際のパルス信号のレベル値の切替わり(レベル値が時刻t10の直前のレベル値に復帰する切替わり)が発生し、該チャタリング排除時間の経過直後の時刻t12で観測したパルス信号のレベル値が、エッジを検出した時刻t10の直前のレベル値と同じになったものとする。   For example, with reference to FIG. 4, a case is assumed where a pulse signal having a waveform as shown in the upper part of FIG. Then, the edge of this pulse signal is detected at time t10, and then the level value of the actual pulse signal is switched at time t11 within the period until chattering exclusion time elapses (the level value is the level immediately before time t10). Switching to return to the value) occurs, and the level value of the pulse signal observed at time t12 immediately after the chattering exclusion time has elapsed is the same as the level value immediately before time t10 at which the edge was detected. .

この場合には、CPU20は、STEP1の切替わり検知処理では、時刻t10でのパルス信号のレベル値の切替わり(エッジ)と、時刻t11でのパルス信号のレベル値の切替わりとを除外対象切替わりとみなし、時刻t10からt12までのチャタリング排除時間の期間内(t10を含む)で、検知対象切替わりは発生していないものとみなす。   In this case, in the switching detection process of STEP 1, the CPU 20 determines whether the level value switching (edge) of the pulse signal at time t 10 and the level value switching of the pulse signal at time t 11 are excluded. It is considered that there is no change in the detection target within the chattering exclusion time period from time t10 to t12 (including t10).

この場合には、CPU20は、STEP2の処理では、時刻t10からチャタリング排除時間の経過直後の時刻t12までの期間におけるパルス信号のレベル値が時刻t10の直前のレベル値と同じレベル値に保たれているものとみなして、図4の下段に示す如く、パルス信号の整形波形を認識する。   In this case, in the processing of STEP 2, the CPU 20 maintains the level value of the pulse signal in the period from time t10 to time t12 immediately after the chattering exclusion time has passed, to the same level value as the level value immediately before time t10. As shown in the lower part of FIG. 4, the shaped waveform of the pulse signal is recognized.

一方、現在設定されているチャタリング排除時間が経過した直後の時点で取得したパルス信号のレベル値の観測値が、エッジ検出の直前のレベル値と異なる場合(換言すれば、エッジ検出の直後のレベル値と同じである場合)には、CPU20は、パルス信号のレベル値の除外対象切替わりでない切替わり、すなわち、検知対象切替わりが発生したものとみなす(検知対象切替わりの発生を検知する)。   On the other hand, if the observed value of the level value of the pulse signal acquired immediately after the currently set chattering exclusion time has elapsed differs from the level value immediately before edge detection (in other words, the level immediately after edge detection) If the same value), the CPU 20 considers that the switching of the level value of the pulse signal is not switched to the exclusion target, that is, the detection target switching has occurred (detection of detection target switching). .

例えば図4を参照して、時刻t13でエッジが検出され、その後、チャタリング排除時間が経過した直後の時刻t14で観測したパルス信号のレベル値が、エッジを検出した時刻t13の直前のレベル値と異なる場合を想定する。この場合には、CPU20は、STEP1の切替わり検知処理では、検知対象切替わりが発生したことを時刻t14で検知する。   For example, referring to FIG. 4, the edge value is detected at time t13, and then the level value of the pulse signal observed at time t14 immediately after the chattering exclusion time has elapsed is the level value immediately before time t13 when the edge is detected. Assume a different case. In this case, in the switching detection process of STEP1, the CPU 20 detects that the detection target switching has occurred at time t14.

そして、この場合には、CPU20は、STEP2の処理では、図4の下段に示す如く、時刻t14でレベル値が切替わったものとして、パルス信号の整形波形を認識する。   In this case, in step 2, the CPU 20 recognizes the shaped waveform of the pulse signal on the assumption that the level value is switched at time t14 as shown in the lower part of FIG.

切替わり検知処理の第1の例では、以上説明した処理によって、実際のレベル値の切替わり後にチャタリング排除時間の期間内で該レベル値を復帰させる切替わりを伴う切替わり、すなわち、チャタリング現象や瞬時的なノイズに起因して発生するような短い幅のパルスによる切替わりは、検知対象切替わりとしては検知されないこととなり、回転体4の回転角度位置に依存する本来の切替わり(摺動子5の接触位置が導体部分8及び絶縁体部分9の一方側から他方側に移行する瞬間にだけ生じる切替わり)を検知対象切替わりとして検知できることとなる。   In the first example of the switching detection process, the above-described processing causes a switching with a switching for returning the level value within the chattering exclusion time period after the actual level value switching, that is, chattering phenomenon or Switching due to a pulse having a short width that occurs due to instantaneous noise is not detected as switching of the detection target, and the original switching depending on the rotational angle position of the rotating body 4 (slider) 5), which occurs only at the moment when the contact position 5 shifts from one side of the conductor portion 8 and the insulator portion 9 to the other side), can be detected as the detection target switching.

なお、上記第1の例でのSTEP1の切替わり検知処理は、エッジが検出されてから、チャタリング排除時間の経過直後の時点までの期間で行なわれ、それ以外の期間では省略される。   Note that the switching detection process of STEP 1 in the first example is performed in a period from when an edge is detected until immediately after the chattering exclusion time has elapsed, and is omitted in other periods.

次に、切替わり検知処理の第2の例では、CPU20は、入力されたパルス信号の実際のレベル値を所定の演算処理周期で逐次観測(サンプリング)し、以下に説明するようなポーリング形式の処理によって検知対象切替わりの発生を検知する。   Next, in the second example of the switching detection process, the CPU 20 sequentially observes (samples) the actual level value of the input pulse signal at a predetermined calculation processing cycle, and uses a polling format as described below. The occurrence of switching of the detection target is detected by the process.

すなわち、STEP1の切替わり検知処理では、CPU20は、現在設定されているチャタリング排除時間の期間分のパルス信号のレベル値の複数の観測値を上記演算処理周期毎に逐次更新しつつ記憶保持する。そして、そのチャタリング排除時間の期間分のレベル値の複数の観測値の全てが同一のレベル値であるか否かを判断し、この判断結果が否定的である場合には、チャタリング排除時間の期間内で検知対象切替わりが発生していないものとみなす。   That is, in the switching detection process of STEP 1, the CPU 20 stores and holds a plurality of observed values of the level values of the pulse signal for the currently set chattering exclusion time period while sequentially updating each calculation processing cycle. Then, it is determined whether all of the plurality of observed values of the level value for the chattering exclusion time period are the same level value, and if this determination result is negative, the chattering exclusion time period It is assumed that there is no switching of the detection target.

さらに、この場合には、CPU20は、STEP2において、上記チャタリング排除時間の期間内でのパルス信号のレベル値が、該チャタリング排除時間の期間の直前のレベル値と同じレベル値に保持されていたものとして、パルス信号の整形波形を認識する。   Further, in this case, the CPU 20 holds the level value of the pulse signal within the chattering exclusion time period at STEP 2 at the same level value as the level value immediately before the chattering exclusion time period. As such, the shaped waveform of the pulse signal is recognized.

また、CPU20は、上記判断結果が否定的から肯定的に変化したときに、検知対象切替わりが発生したものとみなす(検知対象切替わりの発生を検知する)。   In addition, when the determination result changes from negative to positive, the CPU 20 regards that the detection target switching has occurred (detects the detection target switching).

例えば、CPU20に入力される実際のパルス信号の波形が図5の上段に示す如く変化した場合を想定し、現在設定されているチャタリング排除時間が、CPU20の逐次観測の周期(サンプリング周期)の2周期分の時間であるとする。この場合には、チャタリング排除時間の期間分のパルス信号の観測値の個数は3個である。なお、図5中の時刻t20〜t25は、演算処理周期毎のレベル値の観測時刻を示しており、それらの時刻t20〜t25の互いに隣合う2つの時刻間の時間幅が、上記演算処理周期である。   For example, assuming that the waveform of the actual pulse signal input to the CPU 20 changes as shown in the upper part of FIG. 5, the currently set chattering exclusion time is 2 of the sequential observation period (sampling period) of the CPU 20. It is assumed that the time is a period. In this case, the number of observed values of the pulse signal for the chattering exclusion time period is three. Note that times t20 to t25 in FIG. 5 indicate the observation time of the level value for each calculation processing cycle, and the time width between two adjacent times of those times t20 to t25 is the above calculation processing cycle. It is.

この場合、時刻t20からt22まで、t21からt23まで、及びt22からt24までの各期間(チャタリング排除時間の期間)において、該期間におけるパルス信号のレベル値の3個の観測値が、互いに同一のレベル値とはなっていないので、時刻t24までは、STEP1の切替わり検知処理において、CPU20は、検知対象切替わりが発生していないものとみなす。そして、この場合、CPU20は、STEP2の処理において、パルス信号のレベル値が、時刻t20の直前のレベル値と同じレベル値に保たれているものとみなして、図5の下段に示す如くパルス信号の整形波形を認識する。   In this case, in each period from time t20 to t22, from t21 to t23, and from t22 to t24 (period of chattering exclusion time), the three observed values of the level value of the pulse signal in the period are the same. Since it is not a level value, until the time t24, in the switching detection process of STEP1, the CPU 20 regards that the detection target switching has not occurred. In this case, the CPU 20 assumes that the level value of the pulse signal is maintained at the same level value as that immediately before time t20 in the processing of STEP2, and the pulse signal as shown in the lower part of FIG. Recognize the shaped waveform.

また、時刻t23からt25までの期間におけるパルス信号のレベル値の3個の観測値が、互いに同一のレベル値となるので、CPU20は、時刻t25の演算処理周期におけるSTEP1の切替わり検知処理において、検知対象切替わりの発生を検知する。そして、この場合には、CPU20は、STEP2の処理において、図5の下段に示す如く、時刻t25でレベル値が切替わるパルス信号として、パルス信号の整形波形を認識する。   Further, since the three observed values of the level value of the pulse signal in the period from time t23 to t25 become the same level value, the CPU 20 performs the switching detection process of STEP1 in the calculation processing cycle at time t25. Detects occurrence of switching of detection target. In this case, the CPU 20 recognizes the shaped waveform of the pulse signal as a pulse signal whose level value switches at time t25 as shown in the lower part of FIG.

切替わり検知処理の第2の例では、以上説明した処理によって、第1の例の場合と同様に、実際のレベル値の切替わり後にチャタリング排除時間の期間内で該レベル値を復帰させる切替わりを伴う切替わり、すなわち、チャタリング現象や瞬時的なノイズに起因して発生するような短いパルス幅のパルスによる切替わりは、検知対象切替わりとしては検知されないこととなり、回転体4の回転角度位置に依存する本来の切替わりを検知対象切替わりとして検知できることとなる。   In the second example of the switching detection process, the switching described in the above-described process is performed to restore the level value within the chattering exclusion time period after the actual level value is switched, as in the case of the first example. That is, switching due to a pulse having a short pulse width that occurs due to chattering phenomenon or instantaneous noise is not detected as detection object switching, and the rotational angle position of the rotating body 4 It is possible to detect the original switching depending on the detection target switching.

図3のフローチャートの説明に戻って、CPU20は、STEP2の処理に続くSTEP3において、パルス信号の整形波形のレベル値の切替わりが発生したか否かを判断する。この判断結果は、STPE1の切替わり検知処理で、検知対象切替わりの発生が検知された場合に肯定的とされ、該検知対象切替わりの発生が検知されない場合に否定的とされる。   Returning to the description of the flowchart of FIG. 3, the CPU 20 determines whether or not the switching of the level value of the shaping waveform of the pulse signal has occurred in STEP 3 following the processing of STEP 2. This determination result is affirmative when the detection switching of the detection target is detected in the switching detection process of STPE1, and is negative when the occurrence of the switching of the detection target is not detected.

そして、このSTEP3の判断結果が否定的である場合には、CPU20は、STEP3の判断結果が肯定的となってから、次に肯定的となるまでの経過時間(時間幅)を計時するための幅カウンタのカウント値を、所定の刻み値(例えば“1”)だけ増加させるカウントアップをSTEP10で実行し、今回の演算処理周期の処理を終了する(次回の演算処理周期まで待機する)。   When the determination result of STEP 3 is negative, the CPU 20 measures the elapsed time (time width) from when the determination result of STEP 3 becomes positive until it becomes positive next. Counting up the count value of the width counter by a predetermined step value (for example, “1”) is executed in STEP 10, and the processing of the current arithmetic processing cycle is terminated (waiting for the next arithmetic processing cycle).

STEP3の判断結果が肯定的となった場合には、CPU20は、幅カウンタの現在のカウント値を基に、STEP1で検知した検知対象切替わりに対応する実際のパルス信号の切替わりの直前における該パルス信号のパルス幅を推定する処理をSTEP4で実行した後、STEP5において、幅カウンタのカウント値を“0”に初期化(リセット)する。   If the determination result in STEP 3 is affirmative, the CPU 20 determines that the pulse immediately before switching of the actual pulse signal corresponding to the detection target switching detected in STEP 1 based on the current count value of the width counter. After the processing for estimating the pulse width of the signal is executed in STEP 4, the count value of the width counter is initialized (reset) to “0” in STEP 5.

ここで、STEP4の推定処理を図6を参照して説明する。実際のパルス信号が、例えば図6の上段に示すように時刻t30,t32でレベル値の切替わりが発生するパルス信号である場合を想定する。なお、ここでは、理解の便宜上、実際のパルス信号には、除外対象切替わりは含まれていないものとし、該パルス信号におけるレベル値の切替わりは、いずれも、検知対象切替わりであるものとする。   Here, the estimation process of STEP4 will be described with reference to FIG. Assume that the actual pulse signal is a pulse signal in which level value switching occurs at times t30 and t32 as shown in the upper part of FIG. Here, for convenience of understanding, it is assumed that the actual pulse signal does not include the switching of the exclusion target, and the level value switching in the pulse signal is all the detection target switching. To do.

そして、時刻t30,t32でそれぞれ設定されているチャタリング排除時間が、それぞれTc0、Tc1であるとする(図示例では、Tc0<Tc1)。   It is assumed that chattering exclusion times set at times t30 and t32 are Tc0 and Tc1, respectively (Tc0 <Tc1 in the illustrated example).

この場合、幅カウンタのカウント値から認識されるパルス幅のパルス信号の波形は、図6の下段に示す如き波形となる。すなわち、時刻t30,t32での実際のパルス信号の検知対象切替わりが、それぞれ、時刻t31,t33で検知され、これらの時刻t31,t33でレベル値の切替わりが生じる波形が幅カウンタのカウント値から認識されるパルス幅のパルス信号の波形である。   In this case, the waveform of the pulse signal having the pulse width recognized from the count value of the width counter is as shown in the lower part of FIG. That is, the actual pulse signal detection target switching at times t30 and t32 is detected at times t31 and t33, respectively, and the waveforms that cause the level value switching at times t31 and t33 are the count values of the width counter. It is the waveform of the pulse signal of the pulse width recognized from.

このような状況において、検知対象切替わりが検知される時刻t33の演算処理周期において、前記STEP4の推定処理を行なう場合を例にとって説明する。   In such a situation, the case where the estimation process of STEP4 is performed in the calculation process cycle at time t33 when the detection target switching is detected will be described as an example.

時刻t33の演算処理周期において、CPU20が、STEP4の推定処理で推定しようとするパルス幅は、実際のパルス信号のレベル値の切替わりのうち、時刻t31の演算処理周期で検知された時刻t30での検知対象切替わり(前回の検知対象切替わり)と、時刻t33の演算処理周期で検知された時刻t32での検知対象切替わり(今回の検知対象切替わり)との間のパルス幅、すなわち、図6のパルス幅Wdである。   In the calculation processing cycle at time t33, the pulse width to be estimated by the CPU 20 in the estimation processing in STEP 4 is the time t30 detected in the calculation processing cycle at time t31 in the actual level change of the pulse signal. Between the detection object switching (previous detection object switching) and the detection object switching (current detection object switching) at time t32 detected in the calculation processing cycle at time t33, that is, This is the pulse width Wd of FIG.

また、STEP4の推定処理で使用するカウント値は、前回の検知対象切替わりの発生を検知した演算処理周期の時刻t31から、今回の検知対象切替わりの発生を検知した演算処理周期の時刻t33までの期間における前記演算処理周期毎のカウント値であるから、時刻t31から時刻t33までの時間幅Wdcを示すものとなる。その時間幅Wdcは、幅カウンタのカウントアップの刻み幅を、“1”とした場合、STEP4の推定処理で使用するカウント値に演算処理周期の時間を乗じたものとなる。   Also, the count value used in the estimation process of STEP 4 is from the time t31 of the arithmetic processing cycle when the occurrence of the previous detection target switching is detected to the time t33 of the arithmetic processing cycle when the occurrence of the current detection target switching is detected. Therefore, the time width Wdc from time t31 to time t33 is indicated. The time width Wdc is obtained by multiplying the count value used in the estimation process of STEP 4 by the time of the arithmetic processing period when the increment of the count up of the width counter is “1”.

ここで、実際のパルス信号における前記パルス幅Wdの始端側の検知対象切替わりは、その発生時刻t30からチャタリング排除時間Tc0の経過直後の時刻t31の演算処理周期で検知され、また、パルス幅Wdの終端側の検知対象切替わりは、その発生時刻t32からチャタリング排除時間Tc1の経過直後の時刻t33の演算処理周期(今回の演算処理周期)で検知されることとなる。   Here, the detection target switching on the start end side of the pulse width Wd in the actual pulse signal is detected at the calculation processing period from the generation time t30 to the time t31 immediately after the chattering exclusion time Tc0 has elapsed, and the pulse width Wd The switching of the detection object on the end side of is detected at the calculation processing cycle (current calculation processing cycle) at time t33 immediately after the chattering exclusion time Tc1 elapses from the occurrence time t32.

この場合、上記チャタリング排除時間Tc0とTc1とが同一である場合には、パルス幅Wdは、時刻t31から時刻t33までの時間幅Wdcに一致することとなる。従って、この場合には、今回の演算処理周期での前記幅カウンタのカウント値が、パルス幅Wdを示すものとなる。   In this case, when the chattering exclusion times Tc0 and Tc1 are the same, the pulse width Wd matches the time width Wdc from time t31 to time t33. Therefore, in this case, the count value of the width counter in the current calculation processing cycle indicates the pulse width Wd.

但し、本実施系形態では、チャタリング排除時間は、検知対象切替わりの発生が検知される毎に、後述の処理によって可変的に設定されるため、Tc0とTc1とは同一であるとは限らない。   However, in the present embodiment, since the chattering exclusion time is variably set by the process described later every time the occurrence of switching of the detection target is detected, Tc0 and Tc1 are not necessarily the same. .

そして、このようにTc0とTc1とが同一でない場合には、時刻t31から時刻t33までの時間幅Wdcは、実際のパルス信号のパルス幅Wdに対して、図6中に示す如く、Tc0とTc1との偏差分のずれを生じる。   When Tc0 and Tc1 are not the same as described above, the time width Wdc from time t31 to time t33 is equal to Tc0 and Tc1 as shown in FIG. 6 with respect to the pulse width Wd of the actual pulse signal. Deviation of the deviation is generated.

そこで、CPU20は、STEP4の推定処理では、今回の検知対象切替わりの発生を検知した切替わり検知処理で使用したチャタリング排除時間Tc1と、前回の検知対象切替わりの発生を検知した切替わり検知処理で使用したチャタリング排除時間Tc0との偏差分だけ、今回の演算処理周期での幅カウンタのカウント値が示す時間幅Wdcを補正することにより、実際のパルス信号におけるパルス幅Wd(最新の検知対象切替わりと、その1つ前の検知対象切替わりとの間のパルス幅)を推定する。   Therefore, in the estimation process of STEP 4, the CPU 20 detects the chattering exclusion time Tc1 used in the switching detection process that has detected the occurrence of the current detection target switching, and the switching detection process that has detected the previous detection target switching. By correcting the time width Wdc indicated by the count value of the width counter in the current calculation processing period by the deviation from the chattering exclusion time Tc0 used in the above, the pulse width Wd in the actual pulse signal (the latest detection target switching The pulse width between the change and the previous detection target change) is estimated.

より詳しくは、CPU20は、次式(1)により、Wdcを、Tc0とTc1との偏差に応じて補正することにより、実際のパルス信号のパルス幅をWdを推定する。   More specifically, the CPU 20 estimates Wd as the pulse width of the actual pulse signal by correcting Wdc according to the deviation between Tc0 and Tc1 according to the following equation (1).


Wd=Wdc+(Tc0−Tc1) ……(1)

以上がSTEP4の推定処理の詳細である。

Wd = Wdc + (Tc0-Tc1) (1)

The above is the details of the estimation process of STEP4.

なお、本実施形態では、上記の如くパルス幅Wdを推定するようにしたが、別の形態として、次のようにしてもよい。すなわち、STEP4に続くSTEP5において、幅カウンタの初期値を、今回の検知対象切替わりの発生を検知した切替わり検知処理で使用したチャタリング排除時間に相当するカウント値(該チャタリング排除時間を演算処理周期で除算した値)に設定するようにする。   In the present embodiment, the pulse width Wd is estimated as described above. However, as another form, the following may be used. That is, in STEP5 following STEP4, the initial value of the width counter is set to a count value corresponding to the chattering exclusion time used in the switching detection process in which occurrence of the current detection target switching is detected (the chattering exclusion time is calculated as a processing cycle). (Value divided by).

このようにした場合には、今回の演算処理周期でのSTEP4で使用する幅カウンタのカウント値は、式(1)における(Wdc+Tc0)の時間幅を示すものとなる。従って、そのカウント値が示す時間幅(Wdc+Tc0)から今回の検知対象切替わりの発生を検知した切替わり検知処理で使用したチャタリング排除時間Tc1を減じることによって、実際のパルス信号のパルス幅Wdの推定値を求めるようにしてもよい。   In such a case, the count value of the width counter used in STEP 4 in the current calculation processing cycle indicates the time width of (Wdc + Tc0) in the equation (1). Therefore, the pulse width Wd of the actual pulse signal is estimated by subtracting the chattering exclusion time Tc1 used in the switching detection process for detecting the occurrence of the current detection target switching from the time width (Wdc + Tc0) indicated by the count value. A value may be obtained.

以上の如くSTEP4,5の処理を実行した後、CPU20は、回転体4の回転速度の変化が発生したか否かをSTEP6で判断する。   After executing the processing of STEPs 4 and 5 as described above, the CPU 20 determines in STEP 6 whether or not a change in the rotational speed of the rotating body 4 has occurred.

具体的には、CPU20は、今回算出したパルス幅の推定値により示される回転体4の回転速度と、前回算出したパルス幅の推定値により示される回転体4の回転速度とを比較する。そして、CPU20は、前者の回転速度が後者の回転速度と異なる場合には、STEP6の判断結果が肯定的であるとし、両者が同一である場合には、STEP6の判断結果が否定的であるとする。なお、両者の回転速度が同一であるか否かは、両者の回転速度の差の絶対値が、あらかじめ定めた“0”近傍の所定値(>0)よりも小さいか否かによって判断するようにしてもよい。   Specifically, the CPU 20 compares the rotation speed of the rotating body 4 indicated by the estimated value of the pulse width calculated this time with the rotation speed of the rotating body 4 indicated by the estimated value of the pulse width calculated last time. If the former rotational speed is different from the latter rotational speed, the CPU 20 determines that the determination result in STEP 6 is positive, and if both are the same, the determination result in STEP 6 is negative. To do. Whether or not the rotational speeds of the two are the same is determined by whether or not the absolute value of the difference between the rotational speeds of the two is smaller than a predetermined value (> 0) in the vicinity of “0” determined in advance. It may be.

ここで、回転体4の回転速度が一定に維持されている状況であっても、各相のパルス信号のレベル値が高レベルとなる期間のパルス幅と、低レベルとなる期間のパルス幅とは一般には異なる。従って、STEP6の判断処理では、CPU20は、今回のパルス幅の推定値(又はこれを演算処理周期で除算してなるカウント値)と、前回のパルス幅の推定値(又はこれを演算処理周期で除算してなるカウント値)とを、それぞれ、当該パルス幅に対応するレベル値が低レベルであるか高レベルであるかで各別にあらかじめ設定した演算式又はマップ(パルス幅と回転体4の回転速度との間の関係(反比例関係)を表す演算式又はマップ)によって、回転体4の回転速度に換算し、それらの換算した回転速度を比較する。   Here, even in a situation where the rotation speed of the rotating body 4 is kept constant, the pulse width of the period in which the level value of the pulse signal of each phase is high, and the pulse width of the period in which the level is low Is generally different. Therefore, in the determination process of STEP 6, the CPU 20 determines the current pulse width estimated value (or a count value obtained by dividing the pulse width by the calculation processing period) and the previous pulse width estimated value (or the calculated value in the calculation processing period). The calculation value or map (pulse width and rotation of the rotating body 4) set in advance depending on whether the level value corresponding to the pulse width is a low level or a high level. An arithmetic expression or map representing a relationship (inverse proportional relationship) with the speed is converted into the rotation speed of the rotating body 4 and the converted rotation speeds are compared.

但し、回転体4の回転速度が一定に維持されている状況で、いずれかの相のパルス信号のレベル値が高レベルとなる期間のパルス幅と、低レベルとなる期間のパルス幅とが同じになるようにロータリエンコーダ1が構成されているような場合(円環状部7の導体部分8の弧長と絶縁体部分9の弧長とが同じに設定されている場合)には、その相のパルス信号についてのSTEP6の判断処理では、今回のパルス幅の推定値(又はこれを演算処理周期で除算してなるカウント値)と、前回のパルス幅の推定値(又はこれを演算処理周期で除算してなるカウント値)とを比較するようにしてもよい。   However, in a situation where the rotational speed of the rotating body 4 is kept constant, the pulse width during the period when the level value of the pulse signal of any phase is high and the pulse width during the period when it is low are the same. When the rotary encoder 1 is configured so that the arc length of the conductor portion 8 of the annular portion 7 and the arc length of the insulator portion 9 are set equal to each other, In the judgment process of STEP 6 for the pulse signal of this time, the estimated value of the current pulse width (or the count value obtained by dividing this by the calculation processing period) and the estimated value of the previous pulse width (or this is calculated by the calculation processing period). A count value obtained by division may be compared.

回転体4の回転速度が一定に維持されている状況で、低レベルとなる期間のパルス幅と高レベルとなる期間のパルス幅との比率に応じて、一方のパルス幅を他方のパルス幅相当のパルス幅に換算し、当該一方のパルス幅の換算値と、他方のパルス幅とを比較するようにすることも可能である。   In a situation where the rotational speed of the rotating body 4 is kept constant, one pulse width corresponds to the other pulse width according to the ratio of the pulse width during the low level period to the pulse width during the high level period. It is also possible to compare the converted value of one pulse width with the other pulse width.

上記STEP6の判断結果が肯定的である場合には、CPU20は、チャタリング排除時間の設定値を更新する処理をSTEP7で実行した後に、STEP8の処理を実行する。また、STEP6の判断結果が否定的である場合には、CPU20は、チャタリング排除時間の設定値を更新することなく(現状に維持したまま)、STEP8の処理を実行する。なお、本実施形態では、STEP7の処理(チャタリング排除時間の設定値の更新処理)をSTEP6の判断結果が肯定的である場合にだけ行なうが、STEP6の判断処理を省略し(回転体4の回転速度の変化の発生の有無によらずに)、STEP7の処理を実行するようにしてもよい。   When the determination result in STEP 6 is affirmative, the CPU 20 executes the process of STEP 8 after executing the process of updating the setting value of the chattering exclusion time in STEP 7. If the determination result in STEP 6 is negative, the CPU 20 executes the process in STEP 8 without updating the set value for the chattering exclusion time (while maintaining the current value). In this embodiment, the processing of STEP 7 (update processing of the setting value for chattering exclusion time) is performed only when the determination result of STEP 6 is affirmative, but the determination processing of STEP 6 is omitted (the rotation of the rotating body 4). The processing of STEP 7 may be executed regardless of whether or not a speed change has occurred.

STEP7でチャタリング排除時間の設定値を更新する処理は、次のように行なわれる。   The process of updating the set value of chattering exclusion time in STEP 7 is performed as follows.

すなわち、CPU20は、基本的指針として、今回のパルス幅の推定値(最新の推定値)により示される回転体4の回転速度が速いほど、チャタリング排除時間を短くするように該チャタリング排除時間を設定する。   That is, as a basic guideline, the CPU 20 sets the chattering exclusion time so that the chattering exclusion time is shortened as the rotational speed of the rotating body 4 indicated by the current pulse width estimated value (latest estimated value) increases. To do.

より具体的には、CPU20は、今回のパルス幅の推定値(又はこれを演算処理周期で除算してなるカウント値)を、前記STEP6に関して説明した如く、所定の演算式又はマップによって回転体4の回転速度に換算する。そして、CPU20は、この換算した回転速度から、あらかじめ設定された所定の演算式又はマップ(回転速度とチャタリング排除時間との間の関係を表す演算式又はマップ)を用いて新たなチャタリング排除時間を決定する。   More specifically, the CPU 20 calculates the estimated value of the current pulse width (or a count value obtained by dividing the estimated value by the calculation processing cycle) according to the predetermined calculation formula or map as described with respect to STEP 6. Convert to the rotation speed of. Then, the CPU 20 calculates a new chattering exclusion time from the converted rotation speed using a predetermined arithmetic expression or map (an arithmetic expression or map representing a relationship between the rotation speed and the chattering exclusion time) set in advance. decide.

この場合、チャタリング排除時間を決定するために使用する演算式又はマップは、回転速度の増加に伴い、それに反比例して、チャタリング排除時間が短くなるように設定されたものである。   In this case, the arithmetic expression or map used to determine the chattering exclusion time is set so that the chattering exclusion time becomes shorter in inverse proportion to the increase in the rotational speed.

あるいは、次のようにしてチャタリング排除時間を設定するようにしてもよい。すなわち、CPU20は、今回のパルス幅の推定値(又はこれを演算処理周期で除算してなるカウント値)から、あらかじめ設定された所定の演算式又はマップ(パルス幅又はこれに対応するカウント値と、チャタリング排除時間との間の関係を表す演算式又はマップ)を用いて新たなチャタリング排除時間を決定する。   Alternatively, the chattering exclusion time may be set as follows. That is, the CPU 20 calculates a predetermined arithmetic expression or map (the pulse width or a count value corresponding to the pulse width or the corresponding value) from the estimated value of the current pulse width (or a count value obtained by dividing the estimated value by the arithmetic processing cycle). A new chattering exclusion time is determined using an arithmetic expression or map representing a relationship between the chattering exclusion time.

なお、この場合の上記演算式又はマップは、回転体4の回転速度が一定に維持されている状況で、パルス信号のレベル値が高レベルとなる期間のパルス幅と、低レベルとなる期間のパルス幅とが異なるものとなる場合には、パルス幅が低レベルのパルス幅であるか、高レベルのパルス幅であるかに応じて各別に設定される。あるいは、例えば、パルス幅が低レベルのパルス幅である場合と、高レベルのパルス幅である場合とのいずれか一方の場合に対応する演算式又はマップだけを設定しておき、推定したパルス幅が他方のレベル値のパルス幅である場合には、そのパルス幅の推定値を一方のレベル値のパルス幅相当のパルス幅に換算したものから、上記演算式又はマップを用いて新たなチャタリング排除時間を決定するようにすることも可能である。   In this case, the above calculation formula or map shows the pulse width during the period when the level value of the pulse signal is high and the period when the level is low, in a situation where the rotation speed of the rotating body 4 is kept constant. When the pulse width is different, the pulse width is set separately depending on whether the pulse width is a low level pulse width or a high level pulse width. Alternatively, for example, an estimated pulse width is set by setting only an arithmetic expression or a map corresponding to either the case where the pulse width is a low level pulse width or the case where the pulse width is a high level pulse width. Is the pulse width of the other level value, the estimated value of the pulse width is converted into a pulse width equivalent to the pulse width of one level value, and new chattering is eliminated using the above equation or map. It is also possible to determine the time.

以上のように、チャタリング排除時間を決定することにより、今回のパルス幅の推定値(最新の推定値)により示される回転体4の回転速度が速いほど、それに反比例して、チャタリング排除時間を短くするように該チャタリング排除時間が設定されることとなる。   As described above, by determining the chattering elimination time, the chattering elimination time is shortened in inverse proportion to the higher rotational speed of the rotating body 4 indicated by the current pulse width estimation value (latest estimation value). Thus, the chattering exclusion time is set.

例えば図7の上段で示すような波形の実際のパルス信号がCPU20に入力された場合を想定する。なお、ここでは、理解の便宜上、実際のパルス信号には、除外対象切替わりは含まれていないものとしている。   For example, it is assumed that an actual pulse signal having a waveform as shown in the upper part of FIG. Here, for convenience of understanding, it is assumed that the actual pulse signal does not include the exclusion target switching.

なお、図示の例では、時刻t42から時刻t46までの期間で回転体4の回転速度が増加しているものとする。また、この例では、理解の便宜上、回転体4の回転速度が一定である場合のパルス幅は、レベル値が高レベルである場合と低レベルである場合とで同じであるとしている。   In the illustrated example, it is assumed that the rotational speed of the rotating body 4 increases during the period from time t42 to time t46. Further, in this example, for convenience of understanding, it is assumed that the pulse width when the rotational speed of the rotating body 4 is constant is the same when the level value is high and when it is low.

この場合、時刻t40からt42までの期間での実際のパルス信号のパルス幅Wd0と、時刻t42からt44までの期間での実際のパルス信号のパルス幅Wd1(<Wd0)と、時刻t44からt46までの期間での実際のパルス信号のパルス幅Wd2(<Wd1)とが、それぞれ、時刻t43の演算処理周期、時刻t45の演算処理周期、時刻t47の演算処理周期において推定される。このとき、それぞれのパルス幅Wd0,Wd1,Wd2の推定値により示される回転体4の回転速度が、図7の下段で示すように、ω0,ω1,ω2(ω0<ω1<ω2)となる。   In this case, the pulse width Wd0 of the actual pulse signal in the period from time t40 to t42, the pulse width Wd1 (<Wd0) of the actual pulse signal in the period from time t42 to t44, and from time t44 to t46 The pulse width Wd2 (<Wd1) of the actual pulse signal in the period of time is estimated in the calculation processing period at time t43, the calculation processing period at time t45, and the calculation processing period at time t47, respectively. At this time, the rotational speed of the rotating body 4 indicated by the estimated values of the respective pulse widths Wd0, Wd1, and Wd2 is ω0, ω1, and ω2 (ω0 <ω1 <ω2) as shown in the lower part of FIG.

そして、パルス幅Wd0,Wd1,Wd2のそれぞれを推定した時刻t43の演算処理周期、時刻t45の演算処理周期、時刻t47の演算処理周期において、それぞれ、チャタリング排除時間が更新される。   Then, the chattering exclusion time is updated in each of the calculation processing period at time t43, the calculation processing period at time t45, and the calculation processing period at time t47 in which the pulse widths Wd0, Wd1, and Wd2 are estimated.

この場合、時刻t43の演算処理周期での更新後のチャタリング排除時間は、図7に示すチャタリング排除時間Tc0〜Tc4のうちのTc2(時刻t44での検知対象切替わりの検知に使用されるチャタリング排除時間)、時刻t45の演算処理周期での更新後のチャタリング排除時間は、図7のTc3(時刻t46での検知対象切替わりの検知に使用されるチャタリング排除時間)、時刻t47の演算処理周期での更新後のチャタリング排除時間は、図7のTc4(時刻t48での検知対象切替わりの検知に使用されるチャタリング排除時間)となる。   In this case, the chattering exclusion time after the update in the calculation processing cycle at time t43 is Tc2 of the chattering exclusion times Tc0 to Tc4 shown in FIG. 7 (chattering exclusion used for detection of switching of the detection target at time t44). Time), the chattering elimination time after update in the computation processing cycle at time t45 is Tc3 in FIG. 7 (chattering elimination time used for detection of switching of the detection target at time t46), and the computation processing cycle at time t47. The chattering elimination time after updating is Tc4 in FIG. 7 (the chattering elimination time used for detecting the detection target switching at time t48).

そして、この場合、上記チャタリング排除時間Tc2、Tc3、Tc4は、それぞれ、回転速度ω0,ω1,ω2に応じた値に設定され、回転速度ω0,ω1,ω2が速いほど、チャタリング排除時間Tc2、Tc3、Tc4が短くなるように(Tc2>Tc3>Tc4となるように)、それらのチャタリング排除時間Tc2、Tc3、Tc4が決定されることとなる。   In this case, the chattering exclusion times Tc2, Tc3, and Tc4 are set to values corresponding to the rotational speeds ω0, ω1, and ω2, respectively. The faster the rotational speeds ω0, ω1, and ω2, the chattering exclusion times Tc2, Tc3 The chattering elimination times Tc2, Tc3, and Tc4 are determined so that Tc4 becomes shorter (Tc2> Tc3> Tc4).

図3の説明に戻って、次に、STEP8においては、CPU20は、回転体4の回転速度が高速回転であるか否かを判断する。この場合CPU20は、今回のパルス幅の推定値(又はこれを演算処理周期で除算してなるカウント値)が、低レベルのパルス幅と高レベルのパルス幅とで各別にあらかじめ設定された所定の下限値よりも小さい場合、あるいは、該パルス幅の推定値から換算した回転体4の回転速度が、あらかじめ設定された所定の上限値よりも大きい場合に、回転体4の回転速度が高速回転であると判断する。   Returning to the description of FIG. 3, next, in STEP 8, the CPU 20 determines whether or not the rotation speed of the rotating body 4 is high-speed rotation. In this case, the CPU 20 determines that the estimated value of the current pulse width (or a count value obtained by dividing the estimated value by the calculation processing period) is a predetermined value set in advance for each of the low level pulse width and the high level pulse width. When the rotational speed of the rotating body 4 is smaller than the lower limit value or when the rotational speed of the rotating body 4 converted from the estimated value of the pulse width is larger than a predetermined upper limit value set in advance, the rotational speed of the rotating body 4 is high-speed rotation. Judge that there is.

ここで、回転体4の回転速度が非常に速い場合には、検知対象切替わりの発生の時間間隔のパルス幅が微小なものとなるため、そのパルス幅のパルスと、チャタリング現象や瞬時的なノイズに起因するパルスとを高い信頼性で区別しつつ、検知対象切替わりの発生の時間間隔のパルス幅を推定することが困難となる。   Here, when the rotational speed of the rotating body 4 is very high, the pulse width of the time interval of occurrence of switching of the detection target becomes very small. Therefore, the pulse width and chattering phenomenon or instantaneous It is difficult to estimate the pulse width of the time interval of occurrence of switching of the detection target while distinguishing the pulse due to noise with high reliability.

このため、本実施形態では、STEP8の判断結果が肯定的となる場合には、回転体4の回転状態(回転速度や回転方向)の最終的な把握を省略し、今回の演算処理周期の処理を終了する。なお、この場合には、今回の演算処理周期でSTEP2において認識されたパルス信号の整形波形に基づく、回転体4の回転状態の最終的な把握は禁止される。そして、回転体4の現在の回転状態は、例えば前回の演算処理周期での状態に維持されているものと見なされる。   For this reason, in this embodiment, when the determination result of STEP 8 is affirmative, the final grasp of the rotation state (rotation speed and rotation direction) of the rotating body 4 is omitted, and the processing of the current calculation processing cycle is performed. Exit. In this case, the final grasp of the rotation state of the rotating body 4 based on the shaped waveform of the pulse signal recognized in STEP 2 in the current arithmetic processing cycle is prohibited. The current rotation state of the rotator 4 is considered to be maintained, for example, in the state of the previous calculation processing cycle.

一方、STEP8の判断結果が否定的である場合には、CPU20は、STEP9において、回転体4の回転速度や回転方向等の回転状態を最終的に把握(特定)し、今回の演算処理周期の処理を終了する。なお、この場合、回転方向は、各相のパルス信号の検知対象切替わりが、各相間でどのような順番で発生するか等に基づき特定される。   On the other hand, if the determination result in STEP 8 is negative, the CPU 20 finally grasps (specifies) the rotation state such as the rotation speed and the rotation direction of the rotating body 4 in STEP 9 and determines the current calculation processing cycle. End the process. In this case, the rotation direction is specified based on the order in which the detection target switching of the pulse signal of each phase occurs between the phases.

以上が、本実施形態でCPU20が実行する処理である。   The above is the processing executed by the CPU 20 in the present embodiment.

以上説明した実施形態によれば、回転体4の回転速度が速いほど、チャタリング排除時間を短くするように該チャタリング排除時間を随時、更新しつつ設定するので、パルス信号のレベル値の本来の切替わり(検知対象切替わり)の発生を高い信頼性で検知することができる。ひいては、回転体4の回転状態の把握を高い信頼性で行なうことができる。   According to the embodiment described above, the chattering exclusion time is set while being updated as needed to shorten the chattering exclusion time as the rotational speed of the rotating body 4 increases. The occurrence of a change (detection target switching) can be detected with high reliability. As a result, the rotation state of the rotating body 4 can be grasped with high reliability.

ここで、本実施形態と本発明との対応関係を補足しておく。本実施形態では、STEP1、STEP4、STEP7、STEP10の処理によって、それぞれ、本発明における切替わり検知ステップ、パルス幅推定ステップ、チャタリング排除時間設定ステップ、計時ステップが実現される。また、STEP8の処理によって、回転体の回転速度が高速であるか否かを判断するステップが実現される。   Here, the correspondence between the present embodiment and the present invention will be supplemented. In the present embodiment, the switching detection step, the pulse width estimation step, the chattering exclusion time setting step, and the timing step in the present invention are realized by the processing of STEP1, STEP4, STEP7, and STEP10, respectively. Moreover, the step of determining whether or not the rotational speed of the rotating body is high is realized by the processing of STEP8.

[第2実施形態]
次に、本発明の第2実施形態を図8及び図9を参照して説明する。なお、本実施形態は、CPU20の演算処理の一部だけが、第1実施形態と相違するものである。このため、本実施形態の説明では、第1実施形態と同一の構成については、第1実施形態と同一の参照符号を用い、詳細な説明を省略する。
[Second Embodiment]
Next, a second embodiment of the present invention will be described with reference to FIGS. Note that this embodiment is different from the first embodiment only in a part of the arithmetic processing of the CPU 20. For this reason, in the description of the present embodiment, the same reference numerals as those in the first embodiment are used for the same configurations as those in the first embodiment, and detailed description thereof is omitted.

前記第1実施形態では、回転体4の回転速度が急上昇すると、パルス信号のレベル値の検知対象切替わりが発生する時刻で設定されているチャタリング排除時間が、該時刻の付近での実際の回転体4の回転速度に比して長めの時間になり、検知対象切替わりが除外対象切替わりとして検知から除外されてしまう恐れがある。   In the first embodiment, when the rotational speed of the rotating body 4 rapidly increases, the chattering exclusion time set at the time when the detection target switching of the level value of the pulse signal occurs is the actual rotation around the time. It takes a longer time than the rotational speed of the body 4, and there is a possibility that the detection target switching is excluded from the detection as the exclusion target switching.

例えば図7の時刻t42以後の回転体4の回転速度が、急上昇すると、時刻t42以後のパルス信号のパルス幅(Wd1,Wd2等)が、該パルス幅の始端側の検知対象切替わりの発生時刻で既に設定されているチャタリング時間(Tc1,Tc2等)よりも短くなってしまう場合もある。   For example, when the rotational speed of the rotating body 4 after time t42 in FIG. 7 suddenly increases, the pulse width (Wd1, Wd2, etc.) of the pulse signal after time t42 is the generation time of detection object switching on the start end side of the pulse width. In some cases, the chattering time (Tc1, Tc2, etc.) already set becomes shorter.

そこで、本実施形態では、パルス信号のレベル値の検知対象切替わりの発生を検知する毎に、既に過去に推定したパルス幅のうちの直近側の複数のパルス幅の推定値、例えば最新のパルス幅の推定値と、その1つ前のパルス幅の推定値との2つの推定値を用いて、将来の(次の検知対象切替わりが発生する時刻近辺での)回転体4の回転速度を予測し、その予測値に応じてチャタリング排除時間を更新・設定する。   Therefore, in the present embodiment, every time the occurrence of switching of the detection target of the level value of the pulse signal is detected, an estimated value of a plurality of nearest pulse widths among the pulse widths already estimated in the past, for example, the latest pulse Using the two estimated values of the estimated width and the previous estimated pulse width, the rotational speed of the rotating body 4 in the future (near the time when the next detection target switching occurs) is calculated. Predict and update / set chattering exclusion time according to the predicted value.

このようにチャタリング排除時間を更新・設定するために、本実施形態では、CPU20は、第1実施形態で説明した図3のフローチャートに示した演算処理の代わりに、図8のフローチャートに示す演算処理を所定の演算処理周期で逐次実行する。   In order to update / set the chattering exclusion time in this way, in this embodiment, the CPU 20 performs the arithmetic processing shown in the flowchart of FIG. 8 instead of the arithmetic processing shown in the flowchart of FIG. 3 described in the first embodiment. Are sequentially executed in a predetermined calculation processing cycle.

以下説明すると、CPU20は、図3のSTEP1〜3の各処理と同じ処理(切替わり検知処理等)を、それぞれ、STEP21,22,23で実行する。そして、STEP23の判断結果が否定的である場合には、CPU20は、図3のSTEP10と同じ処理をSTEP32で実行し、今回の演算処理周期の演算処理を終了する。   Explained below, the CPU 20 executes the same processing (switching detection processing etc.) as the processing of STEP 1 to STEP 3 of FIG. If the determination result in STEP 23 is negative, the CPU 20 executes the same processing as STEP 10 in STEP 3 in STEP 32 and ends the arithmetic processing in the current arithmetic processing cycle.

一方、本実施形態では、STEP23の判断結果が肯定的である場合には、CPU20は、パルス幅の前回の推定値をバックアップメモリ(図示省略)に記憶保持する(バックアップする)ことをSTEP24で実行する。ここで、「パルス幅の前回の推定値」というのは、前回の検知対象切替わり(今回の検知対象切替わりの1つ前の検知対象切替わり)の発生が検知された時刻での演算処理周期におけるSTEP25の処理によって推定したパルス幅である。   On the other hand, in the present embodiment, when the determination result in STEP 23 is affirmative, the CPU 20 stores and holds (backs up) the previous estimated value of the pulse width in the backup memory (not shown) in STEP 24. To do. Here, the “previously estimated value of the pulse width” is a calculation process at the time when the occurrence of the previous detection target switching (the detection target switching immediately before the current detection target switching) is detected. It is the pulse width estimated by the processing of STEP25 in the cycle.

次いで、本実施形態では、CPU20は、図3のSTEP4と同じ処理をSTEP25で実行し、今回の演算処理周期で検知した検知対象切替わりの直前におけるパルス信号のパルス幅を推定する。さらに、CPU20は、図3のSTEP5と同じ処理をSTEP26で実行することで、幅カウンタのカウント値をリセットした後、STEP27の処理を実行し、回転体4の将来の回転速度を予測する。   Next, in the present embodiment, the CPU 20 executes the same process as STEP 4 in FIG. 3 in STEP 25, and estimates the pulse width of the pulse signal immediately before the detection target switching detected in the current arithmetic processing cycle. Further, the CPU 20 executes the same processing as STEP 5 of FIG. 3 in STEP 26 to reset the count value of the width counter, and then executes the processing of STEP 27 to predict the future rotational speed of the rotating body 4.

この予測は、次のように行なわれる。すなわち、CPU20は、STEP24でバックアップしたパルス幅の前回の推定値(又はこれを演算処理周期で除算してなるカウント値)と、STEP25で推定したパルス幅の今回の推定値(又はこれを演算処理周期で除算してなるカウント値)とを、それぞれ、回転体4の回転速度に換算する。この換算は、第1実施形態におけるSTEP6の処理に関して説明した場合と同様に、所定の演算式又はマップを用いて行なわれる。   This prediction is performed as follows. In other words, the CPU 20 calculates the previous estimated value of the pulse width backed up in STEP 24 (or a count value obtained by dividing the pulse width by the calculation processing period) and the current estimated value of the pulse width estimated in STEP 25 (or calculates this). The count value obtained by dividing by the period) is converted into the rotation speed of the rotating body 4, respectively. This conversion is performed using a predetermined arithmetic expression or map, as in the case described with respect to the processing of STEP 6 in the first embodiment.

そして、CPU20は、前回のパルス幅の推定値から換算した回転速度(以降、これをωaとおく)と、今回のパルス幅の推定値から換算した回転速度(以降、これをωbとおく)とから、線形補間の手法によって、次回の検知対象切替わりが検知される時刻近辺の回転体4の将来の回転速度(以降、これをωcとおく)を予測する。   Then, the CPU 20 converts the rotational speed converted from the previous estimated value of the pulse width (hereinafter referred to as ωa) and the rotational speed converted from the estimated value of the current pulse width (hereinafter referred to as ωb). Therefore, the future rotational speed of the rotator 4 near the time when the next detection target switching is detected is predicted by a linear interpolation method (hereinafter, this will be referred to as ωc).

具体的には、次式(2)により、将来の回転速度ωcの予測値を算出する。   Specifically, a predicted value of the future rotational speed ωc is calculated by the following equation (2).


ωc=ωb+(ωb−ωa)×α ……(2)

この式(2)におけるαは、回転体4の加速度を加味する割合いとしてあらかじめ設定した係数である。

ωc = ωb + (ωb−ωa) × α (2)

Α in the equation (2) is a coefficient set in advance as a ratio that takes into account the acceleration of the rotating body 4.

このように算出される回転速度ωcの予測値は、回転体4の回転速度が増速している状況(ωb>ωa)では、今回のパルス幅の推定値が示す回転速度ωbよりも速い回転速度となり、回転体4の回転速度が減速している状況(ωb<ωa)では、今回のパルス幅の推定値が示す回転速度ωbよりも遅い回転速度となる。また、回転体4の回転速度が一定に維持されている状況(ωb=ωa)では、回転速度ωcの予測値は、当該一定の回転速度(=ωb=ωa)となる。   The predicted value of the rotational speed ωc calculated in this way is faster than the rotational speed ωb indicated by the estimated value of the current pulse width in a situation where the rotational speed of the rotating body 4 is increasing (ωb> ωa). In a situation where the rotational speed of the rotating body 4 is decelerating (ωb <ωa), the rotational speed is slower than the rotational speed ωb indicated by the estimated value of the current pulse width. In a situation where the rotational speed of the rotating body 4 is kept constant (ωb = ωa), the predicted value of the rotational speed ωc is the constant rotational speed (= ωb = ωa).

上記の如く将来の回転速度ωcを予測した後、次に、CPU20は、現在時刻以後に予測される回転体4の回転速度が変化するか否かをSTEP28で判断する。   After predicting the future rotational speed ωc as described above, the CPU 20 next determines in STEP 28 whether or not the rotational speed of the rotating body 4 predicted after the current time changes.

具体的には、CPU20は、STEP27で算出した将来の回転速度ωcの予測値と、今回のパルス幅の推定値から換算した回転体4の回転速度ωbとを比較する。そして、CPU20は、前者の回転速度が後者の回転速度と異なる場合には、STEP28の判断結果が肯定的であるとし、両者が同一である場合には、STEP28の判断結果が否定的であるとする。なお、両者の回転速度が同一であるか否かは、両者の回転速度の差の絶対値が、あらかじめ定めた“0”近傍の所定値(>0)よりも小さいか否かによって判断するようにしてもよい。   Specifically, the CPU 20 compares the predicted value of the future rotational speed ωc calculated in STEP 27 with the rotational speed ωb of the rotating body 4 converted from the estimated value of the current pulse width. If the former rotational speed is different from the latter rotational speed, the CPU 20 determines that the determination result of STEP 28 is positive, and if both are the same, the determination result of STEP 28 is negative. To do. Whether or not the rotational speeds of the two are the same is determined by whether or not the absolute value of the difference between the rotational speeds of the two is smaller than a predetermined value (> 0) in the vicinity of “0” determined in advance. It may be.

補足すると、回転体4の回転速度が一定に維持されている状況で、いずれかの相のパルス信号のレベル値が高レベルとなる期間のパルス幅と、低レベルとなる期間のパルス幅とが同じになるようにロータリエンコーダ1が構成されているような場合には、その相のパルス信号についてのSTEP27の処理で、前記式(2)の右辺のωb,ωaをそれぞれ、今回のパルス幅の推定値と前回のパルス幅の推定値とに置き換えた式(又は今回のパルス幅の推定値と前回のパルス幅の推定値とのそれぞれを演算処理周期で除算してなるカウント値に置き換えた式)によって、将来のパルス幅(又はこれを演算処理周期で除算してなるカウント値)を予測してもよい。   Supplementally, in a situation where the rotational speed of the rotating body 4 is kept constant, the pulse width of the period in which the level value of the pulse signal of any phase is high and the pulse width of the period in which the level is low are When the rotary encoder 1 is configured to be the same, the right side ωb and ωa of the above equation (2) are set to the current pulse width in the processing of STEP 27 for the pulse signal of the phase. Formula replaced with estimated value and estimated value of previous pulse width (or replaced with count value obtained by dividing each of estimated value of current pulse width and estimated value of previous pulse width by calculation processing cycle ) May be used to predict a future pulse width (or a count value obtained by dividing the pulse width by an arithmetic processing cycle).

さらに、STEP28の判断処理は、図3のSTEP6の処理に関して説明した場合と同様の仕方で、将来の回転速度の予測値に対応するパルス幅(又はこれを演算処理周期で除算したカウント値)と、今回のパルス幅の推定値(又はこれを演算処理周期で除算したカウント値)との比較によって行なうようにしてもよい。   Further, the determination process in STEP 28 is performed in the same manner as described in connection with the process in STEP 6 in FIG. 3, and the pulse width corresponding to the predicted value of the future rotation speed (or the count value obtained by dividing this by the calculation processing period) Alternatively, this may be performed by comparison with an estimated value of the current pulse width (or a count value obtained by dividing this by the calculation processing period).

上記STEP28の判断結果が肯定的である場合には、CPU20は、チャタリング排除時間の設定値を更新する処理をSTEP29で実行した後に、STEP30の処理を実行する。また、STEP28の判断結果が否定的である場合には、CPU20は、チャタリング排除時間の設定値を更新することなく(現状に維持したまま)、STEP30の処理を実行する。なお、本実施形態では、STEP29の処理(チャタリング排除時間の設定値の更新処理)をSTEP28の判断結果が肯定的である場合にだけ行なうが、STEP28の判断処理を省略し(回転体4の回転速度の変化の発生の有無によらずに)、STEP29の処理を実行するようにしてもよい。   If the determination result in STEP 28 is affirmative, the CPU 20 executes the process of STEP 30 after executing the process of updating the chattering exclusion time setting value in STEP 29. On the other hand, if the determination result in STEP 28 is negative, the CPU 20 executes the process in STEP 30 without updating the set value for the chattering exclusion time (while maintaining the current value). In this embodiment, the process of STEP 29 (the process of updating the set value for chattering exclusion time) is performed only when the determination result of STEP 28 is positive, but the determination process of STEP 28 is omitted (the rotation of the rotating body 4). The process of STEP 29 may be executed regardless of whether or not a change in speed occurs.

STEP29でチャタリング排除時間の設定値を更新する処理は、次のように行なわれる。   The processing for updating the set value of chattering exclusion time in STEP 29 is performed as follows.

すなわち、CPU20は、STEP27で求めた回転体4の将来の回転速度ωcの予測値が速いほど、チャタリング排除時間を短くするように該チャタリング排除時間を設定する。   That is, the CPU 20 sets the chattering exclusion time so that the chattering exclusion time becomes shorter as the predicted value of the future rotational speed ωc of the rotating body 4 obtained in STEP 27 is faster.

より具体的には、CPU20は、将来の回転速度ωcの予測値から、あらかじめ設定された所定の演算式又はマップ(回転速度とチャタリング排除時間との間の関係を表す演算式又はマップ)を用いて新たなチャタリング排除時間を決定する。この場合に使用する演算式又はマップは、図3のSTEP7で使用するものと同じでよい。   More specifically, the CPU 20 uses a predetermined arithmetic expression or map (an arithmetic expression or map representing a relationship between the rotational speed and the chattering exclusion time) set in advance from the predicted value of the future rotational speed ωc. To determine a new chattering exclusion time. The arithmetic expression or map used in this case may be the same as that used in STEP 7 of FIG.

なお、STEP27では、図3のSTEP7の処理に関して説明した場合と同様の仕方で、将来の回転速度ωcの予測値に相当するパルス幅(低レベル又は高レベルのパルス幅)の予測値、又は、これを演算処理周期で除算してなるカウン値の予測値から、あらかじめ設定された所定の演算式又はマップ(パルス幅又はカウント値と、チャタリング排除時間との関係を表す演算式又はマップ)を用いてチャタリング排除時間を決定するようにしてもよい。   Note that in STEP 27, a predicted value of a pulse width (low level or high level pulse width) corresponding to a predicted value of the future rotational speed ωc in the same manner as described in regard to the processing of STEP 7 in FIG. A predetermined arithmetic expression or map (an arithmetic expression or map representing the relationship between the pulse width or count value and the chattering exclusion time) set in advance is used from the predicted value of the count value obtained by dividing this by the arithmetic processing cycle. Thus, the chattering exclusion time may be determined.

以上のように、チャタリング排除時間を決定することにより、今回のパルス幅の推定値(パルス信号のパルス幅の最新の推定値)が示す回転速度ωbと前回のパルス幅の推定値が示す回転速度ωaとから予測される将来の回転速度ωcの予測値が速いほど、それに反比例して、チャタリング排除時間を短くするように該チャタリング排除時間が設定されることとなる。   As described above, by determining the chattering exclusion time, the rotational speed ωb indicated by the estimated value of the current pulse width (the latest estimated value of the pulse width of the pulse signal) and the rotational speed indicated by the estimated value of the previous pulse width As the predicted value of the future rotational speed ωc predicted from ωa is faster, the chattering exclusion time is set so as to shorten the chattering exclusion time in inverse proportion to the predicted value.

例えば図9の上段で示すような波形の実際のパルス信号がCPU20に入力された場合を想定する。なお、ここでは、理解の便宜上、実際のパルス信号には、除外対象切替わりは含まれていないものとしている。   For example, it is assumed that an actual pulse signal having a waveform as shown in the upper part of FIG. Here, for convenience of understanding, it is assumed that the actual pulse signal does not include the exclusion target switching.

なお、図示例では、時刻t52から回転体4の回転速度が増加しているものとする。また、この例では、理解の便宜上、回転体4の回転速度が一定である場合のパルス幅は、レベル値が高レベルである場合と低レベルである場合とで同じであるとしている。   In the illustrated example, it is assumed that the rotational speed of the rotating body 4 has increased from time t52. Further, in this example, for convenience of understanding, it is assumed that the pulse width when the rotational speed of the rotating body 4 is constant is the same when the level value is high and when it is low.

この場合、時刻t50からt52までの期間での実際のパルス信号のパルス幅Wd0と、時刻t52からt54までの期間での実際のパルス信号のパルス幅Wd1(<Wd0)と、時刻t54からt56までの期間での実際のパルス信号のパルス幅Wd2(<Wd1)とが、それぞれ、時刻t53の演算処理周期、時刻t55の演算処理周期、時刻t57の演算処理周期において推定される。このとき、それぞれのパルス幅Wd0,Wd1,Wd2の推定値により示される回転体4の回転速度が、図9の下段で示すように、ω0,ω1,ω2(ω0<ω1<ω2)となる。なお、図9の例では、時刻t50の前の実際のパルス信号のパルス幅は、パルス幅Wd0と同じであるとしている。   In this case, the pulse width Wd0 of the actual pulse signal in the period from time t50 to t52, the pulse width Wd1 (<Wd0) of the actual pulse signal in the period from time t52 to t54, and from time t54 to t56 The pulse width Wd2 (<Wd1) of the actual pulse signal in the period is estimated at the calculation processing period at time t53, the calculation processing period at time t55, and the calculation processing period at time t57, respectively. At this time, the rotational speed of the rotating body 4 indicated by the estimated values of the respective pulse widths Wd0, Wd1, and Wd2 is ω0, ω1, and ω2 (ω0 <ω1 <ω2) as shown in the lower part of FIG. In the example of FIG. 9, the pulse width of the actual pulse signal before time t50 is assumed to be the same as the pulse width Wd0.

そして、パルス幅Wd0,Wd1,Wd2のそれぞれを推定した時刻t53の演算処理周期、時刻t55の演算処理周期、時刻t57の演算処理周期において、回転体4の将来の回転速度の予測値が算出される。   Then, predicted values of the future rotational speed of the rotating body 4 are calculated in the calculation processing cycle at time t53, the calculation processing cycle at time t55, and the calculation processing cycle at time t57 at which the pulse widths Wd0, Wd1, and Wd2 are estimated. The

この場合、時刻t53の演算処理周期では、この演算処理周期で算出したパルス幅Wd0の推定値から換算した回転速度ω0と、1つ前のパルス幅の推定値(=Wd0)から換算した回転速度(=ω0)とをそれぞれ、前記式(2)右辺のωb、ωaに代入してなる演算式によって、図9の中段に示す将来の回転速度ωcの予測値ωc0が算出される。この予測値ωc0は、図9の例ではω0に一致する。そして、この予測値ωc0に応じて、図9に示すチャタリング排除時間Tc0〜Tc4のうちのTc2が設定される。   In this case, in the calculation processing cycle at time t53, the rotation speed ω0 converted from the estimated value of the pulse width Wd0 calculated in this calculation processing cycle and the rotation speed converted from the estimated value of the previous pulse width (= Wd0). A predicted value ωc0 of the future rotational speed ωc shown in the middle part of FIG. 9 is calculated by an arithmetic expression formed by substituting (= ω0) into ωb and ωa on the right side of the equation (2). This predicted value ωc0 matches ω0 in the example of FIG. Then, Tc2 of the chattering exclusion times Tc0 to Tc4 shown in FIG. 9 is set according to the predicted value ωc0.

また、時刻t55の演算処理周期では、この演算処理周期で算出したパルス幅Wd1の推定値から換算した回転速度ω1と、1つ前のパルス幅Wd0の推定値から換算した回転速度ω1とをそれぞれ、前記式(2)右辺のωb、ωaに代入してなる演算式によって、将来の回転速度ωcの予測値ωc1が算出される。この予測値ωc1は、図9の例ではωc1>ω1となる。そして、この予測値ωc1に応じて、図9に示すチャタリング排除時間Tc3が設定される。   In the calculation processing cycle at time t55, the rotation speed ω1 converted from the estimated value of the pulse width Wd1 calculated in the calculation processing cycle and the rotation speed ω1 converted from the estimated value of the previous pulse width Wd0 are respectively set. The predicted value ωc1 of the future rotational speed ωc is calculated by an arithmetic expression formed by substituting ωb and ωa on the right side of the equation (2). The predicted value ωc1 is ωc1> ω1 in the example of FIG. Then, the chattering exclusion time Tc3 shown in FIG. 9 is set according to the predicted value ωc1.

また、時刻t57の演算処理周期では、この演算処理周期で算出したパルス幅Wd2の推定値から換算した回転速度ω2と、1つ前のパルス幅Wd1の推定値から換算した回転速度ω2とをそれぞれ、前記式(2)右辺のωb、ωaに代入してなる演算式によって、将来の回転速度ωcの予測値ωc2が算出される。この予測値ωc2は、図9の例ではωc2>ω2となる。そして、この予測値ωc2に応じて、図9に示すチャタリング排除時間Tc4が設定される。   Further, in the calculation processing cycle at time t57, the rotation speed ω2 converted from the estimated value of the pulse width Wd2 calculated in the calculation processing cycle and the rotation speed ω2 converted from the estimated value of the previous pulse width Wd1 are respectively set. The predicted value ωc2 of the future rotational speed ωc is calculated by an arithmetic expression formed by substituting ωb and ωa on the right side of the equation (2). The predicted value ωc2 is ωc2> ω2 in the example of FIG. Then, the chattering exclusion time Tc4 shown in FIG. 9 is set according to the predicted value ωc2.

そして、この場合、上記の如く設定されるチャタリング排除時間Tc2、Tc3、Tc4は、それぞれ、回転速度の予測値ωc0,ωc1,ωc2が速いほど、チャタリング排除時間Tc2、Tc3、Tc4が短くなるように(Tc2>Tc3>Tc4となるように)決定されることとなる。   In this case, the chattering exclusion times Tc2, Tc3, and Tc4 set as described above are such that the chattering exclusion times Tc2, Tc3, and Tc4 are shorter as the predicted rotational speed values ωc0, ωc1, and ωc2 are faster. (Tc2> Tc3> Tc4).

図8の説明に戻って、次に、STEP30においては、CPU20は、図3のSTEP8と同じ判断処理を実行し、回転体4の回転速度が高速回転であるか否かを判断する。そして、STEP30の判断結果が肯定的となる場合には、回転体4の回転状態(回転速度や回転方向)の最終的な把握を省略し、今回の演算処理周期の処理を終了する。   Returning to the description of FIG. 8, next, in STEP 30, the CPU 20 executes the same determination process as in STEP 8 of FIG. 3, and determines whether or not the rotational speed of the rotating body 4 is high speed rotation. If the determination result in STEP 30 is affirmative, the final grasp of the rotation state (rotation speed and rotation direction) of the rotating body 4 is omitted, and the processing of the current calculation processing cycle is terminated.

一方、STEP30の判断結果が否定的である場合には、CPU20は、図3のSTEP9と同じ処理をSTEP31で実行し、今回の演算処理周期の処理を終了する。   On the other hand, if the determination result in STEP 30 is negative, the CPU 20 executes the same processing as STEP 9 in FIG. 3 in STEP 31 and ends the processing in the current arithmetic processing cycle.

以上が、本実施形態でCPU20が実行する処理である。   The above is the processing executed by the CPU 20 in the present embodiment.

以上説明した実施形態によれば、実際のパルス信号のレベル値の検知対象切替わりを検知する毎に、将来の回転体4の回転速度を予測し、その予測値が速いほど、チャタリング排除時間を短くするように該チャタリング排除時間を随時、更新しつつ設定するので、回転体4の回転速度が急減に上昇するような場合であっても、パルス信号のレベル値の本来の切替わり(検知対象切替わり)が、除外対象切替わりとして検知されなくなるようなことを極力防止することができる。このため、パルス信号のレベル値の本来の切替わりの発生をより一層高い信頼性で検知することができる。ひいては、回転体4の回転状態の把握をより一層高い信頼性で行なうことができる。   According to the embodiment described above, every time the detection target switching of the level value of the actual pulse signal is detected, the future rotational speed of the rotating body 4 is predicted, and the faster the predicted value, the more the chattering exclusion time. Since the chattering exclusion time is set while being updated as needed so as to shorten it, even if the rotational speed of the rotating body 4 increases rapidly, the original switching of the level value of the pulse signal (detection target) It is possible to prevent the switching) from being detected as the exclusion target switching. For this reason, the occurrence of the original switching of the level value of the pulse signal can be detected with higher reliability. As a result, the rotation state of the rotating body 4 can be grasped with higher reliability.

ここで、本実施形態と本発明との対応関係を補足しておく。本実施形態では、STEP21、STEP25、STEP29、STEP32の処理によって、それぞれ、本発明における切替わり検知ステップ、パルス幅推定ステップ、チャタリング排除時間設定ステップ、計時ステップが実現される。また、STEP30の処理によって、回転体の回転速度が高速であるか否かを判断するステップが実現される。また、パルス幅に対応するカウント値が、本発明におけるパラメータ値に相当する。   Here, the correspondence between the present embodiment and the present invention will be supplemented. In the present embodiment, the switching detection step, the pulse width estimation step, the chattering exclusion time setting step, and the time measurement step in the present invention are realized by the processing of STEP 21, STEP 25, STEP 29, and STEP 32, respectively. Further, the step 30 determines whether or not the rotational speed of the rotating body is high. The count value corresponding to the pulse width corresponds to the parameter value in the present invention.

なお、本実施形態では、パルス幅の推定値のうちの最新値により示される回転体4の回転速度ωbと、その1つ前のパルス幅の推定値により示される回転体4の回転速度ωaとから将来の回転速度ωcを予測するようにしたが、直近側の3つ以上のパルス幅の推定値を基に、将来の回転速度ωc(または、これに対応するパルス幅もしくはカウント値)を予測するようにしてもよい。この場合、将来の回転速度ωc(または、これに対応するパルス幅もしくはカウント値)を、2次関数等、1次関数(線形関数)よりもより高次の関数パターンで予測するようにしてもよい。   In the present embodiment, the rotational speed ωb of the rotating body 4 indicated by the latest value of the estimated pulse width values, and the rotational speed ωa of the rotating body 4 indicated by the estimated value of the previous pulse width, The future rotation speed ωc is predicted from the above, but the future rotation speed ωc (or the corresponding pulse width or count value) is predicted based on the estimated values of three or more pulse widths on the nearest side. You may make it do. In this case, the future rotation speed ωc (or the corresponding pulse width or count value) may be predicted with a higher-order function pattern than a linear function (linear function) such as a quadratic function. Good.

また、前記各実施形態では、ロータリエンコーダ1が3相のパルス信号を生成するロータリエンコーダである場合を例にとって説明したが、本発明におけるロータリエンコーダは、例えば1相または2相のパルス信号を生成するロータリエンコーダであってもよい。   In each of the above embodiments, the case where the rotary encoder 1 is a rotary encoder that generates a three-phase pulse signal has been described as an example. However, the rotary encoder according to the present invention generates, for example, a one-phase or two-phase pulse signal. It may be a rotary encoder.

また、前記各実施形態では、ロータリエンコーダ1が接触式のロータリーエンコーダである場合を例にとって説明したが、光学式のロータリエンコーダであっても、本発明を適用できる。   In each of the above embodiments, the case where the rotary encoder 1 is a contact type rotary encoder has been described as an example. However, the present invention can be applied to an optical rotary encoder.

1…ロータリエンコーダ、STEP1,21…切替わり検知ステップ、STEP4,25…パルス幅推定ステップ、STEP7,29…チャタリング排除時間設定ステップ、STEP10,32…計時ステップ。   DESCRIPTION OF SYMBOLS 1 ... Rotary encoder, STEP1, 21 ... Switching detection step, STEP4, 25 ... Pulse width estimation step, STEP7, 29 ... Chattering exclusion time setting step, STEP10, 32 ... Timing step.

Claims (6)

ロータリエンコーダが回転体の回転に応じて出力するパルス信号のレベル値の切替わりのうち、該切替わり後に事前に設定された所定のチャタリング排除時間の期間内で該レベル値を復帰させる切替わりを伴う切替わりを、チャタリング現象又は瞬時的なノイズに起因する除外対象切替わりとして除外してなる該レベル値の切替わりである検知対象切替わりの発生を検知する切替わり検知処理を実行しつつ、前記回転体の回転状態を把握するために用いる前記パルス信号の波形を認識する信号処理方法であって、
前記ロータリエンコーダが出力したパルス信号を観測しつつ、前記チャタリング排除時間を用いて前記切替わり検知処理を実行する切替わり検知ステップと、
前記検知対象切替わりの発生を検知してから、次の前記検知対象切替わりの発生を検知するまでの経過時間を計時する計時ステップと、
前記検知対象切替わりの発生を検知する毎に、以後の前記切替わり検知処理に使用する前記チャタリング排除時間を可変的に設定するチャタリング排除時間設定ステップと、
前記検知対象切替わりの発生を検知する毎に、今回の検知対象切替わりの発生を検知したときの前記切替わり検知処理で使用した前記チャタリング排除時間の設定値と、前回の検知対象切替わりの発生を検知したときの前記切替わり検知処理で使用した前記チャタリング排除時間の設定値との偏差に応じて、前回の検知対象切替わりの発生を検知してから今回の検知対象切替わりの発生を検知するまでに前記計時ステップで計時した前記経過時間を補正することにより、今回の検知対象切替わりの発生の直前における前記パルス信号のパルス幅を推定するパルス幅推定ステップとを備え、
前記チャタリング排除時間設定ステップでは、前記検知対象切替わりの発生を検知する毎に、前記回転体の回転速度が速いほど、前記チャタリング排除時間を短くするように、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの少なくとも最新値に応じて前記チャタリング排除時間を可変的に設定することを特徴とするロータリエンコーダの信号処理方法。
Of the switching of the level value of the pulse signal output by the rotary encoder in accordance with the rotation of the rotating body, the switching of returning the level value within a predetermined chattering exclusion time period set in advance after the switching. While performing the switching detection process for detecting the occurrence of switching of the detection target that is the switching of the level value, which is excluded as the switching of the exclusion target due to chattering phenomenon or instantaneous noise, A signal processing method for recognizing a waveform of the pulse signal used for grasping a rotation state of the rotating body,
A switching detection step of performing the switching detection process using the chattering exclusion time while observing the pulse signal output from the rotary encoder;
A time measuring step of measuring an elapsed time from detection of the occurrence of the detection target switching to detection of the next detection target switching;
A chattering exclusion time setting step for variably setting the chattering exclusion time used for the subsequent switching detection processing every time the occurrence of the detection target switching is detected;
Each time the occurrence of switching of the detection target is detected, the set value of the chattering exclusion time used in the switching detection process when the occurrence of the current detection target switching is detected, and the previous detection target switching Depending on the deviation from the set value of the chattering exclusion time used in the switching detection process when an occurrence is detected, the occurrence of the current detection target switching is detected after the detection of the previous detection target switching is detected. A pulse width estimating step for estimating the pulse width of the pulse signal immediately before the occurrence of the current detection target switching by correcting the elapsed time measured in the time measuring step until detection,
In the chattering exclusion time setting step, each time the occurrence of switching of the detection target is detected, it is estimated in the pulse width estimation step so as to shorten the chattering exclusion time as the rotational speed of the rotating body increases. A signal processing method for a rotary encoder, characterized in that the chattering exclusion time is variably set according to at least the latest value of estimated pulse widths.
請求項1記載のロータリーエンコーダの信号処理方法において、
前記切替わり検知ステップは、前記ロータリエンコーダが出力したパルス信号の実際のレベル値の切替わりを検知する第1ステップと、該検知後、前記チャタリング排除時間の期間が経過した直後における該パルス信号の実際のレベル値を観測する第2ステップとを備え、第2ステップで観測したレベル値が、第1ステップでの切替わりの検知の直前における前記パルス信号の実際のレベル値と異なるレベル値であるか否かを判断し、該判断結果が肯定的である場合に、前記検知対象切替わりの発生を検知することを特徴とするロータリエンコーダの信号処理方法。
In the signal processing method of the rotary encoder according to claim 1,
The switching detection step includes a first step of detecting switching of an actual level value of a pulse signal output from the rotary encoder, and a pulse signal immediately after the chattering exclusion time period has elapsed after the detection. A second step of observing an actual level value, and the level value observed in the second step is a level value different from the actual level value of the pulse signal immediately before detection of switching in the first step. A signal processing method for a rotary encoder, wherein the occurrence of switching of the detection target is detected when the determination result is affirmative.
請求項1記載のロータリーエンコーダの信号処理方法において、
前記切替わり検知ステップは、前記ロータリエンコーダが出力したパルス信号の実際のレベル値を所定の周期で逐次観測しつつ、前記チャタリング排除時間の期間分の該レベル値の複数の観測値が互いに同一の値であるか否かを判断する処理を逐次実行し、該判断結果が否定的となる状況から肯定的となる状況に変化した場合に、前記検知対象切替わりの発生を検知することを特徴とするロータリエンコーダの信号処理方法。
In the signal processing method of the rotary encoder according to claim 1,
In the switching detection step, the actual level value of the pulse signal output from the rotary encoder is sequentially observed at a predetermined cycle, and a plurality of observed values of the level value for the chattering exclusion time period are the same. The process of sequentially determining whether or not the value is a value is detected, and when the determination result changes from a negative situation to a positive situation, the occurrence of the detection target switching is detected. Signal processing method for a rotary encoder.
請求項1〜3のいずれか1項に記載のロータリエンコーダの信号処理方法において、
前記チャタリング排除時間設定ステップでは、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値により示される前記回転体の回転速度が速いほど、前記チャタリング排除時間を短くするように該最新値に応じて該チャタリング排除時間を設定することを特徴とするロータリエンコーダの信号処理方法。
In the signal processing method of the rotary encoder according to any one of claims 1 to 3,
In the chattering exclusion time setting step, the chattering exclusion time is shortened as the rotational speed of the rotating body indicated by the latest value of the pulse width estimation values estimated in the pulse width estimation step increases. A signal processing method for a rotary encoder, wherein the chattering exclusion time is set according to the latest value.
請求項1〜3のいずれか1項に記載のロータリエンコーダの信号処理方法において、
前記チャタリング排除時間設定ステップでは、前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値とそれ以前の少なくとも1つの過去値とを基に、前記今回の検知対象切替わりの発生の検知以後の前記回転体の将来の回転速度、又は該回転速度に対応する前記パルス信号のパルス幅、又は該回転速度もしくはパルス幅と一定の相関関係を有するパラメータ値を予測し、その予測値が示す前記回転体の回転速度が速いほど、前記チャタリング排除時間を短くするように、該予測値に応じて該チャタリング排除時間を設定することを特徴とするロータリエンコーダの信号処理方法。
In the signal processing method of the rotary encoder according to any one of claims 1 to 3,
In the chattering exclusion time setting step, the occurrence of the current detection object switching is generated based on the latest value of the estimated pulse width values estimated in the pulse width estimation step and at least one past value before that. Predicting the future rotational speed of the rotating body after detection of the above, the pulse width of the pulse signal corresponding to the rotational speed, or the parameter value having a certain correlation with the rotational speed or pulse width, The chattering exclusion time is set according to the predicted value so that the chattering exclusion time is shortened as the rotational speed of the rotating body indicated by is higher.
請求項4又は5記載のロータリエンコダーの信号処理方法において、
前記パルス幅推定ステップで推定されたパルス幅の推定値のうちの最新値により示される前記回転体の回転速度が所定値以上の高速であるか否かを判断するステップをさらに備え、該判断結果が肯定的である場合には、前記切替わり検知ステップで検知した検知対象切替わりを反映させて認識されるパルス信号の波形に基づいて前記回転体の回転状態を把握する処理を禁止することを特徴とするロータリエンコーダの信号処理方法。
In the rotary encoder signal processing method according to claim 4 or 5,
A step of determining whether the rotational speed of the rotating body indicated by the latest value of the estimated values of the pulse width estimated in the pulse width estimating step is a high speed equal to or higher than a predetermined value; Is positive, prohibiting the process of grasping the rotation state of the rotating body based on the waveform of the pulse signal recognized by reflecting the detection target switching detected in the switching detection step. A rotary encoder signal processing method.
JP2010283390A 2010-12-20 2010-12-20 Rotary encoder signal processing method Active JP5580185B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010283390A JP5580185B2 (en) 2010-12-20 2010-12-20 Rotary encoder signal processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010283390A JP5580185B2 (en) 2010-12-20 2010-12-20 Rotary encoder signal processing method

Publications (2)

Publication Number Publication Date
JP2012132722A JP2012132722A (en) 2012-07-12
JP5580185B2 true JP5580185B2 (en) 2014-08-27

Family

ID=46648493

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010283390A Active JP5580185B2 (en) 2010-12-20 2010-12-20 Rotary encoder signal processing method

Country Status (1)

Country Link
JP (1) JP5580185B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7310642B2 (en) * 2020-02-20 2023-07-19 株式会社オートネットワーク技術研究所 In-vehicle ECU, program and information processing method
JP7468901B2 (en) 2020-10-14 2024-04-16 株式会社シグマ How to detect rotation of a rotary encoder

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0272979U (en) * 1988-11-24 1990-06-04
JP2751488B2 (en) * 1989-11-22 1998-05-18 株式会社デンソー Pulse input processing method

Also Published As

Publication number Publication date
JP2012132722A (en) 2012-07-12

Similar Documents

Publication Publication Date Title
EP3823156B1 (en) Motor initial phase and phase sequence detection method and permanent magnet synchronous motor control system
TWI530671B (en) Encoder
JP4957192B2 (en) Rotation angle detection device and rotation angle detection method
JP5580185B2 (en) Rotary encoder signal processing method
CN115931036B (en) Magnetic encoder fault detection method and device, electronic equipment and storage medium
JP7136459B2 (en) meshing clutch
CN105628956A (en) Rotating movement system detection method through orthogonal encoder
JP4818188B2 (en) Frequency change measuring device, frequency change rate measuring device, and power system control protection device
US7460030B2 (en) System and method for encoder failure detection
JP4782434B2 (en) Rotation detection device signal processing device
JP5948023B2 (en) Absolute position detector with abnormality detection function
JP2014007807A (en) Device for computing rotational frequency of dc motor
JP2000329505A (en) Method and apparatus for generating position detection data
JP6577809B2 (en) Motor control device
JPWO2018207680A1 (en) Motor with rotation angle detector, rotation angle detector for motor, and method for detecting rotation angle of motor with commutator
JP2022103046A (en) Signal generating device
CN110275043B (en) Method and device for detecting rotating speed of direct current motor, storage medium and electronic equipment
CN109150026B (en) Phase changing method for brushless motor without position sensor
JP2002131084A (en) Position detector
JP2016148587A (en) Resolver signal processing device
CN112290847B (en) Rotation angle estimation device
JP4631427B2 (en) Fault detector for rotational speed detector
JP2020022285A (en) Speed sensorless motor control device
JP7224309B2 (en) Angle detector
JP6312034B2 (en) Motor drive device and control method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20131210

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140612

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140710

R150 Certificate of patent or registration of utility model

Ref document number: 5580185

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

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