JP2020031374A - PWM signal receiving device - Google Patents
PWM signal receiving device Download PDFInfo
- Publication number
- JP2020031374A JP2020031374A JP2018156855A JP2018156855A JP2020031374A JP 2020031374 A JP2020031374 A JP 2020031374A JP 2018156855 A JP2018156855 A JP 2018156855A JP 2018156855 A JP2018156855 A JP 2018156855A JP 2020031374 A JP2020031374 A JP 2020031374A
- Authority
- JP
- Japan
- Prior art keywords
- time
- edge
- duty ratio
- pwm signal
- pwm
- 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.)
- Pending
Links
Images
Landscapes
- Manipulation Of Pulses (AREA)
- Dc Digital Transmission (AREA)
Abstract
Description
本明細書が開示する技術は、PWM信号受信装置に関する。特に、スパイクノイズを受ける環境下でPWM信号に含まれるデューティ比を取得することができるPWM信号受信装置に関する。 The technology disclosed in this specification relates to a PWM signal receiving device. In particular, the present invention relates to a PWM signal receiving device capable of acquiring a duty ratio included in a PWM signal under an environment where spike noise is received.
計測した物理量をデューティ比で表してPWM信号として送信するセンサが知られている(例えば特許文献1)。一方、通信装置では、通信する信号に重畳したノイズを除去する仕組みを備えている場合がある。例えば、特許文献2は、温度検出システムにおけるノイズ除去の技術が開示されている。その技術では、ノイズが重畳されたアナログの温度情報をAD変換した第1デジタルデータと、ノイズをAD変換した第2デジタルデータを通信する。受信装置は、第1デジタルデータと第2デジタルデータの差を取り、ノイズ成分を除去する。また、特許文献3には、FM放送の通信信号に重畳するパルスノイズを除去する技術が開示されている。
2. Description of the Related Art A sensor that transmits a measured physical quantity as a PWM signal by expressing it as a duty ratio is known (for example, Patent Document 1). On the other hand, a communication device may include a mechanism for removing noise superimposed on a signal to be communicated. For example,
PWM信号の受信装置は、立ち上がりエッジから次の立ち上がりエッジまでの時間を1周期と判断し、最初の立ち上がりエッジから次の立下りエッジまでのオン時間の1周期に対する割合からデューティ比を得る。PWM信号にスパイクノイズが重畳すると、本来の1周期の中にスパイクノイズに起因する立ち上がりエッジと立下りエッジが重畳してしまう。その場合、受信装置は、最初の立ち上がりからスパイクノイズに起因する立ち上がりエッジまでをPWM信号の1周期として誤認識してしまうおそれがある。PWM信号の1周期(PWM信号周期)は既知であるので、2つの立ち上がりエッジの間の時間がPWM信号周期から外れていたら、その信号は除外し、次のPWM信号を待つ、という処理が想定される。しかしながら、それでは、除外した信号に含まれている情報が欠落してしまう。計測した物理量をデューティ比で表して送信するセンサを用いる場合、最新のセンサデータが欠落してしまうのは好ましくない。本明細書は、スパイクノイズの影響を除去し、PWM信号に含まれているデューティ比を取得することができるPWM信号受信装置を提供する。 The receiving device of the PWM signal determines that the time from the rising edge to the next rising edge is one cycle, and obtains the duty ratio from the ratio of the on-time from the first rising edge to the next falling edge to one cycle. When spike noise is superimposed on a PWM signal, a rising edge and a falling edge caused by spike noise are superimposed in one original cycle. In that case, the receiving device may erroneously recognize the period from the first rising to the rising edge caused by the spike noise as one cycle of the PWM signal. Since one cycle of the PWM signal (PWM signal cycle) is known, it is assumed that if the time between two rising edges is out of the PWM signal cycle, the signal is excluded and the process waits for the next PWM signal. Is done. However, in that case, information included in the excluded signal is lost. In the case of using a sensor that transmits a measured physical quantity by expressing it as a duty ratio, it is not preferable that the latest sensor data is lost. The present specification provides a PWM signal receiving apparatus capable of removing the influence of spike noise and acquiring a duty ratio included in a PWM signal.
本明細書が開示するPWM信号受信装置は、エッジ検出部と、計測部と、デューティ比算出部を備えている。エッジ検出部は、受信したPWM信号に含まれている立ち上がりエッジと立下りエッジの一方を区切りエッジとして検出する。PWM信号受信装置は、立ち上がりエッジと立下りエッジの両方を検出するが、説明の便宜上、エッジ検出部を上記の通り定義する。また、通常は立ち上がりエッジから次の立ち上がりエッジまでが1周期を表すが、立下りエッジから次の立下りエッジまでを1周期として表す場合にも対応するように、周期の開始を示すエッジを区切りエッジと称することにする。 The PWM signal receiving device disclosed in this specification includes an edge detection unit, a measurement unit, and a duty ratio calculation unit. The edge detection unit detects one of a rising edge and a falling edge included in the received PWM signal as a separation edge. Although the PWM signal receiving apparatus detects both the rising edge and the falling edge, for convenience of explanation, the edge detecting unit is defined as described above. Normally, the period from the rising edge to the next rising edge represents one cycle, but the edge indicating the start of the cycle is divided so as to correspond to the case where the period from the falling edge to the next falling edge is represented as one cycle. It will be referred to as an edge.
計測部は、区切りエッジから次のエッジ(区切りエッジとは逆のエッジ)までのオン時間を計測する。区切りエッジが立ち上がりエッジの場合、次のエッジは立下りエッジとなる。区切りエッジが立下りエッジの場合、次のエッジは立ち上がりエッジとなる。デューティ比出力部は、次に説明する時間加算処理とデューティ比算出処理を実行する。時間加算処理では、デューティ比出力部は、受信したPWM信号の1番目の区切りエッジから過去に向かってi番目の区切りエッジまでの合計時間が想定されているPWM基準周期のN倍に等しくなるまで変数iをインクリメントする。デューティ比算出処理では、デューティ比出力部は、合計時間がPWM基準周期のN倍に等しくなったら、1番目の区切りエッジとi番目の区切りエッジの間に含まれている合計のオン時間(N周期分の合計オン時間)を算出し、PWM基準周期のN倍に対する合計オン時間の割合をデューティ比として出力する。 The measuring unit measures an on-time from a break edge to a next edge (an edge opposite to the break edge). If the delimiting edge is a rising edge, the next edge is a falling edge. If the break edge is a falling edge, the next edge is a rising edge. The duty ratio output unit executes a time addition process and a duty ratio calculation process described below. In the time addition process, the duty ratio output unit sets the total time from the first delimiting edge of the received PWM signal to the i-th delimiting edge in the past until the total time becomes equal to N times the assumed PWM reference period. Increment the variable i. In the duty ratio calculation process, when the total time becomes equal to N times the PWM reference period, the duty ratio output unit outputs the total on-time (N) included between the first and the i-th division edges. Then, a ratio of the total ON time to N times the PWM reference period is output as a duty ratio.
立ち上がりエッジを区切りエッジとし、N=2の場合を例に上記の処理を説明する。時間加算処理は、スパイクノイズに起因する立ち上がりエッジが含まれていても、1番目の立ち上がりエッジから過去の立ち上がりエッジまでの時間がPWM基準周期の2倍に等しくなるまで、その間の立ち上がりエッジは無視する。スパイクノイズが存在しない場合、1番目の立ち上がりエッジと過去に向かって3番目の立ち上がりエッジの間が2周期のPWM信号を表す。この信号の間にスパイクノイズを受け、1個あるいは複数の立ち上がりエッジが重畳した場合、3番目の立ち上がりエッジまでの時間はPWM基準周期の2倍に満たない。その場合、時間加算処理では、3番目の立ち上がりエッジは無視し、4番目の立ち上がりエッジまでの合計時間を得る。4番目の立ち上がりエッジまでの時間でもPWM基準周期の2倍に満たない場合は、5番目の立ち上がりエッジまでの合計時間を得る。こうして、合計時間がPWM基準周期の2倍に等しくなったら、時間加算処理を終了する。なお、誤差を許容するため、i番目の立ち上がりエッジまでの合計時間がPWM基準周期のN倍を含む許容時間幅に属する場合に、合計時間がPWM基準周期のN倍に等しいと判断してよい。例えば、PWM基準周期のN倍の時間長さに対して誤差10%の許容範囲に合計時間が属する場合、その合計時間はPWM基準周期のN倍に等しいと判定してよい。 The above-described processing will be described by taking a case where N = 2 as an example, with a rising edge as a dividing edge. In the time addition process, even if a rising edge caused by spike noise is included, the rising edge between the first rising edge and the past rising edge is ignored until the time from the first rising edge becomes equal to twice the PWM reference cycle. I do. When there is no spike noise, a period between the first rising edge and the third rising edge in the past represents a PWM signal of two cycles. If one or more rising edges are superimposed upon receiving spike noise during this signal, the time until the third rising edge is less than twice the PWM reference period. In that case, in the time addition processing, the third rising edge is ignored, and the total time until the fourth rising edge is obtained. If the time until the fourth rising edge is less than twice the PWM reference period, the total time until the fifth rising edge is obtained. In this way, when the total time becomes equal to twice the PWM reference cycle, the time addition processing ends. In order to allow an error, when the total time up to the i-th rising edge belongs to an allowable time width including N times the PWM reference cycle, it may be determined that the total time is equal to N times the PWM reference cycle. . For example, when the total time belongs to an allowable range of an error of 10% with respect to a time length N times the PWM reference cycle, the total time may be determined to be equal to N times the PWM reference cycle.
時間加算処理が終了すると、1番目から過去のi番目の立ち上がりエッジの間の信号が2周期分のPWM信号に相当する。そこで、デューティ比算出処理では、1番目から過去のi番目の立ち上がりエッジの間に含まれている合計のオン時間(合計オン時間)を算出する。合計オン時間は、2周期のPWM信号に含まれているオン時間である。デューティ比算出処理では、PWM基準周期の2倍に対する合計オン時間の割合をデューティ比として出力する。こうして、スパイクノイズに起因する立ち上がりエッジを除去し、最新の2周期分のPWM信号に含まれるデューティ比の平均を得ることができる。なお、N=1とすれば、最新のPWM信号のデューティ比を得ることができる。 When the time addition process is completed, a signal between the first to the i-th rising edge in the past corresponds to a PWM signal for two cycles. Therefore, in the duty ratio calculation processing, the total on-time (total on-time) included between the first to the i-th rising edge in the past is calculated. The total on-time is an on-time included in the PWM signal of two cycles. In the duty ratio calculation process, the ratio of the total on-time to twice the PWM reference period is output as the duty ratio. Thus, the rising edge caused by the spike noise is removed, and the average of the duty ratios included in the PWM signals for the latest two periods can be obtained. If N = 1, the latest duty ratio of the PWM signal can be obtained.
本明細書が開示する技術の詳細とさらなる改良は以下の「発明を実施するための形態」にて説明する。 The details and further improvements of the technology disclosed in this specification will be described in the following “Detailed description of the invention”.
図面を参照して実施例のPWM信号受信装置10を説明する。図1に、PWM信号受信装置10を含むシステムのブロック図を示す。実施例のPWM信号受信装置10は、信号線3を介して温度センサ2に接続されている。温度センサ2の温度計測素子は、スイッチング素子などの熱源HSの近傍に配置される。温度センサ2は、熱源HSの温度を計測し、計測した温度をデューティ比で表したPWM信号をPWM信号受信装置10へ送信する。PWM信号受信装置10は、受信したPWM信号からデューティ比を取得し、それを既知のマップデータを使って温度に変換し、上位コンピュータ4に送信する。
A PWM
先に述べたように、温度センサ2の計測対象(熱源HS)は、例えばインバータのスイッチング素子である。スイッチング素子はスイッチングの際にスイッチングノイズを発生する。温度センサ2とPWM信号受信装置10の間の信号線3はスイッチングノイズに晒される。スイッチングノイズはスパイクノイズとなり、信号線3で伝送されるPWM信号に新たな立ち上がりエッジと立下りエッジを重畳することがある。以下では、説明を簡単にするため、立ち上がりエッジを「上エッジ」と称し、立下りエッジを「下エッジ」と称することにする。
As described above, the measurement target (heat source HS) of the
実施例のシステムでは、PWM信号のスタートは上エッジである。即ち、上エッジがPWM信号の周期の区切りを表す。周期の区切りを表す上エッジを以下では区切りエッジと称する場合がある。1周期のPWM信号は、上エッジで始まり、次の上エッジで終わる。連続する2個の上エッジ(区切りエッジ)の間が1周期のPWM信号を表す。即ち、連続する2個の上エッジ(区切りエッジ)の間の時間が1周期の時間に相当する。連続する2個の上エッジ(区切りエッジ)の間には、1個の下エッジが存在する。最初の上エッジから次の下エッジまでの時間をオン時間と称する。最初の上エッジから次の上エッジまでの時間に対するオン時間の割合がデューティ比に相当する。 In the example system, the start of the PWM signal is the upper edge. That is, the upper edge represents the break of the period of the PWM signal. In the following, the upper edge representing a period break may be referred to as a break edge. One cycle of the PWM signal starts at the upper edge and ends at the next upper edge. A period between two consecutive upper edges (separation edges) represents a PWM signal of one cycle. That is, the time between two successive upper edges (separation edges) corresponds to one cycle time. One lower edge exists between two consecutive upper edges (separation edges). The time from the first upper edge to the next lower edge is called on-time. The ratio of the ON time to the time from the first upper edge to the next upper edge corresponds to the duty ratio.
2個の上エッジの間にスパイクノイズに起因する上エッジと下エッジが加わると、最初の上エッジからスパイクノイズに起因する上エッジまでをPWM信号の1周期と誤認識してしまうおそれがある。PWM信号受信装置10は、スパイクノイズに起因する上エッジと下エッジの影響を除去する機能を有している。以下、PWM信号受信装置10について説明する。
If an upper edge and a lower edge caused by spike noise are added between two upper edges, there is a possibility that a part from the first upper edge to an upper edge caused by spike noise is erroneously recognized as one cycle of the PWM signal. . The PWM
PWM信号受信装置10は、エッジ検出部12、時間計測部13、周期学習部14、デューティ比出力部15、換算部16、バッファ17、不揮発性メモリ18を備えている。なお、周期学習部14、デューティ比出力部15、換算部16は、中央演算装置(CPU)が実行するプログラムによって実現される。プログラムは不揮発性メモリ18に記憶されている。エッジ検出部12と時間計測部13は、ハードウエアで実現されている。時間計測部13は、エッジ間の時間を計測する。計測された時間は、バッファ17に一次的に格納される。周期学習部14は、受信したPWM信号に含まれている個々の周期時間の平均を算出する。周期時間の平均を算出する際にもバッファ17が使われる。
The PWM
エッジ検出部12は、受信したPWM信号に含まれている上エッジと下エッジを検出する。時間計測部13は、検出された上エッジから次の下エッジまでの時間(オン時間)を計測するとともに、検出された上エッジから次の上エッジまでの時間(上エッジ間時間)を計測する。計測されたオン時間と上エッジ間時間は、バッファ17に格納される。バッファ17はリングバッファになっており、最新から過去20番目までのオン時間と上エッジ間時間が格納される。リングバッファには、最新のデータがどのバッファに相当するかを示すインデックス変数が付随している。このインデックス変数により、各データ(オン時間と上エッジ間時間)が、最新から過去の何番目に相当するかが判別される。
The
周期学習部14は、PWM信号に含まれている個々の周期時間を取得し、それらの平均をPWM基準周期として出力する。PWM基準周期について補足する。温度センサ2が出力するPWM信号の周期は、設計上は所定の周期に定められている。ただし、温度センサ2の搭載部品の動作精度や、温度センサ自体の温度変化により、出力するPWM信号に含まれている個々の周期は微妙に変化する。実施例のPWM信号受信装置10は、PWM信号に含まれている個々の周期の変化にも対応する。周期学習部14は、例えばPWM信号の最新の10周期分の時間の移動平均をPWM信号の実際の周期(PWM基準周期)として出力する。スパイクノイズに起因する上エッジが存在するなか、どの上エッジを周期の区切りエッジとして抽出するかについては、後に説明する。
The
デューティ比出力部15は、エッジ検出部12が検出した上エッジと、時間計測部13が計測した上エッジ間時間に基づいて、区切りエッジに相当する上エッジを特定し、区切りエッジ間に含まれているオン時間からデューティ比を算出する。デューティ比出力部15は、図2に示すノイズ検出処理と、図3に示すノイズ除去処理を実行する。それらの処理について説明する。
The duty
図2に示すノイズ検出処理は、エッジ検出部12が上エッジ(区切りエッジ)を検出する毎に実行される。以下では、最新の上エッジを第1上エッジと称し、次に新しい上エッジを第2上エッジと称する。一般化して表現すると、最新の上エッジを第1上エッジと称し、第1上エッジから過去に向かって順番に、第i上エッジと称する。
The noise detection processing shown in FIG. 2 is executed each time the
エッジ検出部12は、第1上エッジから第2上エッジまでの時間(最新の上エッジ間時間)が基準周期範囲内であるか否かを判定する(ステップS2)。ここで、基準周期範囲内とは、PWM基準周期に対して誤差10%の範囲内の時間帯を意味する。即ち、ステップS2の処理は、別言すれば、最新の上エッジ間時間が、誤差10%の範囲内でPWM基準周期に一致しているかを判定することになる。最新の上エッジ間時間が基準周期範囲内から外れている場合は(ステップS2:NO)、最新の上エッジ間時間がスパイクノイズに起因する上エッジで区切られていると判断し、次にノイズ除去処理(ステップS10)に移行する。ノイズ除去処理については後述する。
The
最新の上エッジ間時間が基準周期範囲内である場合(ステップS2:YES)、デューティ比出力部15は、次に、第2上エッジから第3上エッジまでの時間(2番目の上エッジ間時間)が基準周期範囲内であるか否かを判定する(ステップS3)。2番目の上エッジ間時間が基準周期範囲内から外れている場合は(ステップS3:NO)、2番目の上エッジ間時間がスパイクノイズに起因する上エッジで区切られていると判断し、次にノイズ除去処理(ステップS10)に移行する。ノイズ除去処理については後述する。
If the latest time between upper edges is within the reference cycle range (step S2: YES), the duty
最新の上エッジ間時間と2番目の上エッジ間時間の両方をモニタする理由は以下の通りである。毎回の実際のPWM信号の周期は誤差を含んでいる。最新の上エッジ間時間をモニタするだけでは、誤差の範囲内で発生したスパイクノイズを除去することができない。最新と2番目の2周期で連続して周期が正常な範囲内であることを確認することで、最新の周期の誤差内に発生したスパイクノイズも検知/除去することが可能となる。 The reason for monitoring both the latest upper inter-edge time and the second upper inter-edge time is as follows. Every period of the actual PWM signal includes an error. By simply monitoring the latest time between upper edges, it is not possible to remove spike noise generated within the range of the error. By confirming that the cycle is within the normal range continuously for the latest two cycles and the second cycle, spike noise generated within the error of the latest cycle can be detected / removed.
最新と2番目の上エッジ間時間が基準周期範囲内である場合(ステップS2とS3がYES)は、最新と2番目の上エッジ間時間がともに本来の区切りエッジで区切られていることを意味する。即ち、2番目の上エッジ間時間までの間にスパイクノイズによるエッジが存在しないことを意味する。この場合、デューティ比出力部15は、第1上エッジと第2上エッジの間のオン時間をバッファ17から取得し、これを合計オン時間とする(ステップS4)。
If the time between the latest and second upper edges is within the reference cycle range (YES in steps S2 and S3), it means that the time between the latest and second upper edges is both separated by the original delimiter edge. I do. That is, it means that no edge due to spike noise exists until the second time between upper edges. In this case, the duty
次にデューティ比出力部15は、合計オン時間をPWM基準周期で除してデューティ比を得る(ステップS5)。第1上エッジと第2上エッジは本来の区切りエッジであるから、それらの間のオン時間が最新のPWM1周期におけるオン時間に相当する。そして、デューティ比出力部15は、算出されたデューティ比を換算部16へ出力する(ステップS6)。デューティ比出力部15は、最後に、周期学習部14へ信号を送り、PWM基準周期を更新させる(ステップS7)。PWM基準周期の更新処理については後述する。
Next, the duty
換算部16には、デューティ比と温度の関係を規定したマップ(あるいは換算式)が予め記憶されている。換算部16は、マップ(あるいは換算式)を使って、受信したデューティ比を温度に変換し、上位コンピュータ4へ出力する。
The
ノイズ除去処理(図3)について説明する。ノイズ除去処理では、第1上エッジ(最新の区切りエッジ)から2周期分のPWM信号の区切りとなる上エッジを検出し、その間のオン時間から最新のデューティ比を算出する。まず、デューティ比出力部15は、プログラム内の変数iに4を代入する(ステップS12)。変数iに4を代入するのは、ノイズ検出処理により、第3上エッジまでの時間がPWM基準周期の2倍に満たないことが明らかだからである。
The noise removal processing (FIG. 3) will be described. In the noise removal processing, an upper edge serving as a delimiter of the PWM signal for two cycles from the first upper edge (latest delimiter edge) is detected, and the latest duty ratio is calculated from the on-time during that period. First, the duty
次にデューティ比出力部15は、第1上エッジから第i上エッジまでの時間が基準2周期範囲内であるか否かを判定する(ステップS13)。ここで、基準2周期範囲内とは、PWM基準周期の2倍の時間に対して誤差10%の範囲内の時間帯を意味する。即ち、ステップS13の処理は、別言すれば、第1上エッジから第i上エッジまでの時間が、誤差10%の範囲内でPWM基準周期の2倍に一致しているかを判定することになる。第1上エッジから第i上エッジまでの時間が基準2周期範囲に満たない場合は(ステップS13:NO)、変数iをインクリメントする(ステップS14)。インクリメントするとは、1を加算する処理のことである。ステップS15については後述する。デューティ比出力部15は、第1上エッジから第i上エッジまでの時間が基準2周期範囲内となるまで、変数iをインクリメントしていく(ステップS14からS15を経てS13に戻る)。ステップS12からS15までの処理を時間加算処理SAと称する。時間加算処理SAは、受信したPWM信号の1番目の区切りエッジから過去のi番目の区切りエッジまでの合計時間がPWM基準周期の2倍に等しくなるまで変数iをインクリメントする処理である。
Next, the duty
時間加算処理SAは、第1上エッジ(最新の区切りエッジ)から2周期分の時間に達するまで、途中の上エッジを無視し、2周期分の時間に対応する上エッジを特定する処理である。途中の上エッジは、スパイクノイズに起因して生じる上エッジである。 The time addition process SA is a process of ignoring an upper edge in the middle until a time corresponding to two cycles from the first upper edge (the latest delimiting edge) reaches a time corresponding to two cycles, and specifying an upper edge corresponding to the time of two cycles. . The upper edge in the middle is an upper edge generated due to spike noise.
時間加算処理SAの繰り返しの間に変数iが所定の上限値に達したら、デューティ比出力部15は、デューティ比検出不能を示す信号を換算部16へ出力する(ステップS15:YES、ステップS16)。変数iが上限値に達した場合、デューティ比出力部15は、それ以上に変数iを増加させても正確なデューティ比は得られないと判断し、ステップS16を実行して処理を終了する。デューティ比検出不能の信号を受けた換算部16は、同じ信号を上位コンピュータ4へ出力する。デューティ比検出不能の信号を受けた上位コンピュータ4は、それに応じた処理を実行する。
When the variable i reaches the predetermined upper limit value during the repetition of the time addition processing SA, the duty
第1上エッジから第i上エッジまでの時間が基準2周期範囲内となったら、デューティ比出力部15は、第1上エッジから第i上エッジの間のオン時間をバッファ17から取得し、その合計を合計オン時間とする(ステップS13:YES、ステップS17)。
When the time from the first upper edge to the i-th upper edge falls within the reference two cycle range, the duty
次にデューティ比出力部15は、合計オン時間をPWM基準周期の2倍の時間で除してデューティ比を求める(ステップS18)。第1上エッジから第i上エッジまでの時間がPWM2周期分に相当するので、その時間内のオン時間の合計は、最新のPWM信号の2周期に含まれるオン時間に相当する。デューティ比出力部15は、算出されたデューティ比を換算部16へ出力する(ステップS19)。デューティ比出力部15は、最後に、周期学習部14へ信号を送り、PWM基準周期を更新させる(ステップS20)。PWM基準周期の更新処理については後述する。
Next, the duty
先に述べたように、換算部16は、マップ(あるいは換算式)を使って、受信したデューティ比を温度に変換し、上位コンピュータ4へ出力する。
As described above, the
ステップS17からS19までの処理をデューティ比算出処理SBと称する。デューティ比算出処理SBは、1番目の区切りエッジとi番目の区切りエッジの間に含まれている合計オン時間を算出し、PWM基準周期の2倍に対する合計オン時間の割合をデューティ比として出力する処理である。 The processing from steps S17 to S19 is referred to as duty ratio calculation processing SB. The duty ratio calculation process SB calculates the total on-time included between the first delimiting edge and the i-th delimiting edge, and outputs a ratio of the total on-time to twice the PWM reference cycle as a duty ratio. Processing.
以上のとおり、ノイズ除去処理(時間加算処理SAとデューティ比算出処理SB)により、スパイクノイズに起因する立ち上がりエッジを除去して本来の区切りエッジを特定し、最新のデューティ比を得ることができる。 As described above, the noise removal processing (time addition processing SA and duty ratio calculation processing SB) removes the rising edge caused by spike noise, specifies the original break edge, and obtains the latest duty ratio.
PWM基準周期の更新処理について説明する。図2のステップS7の処理が実行されるときにはステップS2とS3の判断がYESである。従って、ステップS7の処理が実行されるときには、最新の上エッジ間時間と2番目の上エッジ間時間が本来のPWM周期を示していることが判明している。ステップS7にてPWM基準周期の更新の指示を受けた周期学習部14は、最新の上エッジ間時間と2番目の上エッジ間時間を最新のPWM信号の周期時間としてバッファ17(リングバッファ)に加える。そして、周期学習部14は、バッファ17から最新の10周期分の周期時間を取得し、その平均を新たなPWM基準周期として更新する。
The update process of the PWM reference cycle will be described. When the process of step S7 in FIG. 2 is performed, the determinations in steps S2 and S3 are YES. Therefore, when the process in step S7 is executed, it is known that the latest time between upper edges and the time between second upper edges indicate the original PWM cycle. The
図3のステップS20の処理が実行されるときには、第1上エッジから第i上エッジまで時間が基準2周期範囲内であることがわかっている(ステップS13:YES)。ステップS20にてPWM基準周期の更新の指示を受けた周期学習部14は、第1上エッジから第i上エッジまで時間を2で除した値を最新のPWM信号の周期時間としてバッファ17(リングバッファ)に加える。そして、周期学習部14は、バッファ17から最新の10周期分の周期時間を取得し、その平均を新たなPWM基準周期として更新する。なお、図1では、時間計測部13から周期学習部14へ矢印が描かれている。この矢印は、周期学習部14は、時間計測部13が計測したオン時間と上エッジ間時間を用いてPWM基準周期を更新することを意味している。
When the process of step S20 in FIG. 3 is performed, it is known that the time from the first upper edge to the i-th upper edge is within the range of two reference periods (step S13: YES). Upon receiving the instruction to update the PWM reference cycle in step S20, the
実施例で説明した技術に関する留意点を述べる。図3の処理では、最新のPWM2周期分に相当する区切りエッジを抽出する。図3の処理の「2周期分」は、「N周期分」(Nは自然数)に置き換えても成立する。特にN=1の場合は、最新のPWM周期に対応する上エッジ(区切りエッジ)を特定することができる。一方、Nは3以上であってもよい。 Points to keep in mind regarding the technology described in the embodiment will be described. In the process of FIG. 3, a delimiter edge corresponding to the latest two PWM cycles is extracted. The “two cycles” of the processing in FIG. 3 is satisfied even if it is replaced with “N cycles” (N is a natural number). In particular, when N = 1, it is possible to specify the upper edge (breaking edge) corresponding to the latest PWM cycle. On the other hand, N may be 3 or more.
実施例では、上エッジを区切りエッジとした。本明細書が開示する技術は、下エッジを区切りエッジとするPWM信号にも対応可能である。下エッジを区切りエッジとする場合、区切りエッジ(下エッジ)から次のエッジ(上エッジ)まで、信号の電位レベルが低い期間がオン時間に相当する。 In the embodiment, the upper edge is set as the dividing edge. The technology disclosed in this specification can also deal with a PWM signal having a lower edge as a dividing edge. In the case where the lower edge is used as the dividing edge, a period in which the signal potential level is low from the dividing edge (lower edge) to the next edge (upper edge) corresponds to the on-time.
図2のノイズ検出処理を省略し、エッジ検出部12が区切りエッジを検出する毎に図3のノイズ除去処理を実行するようにしてもよい。その場合、ステップS12において、変数iは2から始めるようにするのがよい。
The noise detection processing of FIG. 2 may be omitted, and the noise removal processing of FIG. 3 may be executed each time the
実施例で示したように、デューティ比出力部15は、第1上エッジから第i上エッジまでの合計時間が、PWM基準周期の2倍(N倍)の時間を含む所定の許容時間幅に属する場合に、合計時間がPWM基準周期の2倍(N倍)に等しいと判定する(ステップS13)。合計時間がPWM基準周期の2倍(N倍)を含む所定の許容時間幅に属するとは、合計時間がPWM基準周期の2倍(N倍)の時間プラスマイナス誤差の範囲内に属するということである。誤差は、予め定められていてよい。
As described in the embodiment, the duty
以上、本発明の具体例を詳細に説明したが、これらは例示に過ぎず、特許請求の範囲を限定するものではない。特許請求の範囲に記載の技術には、以上に例示した具体例を様々に変形、変更したものが含まれる。本明細書または図面に説明した技術要素は、単独であるいは各種の組合せによって技術的有用性を発揮するものであり、出願時請求項記載の組合せに限定されるものではない。また、本明細書または図面に例示した技術は複数目的を同時に達成し得るものであり、そのうちの一つの目的を達成すること自体で技術的有用性を持つものである。 As described above, specific examples of the present invention have been described in detail, but these are merely examples, and do not limit the scope of the claims. The technology described in the claims includes various modifications and alterations of the specific examples illustrated above. The technical elements described in the present specification or the drawings exhibit technical usefulness alone or in various combinations, and are not limited to the combinations described in the claims at the time of filing. In addition, the technology illustrated in the present specification or the drawings can simultaneously achieve a plurality of objects, and has technical utility by achieving one of the objects.
2:温度センサ
3:信号線
4:上位コンピュータ
10:PWM信号受信装置
12:エッジ検出部
13:時間計測部
14:周期学習部
15:デューティ比出力部
16:換算部
17:バッファ
18:不揮発性メモリ
HS:熱源
SA:時間加算処理
SB:デューティ比算出処理
2: Temperature sensor 3: Signal line 4: Host computer 10: PWM signal receiving device 12: Edge detection unit 13: Time measurement unit 14: Period learning unit 15: Duty ratio output unit 16: Conversion unit 17: Buffer 18: Non-volatile Memory HS: Heat source SA: Time addition processing SB: Duty ratio calculation processing
Claims (5)
前記区切りエッジから次のエッジまでのオン時間を計測する時間計測部と、
デューティ比出力部と、
を備えており、
前記デューティ比出力部は、
受信した前記PWM信号の1番目の区切りエッジから過去のi番目の区切りエッジまでの合計時間がPWM基準周期のN倍に等しくなるまで変数iをインクリメントする時間加算処理と、
前記合計時間が前記PWM基準周期のN倍に等しくなったら、前記1番目の区切りエッジと前記i番目の区切りエッジの間に含まれている合計の前記オン時間を算出し、前記PWM基準周期のN倍に対する前記合計の前記オン時間の割合をデューティ比として出力するデューティ比算出処理と、
を実行する、PWM信号受信装置。 An edge detection unit that detects one of a rising edge and a falling edge of the received PWM signal as a separation edge;
A time measurement unit that measures the on-time from the break edge to the next edge,
A duty ratio output section;
With
The duty ratio output unit includes:
Time addition processing for incrementing the variable i until the total time from the first delimiter edge of the received PWM signal to the past i-th delimiter edge becomes equal to N times the PWM reference cycle;
When the total time becomes equal to N times the PWM reference cycle, the total on-time included between the first partition edge and the i-th partition edge is calculated, and the total ON time is calculated based on the PWM reference cycle. A duty ratio calculation process of outputting a ratio of the total on-time to N times as a duty ratio;
, A PWM signal receiving device.
前記1番目の区切りエッジから過去の2番目の区切りエッジまでの時間が前記PWM基準周期を含む所定の1周期時間幅に属するとともに、前記2番目の区切りエッジから過去の3番目の区切りエッジまでの時間が前記1周期時間幅に属する場合は、前記時間加算処理と前記デュ−ティ比算出処理をスキップし、前記1番目の区切りエッジから前記2番目の区切りエッジの間に含まれているオン時間の前記PWM基準周期に対する割合をデューティ比として出力する、請求項1から3のいずれか1項に記載のPWM信号受信装置。 The duty ratio output unit includes:
The time from the first delimiting edge to the past second delimiting edge belongs to a predetermined one cycle time width including the PWM reference cycle, and the time from the second delimiting edge to the past third delimiting edge is set. If the time belongs to the one cycle time width, the time addition processing and the duty ratio calculation processing are skipped, and the ON time included between the first delimiter edge and the second delimiter edge is skipped. The PWM signal receiving device according to any one of claims 1 to 3, wherein a ratio of the PWM signal to the PWM reference cycle is output as a duty ratio.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018156855A JP2020031374A (en) | 2018-08-24 | 2018-08-24 | PWM signal receiving device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2018156855A JP2020031374A (en) | 2018-08-24 | 2018-08-24 | PWM signal receiving device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2020031374A true JP2020031374A (en) | 2020-02-27 |
Family
ID=69622904
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2018156855A Pending JP2020031374A (en) | 2018-08-24 | 2018-08-24 | PWM signal receiving device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2020031374A (en) |
-
2018
- 2018-08-24 JP JP2018156855A patent/JP2020031374A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9397916B2 (en) | Communication device and communication system | |
KR101240798B1 (en) | Apparatus for real time clock frequency offset detection and method thereof | |
CN109976955B (en) | Clock frequency test circuit and measuring and calculating method | |
KR20230008212A (en) | Phase detection method and apparatus and device thereof | |
JP2020031374A (en) | PWM signal receiving device | |
CN112558514B (en) | Multi-device hardware synchronization method | |
CN111046626B (en) | Differential signal line equal length compensation method, device and server | |
EP3370074B1 (en) | Method for detecting background noise of sensor, and device thereof | |
CN103558454B (en) | A kind of Puled input frequency measurement method | |
KR100512965B1 (en) | A apparatus and method for detecting frequency error based on histogram information of input signal | |
JP5077815B2 (en) | Pulse input device | |
CN107615205B (en) | Clock diagnosis device and clock diagnosis method | |
US9746961B2 (en) | Background signal processing system and background signal processing method | |
JP6240892B2 (en) | Motor drive device | |
EP3646673B1 (en) | Voltage detection system and method | |
CN107247819B (en) | Filtering method and filter for sensor | |
CN115603849B (en) | Multi-sensor trigger control method, device, equipment and storage medium | |
JP6605299B2 (en) | measuring device | |
EP3569986A1 (en) | Position sensing device | |
JP6283813B2 (en) | Motor drive device | |
JP5584949B2 (en) | Motor control device and motor control method | |
JP6814660B2 (en) | A system timer and a surveying instrument equipped with the same system timer | |
SU1735877A1 (en) | Device for selecting characters during recognition of images | |
JP5531273B2 (en) | Measuring device using infrared sensor and calibration method | |
JP3223884B2 (en) | Duty ratio determination circuit and duty ratio determination method |