JP2020137043A - Digital filter - Google Patents

Digital filter Download PDF

Info

Publication number
JP2020137043A
JP2020137043A JP2019031484A JP2019031484A JP2020137043A JP 2020137043 A JP2020137043 A JP 2020137043A JP 2019031484 A JP2019031484 A JP 2019031484A JP 2019031484 A JP2019031484 A JP 2019031484A JP 2020137043 A JP2020137043 A JP 2020137043A
Authority
JP
Japan
Prior art keywords
input
level
digital filter
sampling
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.)
Pending
Application number
JP2019031484A
Other languages
Japanese (ja)
Inventor
植木 浩
Hiroshi Ueki
浩 植木
真吾 古田
Shingo Furuta
真吾 古田
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.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2019031484A priority Critical patent/JP2020137043A/en
Publication of JP2020137043A publication Critical patent/JP2020137043A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Manipulation Of Pulses (AREA)

Abstract

To provide a digital filter in which the voltage level of a terminal voltage can be determined accurately even in a situation where noise occurs.SOLUTION: A digital filter 1 includes: a sampling counter 10 which counts the number of sampling of a terminal voltage for each voltage level in the sampling of the terminal voltage of an input terminal P1; a statistical processor 20 which performs statistical processing of the terminal voltage using the number of sampling for each voltage level; and a determination processor 30 which detects an input signal using results of the statistical processing, and outputs an input detection signal when detecting the input signal.SELECTED DRAWING: Figure 1

Description

本発明は、デジタルフィルタに関する。 The present invention relates to a digital filter.

マイコン等の半導体装置では、入力信号にノイズが乗る場合がある。ノイズは誤動作の原因となり得るため、半導体装置には、ノイズをフィルタリングするフィルタ回路が設けられている。例えば、特許文献1には、デジタル処理により入力信号のノイズを除去するデジタルフィルタが開示されている。 In semiconductor devices such as microcomputers, noise may be added to the input signal. Since noise can cause malfunction, the semiconductor device is provided with a filter circuit for filtering noise. For example, Patent Document 1 discloses a digital filter that removes noise in an input signal by digital processing.

特開2011−4072号公報Japanese Unexamined Patent Publication No. 2011-4072

まず、従来のフィルタリング処理について説明する。なお、ここでは、割り込み端子の入力信号を例にしてフィルタリング処理の説明を行う。図13は、従来のフィルタリング処理の一例を説明するタイミング図である。図13には、サンプリングクロック、IRQ(割り込み)端子の端子電圧レベル、及び割り込み検出信号の波形がそれぞれ示されている。 First, the conventional filtering process will be described. Here, the filtering process will be described using the input signal of the interrupt terminal as an example. FIG. 13 is a timing diagram illustrating an example of the conventional filtering process. FIG. 13 shows the sampling clock, the terminal voltage level of the IRQ (interrupt) terminal, and the waveform of the interrupt detection signal, respectively.

サンプリングクロックは、入力端子の端子電圧のサンプリングのタイミングを規定するクロックである。ここでは、デジタルフィルタは、例えばサンプリングクロックの立ち上がり時に、端子電圧の電圧レベルを判定するものとする。図13に示すように、サンプリングクロックは、時刻t0〜t16のそれぞれにおいて、ローレベルからハイレベルに立ち上がっており、このタイミングで端子電圧の電圧レベルが判定される。もちろん、これ以外にもクロックの立ち下りのタイミングで端子電圧の電圧レベルが判定されてもよい。 The sampling clock is a clock that defines the sampling timing of the terminal voltage of the input terminal. Here, it is assumed that the digital filter determines the voltage level of the terminal voltage, for example, at the rising edge of the sampling clock. As shown in FIG. 13, the sampling clock rises from the low level to the high level at each of the times t0 to t16, and the voltage level of the terminal voltage is determined at this timing. Of course, in addition to this, the voltage level of the terminal voltage may be determined at the timing of the falling edge of the clock.

例えば、3回連続で端子電圧の電圧レベルがハイレベルであると判定されると、デジタルフィルタは、端子電圧の真の電圧レベルがハイレベルであり、割り込みが発生したと判定する。そして、デジタルフィルタは、ハイレベルの割り込み検出信号を出力する。図13では、時刻t12〜t14にかけて、3回連続で端子電圧の電圧レベルがハイレベルとなっており、このタイミングで割り込み検出信号が出力される。 For example, if it is determined that the voltage level of the terminal voltage is high level three times in a row, the digital filter determines that the true voltage level of the terminal voltage is high level and an interrupt has occurred. Then, the digital filter outputs a high-level interrupt detection signal. In FIG. 13, the voltage level of the terminal voltage is high three times in a row from time t12 to t14, and the interrupt detection signal is output at this timing.

一方、図14は、従来のフィルタリング処理の他の例を説明するタイミング図である。図14は、図13と類似しているが、端子電圧の電圧レベルが3回連続でローレベルと判定されたとき、割り込みが発生したものと判定される。図14に示すように、時刻t8〜t10にかけて、3回連続で端子電圧の電圧レベルがローレベルとなっており、このタイミングで割り込み検出信号が出力される。 On the other hand, FIG. 14 is a timing diagram for explaining another example of the conventional filtering process. FIG. 14 is similar to FIG. 13, but when the voltage level of the terminal voltage is determined to be low level three times in a row, it is determined that an interrupt has occurred. As shown in FIG. 14, from time t8 to t10, the voltage level of the terminal voltage becomes low level three times in a row, and the interrupt detection signal is output at this timing.

しかし、図13、図14の例では、サンプリング時にたまたまノイズが発生することにより、電圧レベルが3回続けてハイレベル又はローレベルであると判定されれば、割り込みが発生したしたものと判定されてしまう。このように、従来の方式では、ノイズの影響の大きい環境において、本来割り込みが発生していない状況であっても、割り込みが発生したものと判定されるおそれがある。 However, in the examples of FIGS. 13 and 14, if it happens that noise occurs during sampling and the voltage level is determined to be high level or low level three times in a row, it is determined that an interrupt has occurred. It ends up. As described above, in the conventional method, in an environment where the influence of noise is large, it may be determined that an interrupt has occurred even in a situation where an interrupt has not originally occurred.

その他の課題と新規な特徴は、本明細書の記述および添付図面から明らかになるであろう。 Other challenges and novel features will become apparent from the description and accompanying drawings herein.

本明細書には、複数の実施の形態のデジタルフィルタが記載されているが、一実施の形態のデジタルフィルタを述べると、次の通りである。デジタルフィルタは、入力端子の端子電圧のサンプリングにおいて、電圧レベルごとに端子電圧のサンプリング回数をカウントするサンプリングカウンタと、電圧レベルごとの前記サンプリング回数を用いて端子電圧の統計処理を行う統計処理部と、統計処理結果を用いて入力信号の検出を行い、入力信号を検出すると入力検出信号を出力する判定処理部と、を備えている。 Although the digital filters of a plurality of embodiments are described in the present specification, the digital filters of one embodiment are described as follows. The digital filter includes a sampling counter that counts the number of times the terminal voltage is sampled for each voltage level in sampling the terminal voltage of the input terminal, and a statistical processing unit that performs statistical processing of the terminal voltage using the number of times of sampling for each voltage level. It is provided with a determination processing unit that detects an input signal using the statistical processing result and outputs an input detection signal when the input signal is detected.

一実施の形態によれば、ノイズが発生する状況においても端子電圧の電圧レベルを正確に判定することが可能となる。 According to one embodiment, it is possible to accurately determine the voltage level of the terminal voltage even in a situation where noise is generated.

図1は、本発明の実施の形態1に係るデジタルフィルタの一例を示す回路図である。FIG. 1 is a circuit diagram showing an example of a digital filter according to the first embodiment of the present invention. 図2は、本発明の実施の形態1に係る入力信号の検出処理の一例を示すフロー図である。FIG. 2 is a flow chart showing an example of an input signal detection process according to the first embodiment of the present invention. 図3は、ハイレベルの入力信号を検出する際の確率密度分布の変化を例示する図である。FIG. 3 is a diagram illustrating a change in the probability density distribution when detecting a high-level input signal. 図4は、本発明の実施の形態1に係る入力信号の検出処理の一例を示すフロー図である。FIG. 4 is a flow chart showing an example of an input signal detection process according to the first embodiment of the present invention. 図5は、ローレベルの入力信号を検出する際の確率密度分布の変化を例示する図である。FIG. 5 is a diagram illustrating a change in the probability density distribution when detecting a low-level input signal. 図6は、本発明の実施の形態2に係るデジタルフィルタの構成の一例を示す回路図である。FIG. 6 is a circuit diagram showing an example of the configuration of the digital filter according to the second embodiment of the present invention. 図7は、本発明の実施の形態2に係る検知期待値及び検知誤差を自動で設定する方法の一例を示すフロー図である。FIG. 7 is a flow chart showing an example of a method of automatically setting the expected detection value and the detection error according to the second embodiment of the present invention. 図8は、本発明の実施の形態3に係るデジタルフィルタの構成の一例を示す回路図である。FIG. 8 is a circuit diagram showing an example of the configuration of the digital filter according to the third embodiment of the present invention. 図9は、サンプリングクロックの切り換え動作を説明する図である。FIG. 9 is a diagram illustrating a sampling clock switching operation. 図10は、本発明の実施の形態4に係るデジタルフィルタの構成の一例を示す回路図である。FIG. 10 is a circuit diagram showing an example of the configuration of the digital filter according to the fourth embodiment of the present invention. 図11は、本発明の実施の形態4に係る入力信号の検出処理の一例を示すフロー図である。FIG. 11 is a flow chart showing an example of an input signal detection process according to the fourth embodiment of the present invention. 図12は、本発明の実施の形態4に係るローレベルの入力信号の検出処理の一例を示すフロー図である。FIG. 12 is a flow chart showing an example of low-level input signal detection processing according to the fourth embodiment of the present invention. 図13は、従来のフィルタリング処理の一例を説明するタイミング図である。FIG. 13 is a timing diagram illustrating an example of the conventional filtering process. 図14は、従来のフィルタリング処理の他の例を説明するタイミング図である。FIG. 14 is a timing diagram illustrating another example of the conventional filtering process.

以下、本発明の実施の形態を図面に基づいて詳細に説明する。なお、実施の形態を説明するためのすべての図において、同一部分には原則として同一の符号を付し、その繰り返しの説明は省略する。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In addition, in all the figures for demonstrating the embodiment, in principle, the same reference numerals are given to the same parts, and the repeated description thereof will be omitted.

(実施の形態1)
本実施の形態に係るデジタルフィルタは、入力端子の端子電圧のサンプリングを行い、電圧レベルごとにサンプリング回数をカウントし、電圧レベルごとのサンプリング回数を用いて統計処理を行い、統計処理結果を用いて入力信号の検出を行う。図1は、本発明の実施の形態1に係るデジタルフィルタの一例を示す回路図である。図1に示すように、デジタルフィルタ1は、サンプリング回路11、サンプリングカウンタ10、統計処理部20、判定処理部30、判定条件設定レジスタ40等を備えている。
(Embodiment 1)
The digital filter according to the present embodiment samples the terminal voltage of the input terminal, counts the number of samplings for each voltage level, performs statistical processing using the number of samplings for each voltage level, and uses the statistical processing result. Detects the input signal. FIG. 1 is a circuit diagram showing an example of a digital filter according to the first embodiment of the present invention. As shown in FIG. 1, the digital filter 1 includes a sampling circuit 11, a sampling counter 10, a statistical processing unit 20, a determination processing unit 30, a determination condition setting register 40, and the like.

<サンプリング回路>
サンプリング回路11は、入力端子P1の端子電圧のサンプリングを行う回路である。サンプリング回路11の入力側は、入力端子P1と接続されている。サンプリング回路11の出力側は、後述するサンプリングカウンタ10の第1加算器13aの入力側、インバータ17の入力側と接続されている。
<Sampling circuit>
The sampling circuit 11 is a circuit that samples the terminal voltage of the input terminal P1. The input side of the sampling circuit 11 is connected to the input terminal P1. The output side of the sampling circuit 11 is connected to the input side of the first adder 13a of the sampling counter 10 and the input side of the inverter 17, which will be described later.

サンプリング回路11には、外部からサンプリングのタイミングを規定するサンプリングクロックが入力される。サンプリング回路11は、サンプリングクロックに従い、入力端子P1の端子電圧をサンプリングし、端子電圧の電圧レベルに応じたサンプリングデータを出力する。例えば、ハイレベルの端子電圧をサンプリングしたとき、サンプリング回路11は、ハイレベルのサンプリングデータを出力する。また、ローレベルの端子電圧をサンプリングしたとき、サンプリング回路11は、ローレベルのサンプリングデータを出力する。ただし、サンプリングデータの電圧レベルは、これに限定されるものではない。 A sampling clock that defines the sampling timing is input to the sampling circuit 11 from the outside. The sampling circuit 11 samples the terminal voltage of the input terminal P1 according to the sampling clock, and outputs sampling data according to the voltage level of the terminal voltage. For example, when a high level terminal voltage is sampled, the sampling circuit 11 outputs high level sampling data. Further, when the low level terminal voltage is sampled, the sampling circuit 11 outputs the low level sampling data. However, the voltage level of the sampling data is not limited to this.

<サンプリングカウンタ>
サンプリングカウンタ10は、入力端子P1の端子電圧のサンプリングに際し、電圧レベルごとにサンプリング回数をカウントする機能ブロックである。サンプリングカウンタ10は、第1加算器13a、第2加算器13b、第1サンプリング回数レジスタ15a、第2サンプリング回数レジスタ15b、インバータ17を備えている。
<Sampling counter>
The sampling counter 10 is a functional block that counts the number of samplings for each voltage level when sampling the terminal voltage of the input terminal P1. The sampling counter 10 includes a first adder 13a, a second adder 13b, a first sampling number register 15a, a second sampling number register 15b, and an inverter 17.

第1加算器13aの出力側は、第1サンプリング回数レジスタ15aの入力側と接続されている。第1サンプリング回数レジスタ15aの出力側は、第1加算器13aの入力側及び統計処理部20と接続されている。第2加算器13bの出力側は、第2サンプリング回数レジスタ15bの入力側と接続されている。第2サンプリング回数レジスタ15bの出力側は、第2加算器13bの入力側及び統計処理部20と接続されている。第2加算器13bの入力側は、インバータ17の出力側とも接続されている。インバータ17は、論理反転させたサンプリングデータを生成する回路である。 The output side of the first adder 13a is connected to the input side of the first sampling number register 15a. The output side of the first sampling number register 15a is connected to the input side of the first adder 13a and the statistical processing unit 20. The output side of the second adder 13b is connected to the input side of the second sampling count register 15b. The output side of the second sampling count register 15b is connected to the input side of the second adder 13b and the statistical processing unit 20. The input side of the second adder 13b is also connected to the output side of the inverter 17. The inverter 17 is a circuit that generates sampling data with logic inversion.

第1加算器13aは、例えば、サンプリングデータを用いてハイレベルの端子電圧のサンプリング回数(以下、αと表記する場合がある)をカウントする回路であり、第2加算器13bは、論理反転されたサンプリングデータを用いてローレベルの端子電圧のサンプリング回数(以下、βと表記する場合がある)をカウントする回路である。第1サンプリング回数レジスタ15aは、第1加算器13aでカウントされたハイレベルのサンプリング回数(α)を格納する記憶装置であり、第2サンプリング回数レジスタ15bは、第2加算器13bでカウントされたローレベルのサンプリング回数(β)を格納する記憶回路である。 The first adder 13a is, for example, a circuit that counts the number of samplings of a high-level terminal voltage (hereinafter, may be referred to as α) using sampling data, and the second adder 13b is logically inverted. This circuit counts the number of samplings of low-level terminal voltage (hereinafter, may be referred to as β) using the sampling data. The first sampling number register 15a is a storage device that stores the high-level sampling number (α) counted by the first adder 13a, and the second sampling number register 15b is counted by the second adder 13b. It is a storage circuit that stores the number of low-level samplings (β).

<統計処理部>
統計処理部20は、サンプリングカウンタ10でカウントされた、電圧レベルごとのサンプリング回数を用いて端子電圧の統計処理を行う機能ブロックである。図1に示すように、統計処理部20は、μ値演算回路21及びσ値演算回路23を備えている。μ値演算回路21は、所定期間における端子電圧の電圧レベルの期待値(μ値)を算出する回路である。σ値演算回路23は、所定期間における端子電圧の電圧レベルの標準偏差(σ値)を算出する回路である。このように、統計処理部20は、統計処理結果として、端子電圧の電圧レベルの期待値及び標準偏差を算出する。統計処理部20は、例えば統計処理結果として算出した期待値μ及び標準偏差σを用いたベイズ統計により統計処理を行う。また、統計処理部20は、ベイズ統計以外の統計を用いて統計処理を行ってもよい。
<Statistical processing unit>
The statistical processing unit 20 is a functional block that performs statistical processing of the terminal voltage using the number of samplings for each voltage level counted by the sampling counter 10. As shown in FIG. 1, the statistical processing unit 20 includes a μ value calculation circuit 21 and a σ value calculation circuit 23. The μ value calculation circuit 21 is a circuit that calculates an expected value (μ value) of the voltage level of the terminal voltage in a predetermined period. The σ value calculation circuit 23 is a circuit that calculates the standard deviation (σ value) of the voltage level of the terminal voltage in a predetermined period. In this way, the statistical processing unit 20 calculates the expected value and standard deviation of the voltage level of the terminal voltage as the statistical processing result. The statistical processing unit 20 performs statistical processing by, for example, Bayesian statistics using the expected value μ and the standard deviation σ calculated as the statistical processing result. Further, the statistical processing unit 20 may perform statistical processing using statistics other than Bayesian statistics.

μ値演算回路21の入力側は、第1サンプリング回数レジスタ15aの出力側及び第2サンプリング回数レジスタ15bの出力側と接続されている。μ値演算回路21の出力側は、後述する判定処理部30のμ値判定回路31の入力側と接続されている。σ値演算回路23の入力側は、第1サンプリング回数レジスタ15aの出力側及び第2サンプリング回数レジスタ15bの出力側と接続されている。σ値演算回路23の出力側は、判定処理部30のσ値判定回路33の入力側と接続されている。 The input side of the μ value calculation circuit 21 is connected to the output side of the first sampling number register 15a and the output side of the second sampling number register 15b. The output side of the μ value calculation circuit 21 is connected to the input side of the μ value determination circuit 31 of the determination processing unit 30 described later. The input side of the σ value calculation circuit 23 is connected to the output side of the first sampling number register 15a and the output side of the second sampling number register 15b. The output side of the σ value calculation circuit 23 is connected to the input side of the σ value determination circuit 33 of the determination processing unit 30.

<判定条件設定レジスタ>
判定条件設定レジスタ40は、入力信号の検出に関する判定条件を格納する記憶装置である。図1に示すように、判定条件設定レジスタ40は、入力検出レベル設定レジスタ41、第1閾値設定レジスタ43、第2閾値設定レジスタ45を備えている。入力検出レベル設定レジスタ41及び第1閾値設定レジスタ43の出力側は、後述するμ値判定回路31の入力側と接続されている。第2閾値設定レジスタ45の出力側は、後述するσ値判定回路33の入力側と接続されている。
<Judgment condition setting register>
The determination condition setting register 40 is a storage device that stores determination conditions related to detection of an input signal. As shown in FIG. 1, the determination condition setting register 40 includes an input detection level setting register 41, a first threshold value setting register 43, and a second threshold value setting register 45. The output side of the input detection level setting register 41 and the first threshold value setting register 43 is connected to the input side of the μ value determination circuit 31 described later. The output side of the second threshold value setting register 45 is connected to the input side of the σ value determination circuit 33, which will be described later.

入力検出レベル設定レジスタ41は、入力信号の電圧レベルを示す入力検出レベルを格納するレジスタである。図1では、入力検出レベルの設定値は、「a」と表記されている。例えば、a=1に設定されていれば、入力検出レベルはハイレベルであり、a=0に設定されていれば、入力検出レベルはローレベルである。入力検出レベル設定レジスタ41は、設定値をμ値判定回路31へ出力する。 The input detection level setting register 41 is a register that stores an input detection level indicating the voltage level of the input signal. In FIG. 1, the input detection level setting value is indicated by “a”. For example, if a = 1 is set, the input detection level is high, and if a = 0, the input detection level is low. The input detection level setting register 41 outputs the set value to the μ value determination circuit 31.

第1閾値設定レジスタ43は、端子電圧の真の電圧レベルの判定に用いられる第1閾値を格納するレジスタである。第1閾値は、入力信号の検出を行う際に参照される検知期待値である。図1では、第1閾値は、「b」と表記されている。第1閾値bは、例えば、入力検出レベルがハイレベルの場合に対応した値が設定されてもよいし、ローレベルに対応した値が設定されてもよい。また、第1閾値bは、入力検出レベルを切り換える際に、再設定されてもよい。第1閾値設定レジスタ43は、第1閾値をμ値判定回路31へ出力する。 The first threshold value setting register 43 is a register that stores the first threshold value used for determining the true voltage level of the terminal voltage. The first threshold value is an expected detection value that is referred to when detecting an input signal. In FIG. 1, the first threshold value is indicated by "b". For the first threshold value b, for example, a value corresponding to the case where the input detection level is high level may be set, or a value corresponding to the low level may be set. Further, the first threshold value b may be reset when the input detection level is switched. The first threshold value setting register 43 outputs the first threshold value to the μ value determination circuit 31.

第2閾値設定レジスタ45は、端子電圧の電圧レベルのばらつきの判定に用いられる第2閾値を格納するレジスタである。第2閾値は、入力信号の検出を行う際に参照される検出誤差である。図1では、第2閾値は、「c」と表記されている。第2閾値設定レジスタ45は、第2閾値をσ値判定回路33へ出力する。 The second threshold value setting register 45 is a register that stores the second threshold value used for determining the variation in the voltage level of the terminal voltage. The second threshold value is a detection error referred to when detecting an input signal. In FIG. 1, the second threshold value is indicated by "c". The second threshold value setting register 45 outputs the second threshold value to the σ value determination circuit 33.

これらの判定条件(入力検出レベルの設定値a、第1閾値b、第2閾値c)は、例えば、判定条件設定レジスタ40へアクセス可能な外部装置から設定される。 These determination conditions (input detection level setting value a, first threshold value b, second threshold value c) are set, for example, from an external device that can access the determination condition setting register 40.

<判定処理部>
判定処理部30は、統計処理結果と判定条件設定レジスタ40に格納された判定条件を用いて入力信号の検出を行う機能ブロックである。また、判定処理部30は、入力信号を検出すると入力検出信号を出力する。図1に示すように、判定処理部30は、μ値判定回路31、σ値判定回路33、入力判定回路35、入力判定結果レジスタ37、入力検出信号発生回路39を備えている。
<Judgment processing unit>
The determination processing unit 30 is a functional block that detects an input signal using the statistical processing result and the determination condition stored in the determination condition setting register 40. Further, when the determination processing unit 30 detects the input signal, the determination processing unit 30 outputs the input detection signal. As shown in FIG. 1, the determination processing unit 30 includes a μ value determination circuit 31, a σ value determination circuit 33, an input determination circuit 35, an input determination result register 37, and an input detection signal generation circuit 39.

μ値判定回路31の入力側は、μ値演算回路21の出力側、入力検出レベル設定レジスタ41の出力側、及び第1閾値設定レジスタ43の出力側と接続されている。μ値判定回路31の出力側は、入力判定回路35の入力側と接続されている。μ値判定回路31は、端子電圧の電圧レベルの期待値と、第1閾値設定レジスタ43から出力される第1閾値とを比較し、判定結果を第1判定信号として入力判定回路35へ出力する。 The input side of the μ value determination circuit 31 is connected to the output side of the μ value calculation circuit 21, the output side of the input detection level setting register 41, and the output side of the first threshold value setting register 43. The output side of the μ value determination circuit 31 is connected to the input side of the input determination circuit 35. The μ value determination circuit 31 compares the expected value of the voltage level of the terminal voltage with the first threshold value output from the first threshold value setting register 43, and outputs the determination result as the first determination signal to the input determination circuit 35. ..

例えば、入力検出レベルがハイレベルに設定され、端子電圧の電圧レベルの期待値(μ)が第1閾値より大きい場合、μ値判定回路31は、端子電圧の真の電圧レベルが入力検知レベルであると判定し、ハイレベルの第1判定信号を出力する。具体的には、入力検出レベル設定レジスタ41の設定値がハイレベル(a=1)に設定され、検知期待値がb=95に設定されているとする。そして、サンプリングにより、ハイレベルが95%より高い割合で検出されると、μ値判定回路31は、端子電圧の真の電圧レベルがハイレベル(入力検出レベル)であると判定する。そして、μ値判定回路31は、ハイレベルの第1判定信号を出力する。 For example, when the input detection level is set to a high level and the expected value (μ) of the voltage level of the terminal voltage is larger than the first threshold value, the μ value determination circuit 31 uses the true voltage level of the terminal voltage as the input detection level. It is determined that there is, and a high-level first determination signal is output. Specifically, it is assumed that the set value of the input detection level setting register 41 is set to the high level (a = 1) and the expected detection value is set to b = 95. Then, when the high level is detected at a rate higher than 95% by sampling, the μ value determination circuit 31 determines that the true voltage level of the terminal voltage is the high level (input detection level). Then, the μ value determination circuit 31 outputs a high-level first determination signal.

また、例えば、入力検出レベルがローレベルに設定され、端子電圧の電圧レベルの期待値(μ)が第1閾値より小さい場合、μ値判定回路31は、端子電圧の真の電圧レベルが入力検知レベルであると判定し、ハイレベルの第1判定信号を出力する。具体的には、入力検出レベル設定レジスタ41の設定値がローレベル(a=0)に設定され、検知期待値がb=95に設定されているとする。そして、サンプリングにより、ローレベルが95%より高い割合で検出されると、μ値判定回路31は、端子電圧の真の電圧レベルがローレベル(入力検出レベル)であると判定する。そして、μ値判定回路31は、ハイレベルの第1判定信号を出力する。 Further, for example, when the input detection level is set to a low level and the expected value (μ) of the voltage level of the terminal voltage is smaller than the first threshold value, the μ value determination circuit 31 detects the input of the true voltage level of the terminal voltage. It is determined that the level is high, and a high-level first determination signal is output. Specifically, it is assumed that the set value of the input detection level setting register 41 is set to the low level (a = 0) and the expected detection value is set to b = 95. Then, when the low level is detected at a rate higher than 95% by sampling, the μ value determination circuit 31 determines that the true voltage level of the terminal voltage is the low level (input detection level). Then, the μ value determination circuit 31 outputs a high-level first determination signal.

σ値判定回路33の入力側は、σ値演算回路23の出力側、及び第2閾値設定レジスタ45の出力側と接続されている。σ値判定回路33の出力側は、入力判定回路35の入力側と接続されている。σ値判定回路33は、端子電圧の電圧レベルの標準偏差と、第2閾値設定レジスタ45から出力される第2閾値とを比較し、端子電圧の電圧レベルの検出誤差を判定し、判定結果を第2判定信号として入力判定回路35へ出力する回路である。 The input side of the σ value determination circuit 33 is connected to the output side of the σ value calculation circuit 23 and the output side of the second threshold value setting register 45. The output side of the σ value determination circuit 33 is connected to the input side of the input determination circuit 35. The σ value determination circuit 33 compares the standard deviation of the voltage level of the terminal voltage with the second threshold value output from the second threshold value setting register 45, determines the detection error of the voltage level of the terminal voltage, and determines the determination result. This is a circuit that outputs a second determination signal to the input determination circuit 35.

例えば、端子電圧の電圧レベルの標準偏差が第2閾値未満である場合、σ値判定回路33は、端子電圧の電圧レベルの検出誤差は小さいと判定し、ハイレベルの第2判定信号を出力する。 For example, when the standard deviation of the voltage level of the terminal voltage is less than the second threshold value, the σ value determination circuit 33 determines that the detection error of the voltage level of the terminal voltage is small, and outputs a high level second determination signal. ..

具体的には、検知誤差がc=5に設定されているとする。そして、サンプリングによる端子電圧の電圧レベルの標準偏差(σ)が5%より小さいと、σ値判定回路33は、端子電圧の電圧レベルの検出誤差が小さいと判定する。 言い換えれば、σ値判定回路33は、入力信号の電圧レベルは、ハイレベル又はローレベルで安定していると判定する。そして、σ値判定回路33は、ハイレベルの第2判定信号を出力する。 Specifically, it is assumed that the detection error is set to c = 5. Then, when the standard deviation (σ) of the voltage level of the terminal voltage by sampling is smaller than 5%, the σ value determination circuit 33 determines that the detection error of the voltage level of the terminal voltage is small. In other words, the σ value determination circuit 33 determines that the voltage level of the input signal is stable at a high level or a low level. Then, the σ value determination circuit 33 outputs a high-level second determination signal.

入力判定回路35は、μ値判定回路31の判定結果、及びσ値判定回路33の判定結果を用いて入力端子P1に入力される入力信号の検出を行う回路である。入力判定回路35は、例えば、図1に示す2入力のAND回路で構成される。入力判定回路35の第1入力端は、μ値判定回路31の出力側と接続されている。入力判定回路35の第2入力端は、σ値判定回路33の出力側と接続されている。入力判定回路の出力端は、入力判定結果レジスタ37の入力側と接続されている。 The input determination circuit 35 is a circuit that detects an input signal input to the input terminal P1 by using the determination result of the μ value determination circuit 31 and the determination result of the σ value determination circuit 33. The input determination circuit 35 is composed of, for example, a two-input AND circuit shown in FIG. The first input end of the input determination circuit 35 is connected to the output side of the μ value determination circuit 31. The second input end of the input determination circuit 35 is connected to the output side of the σ value determination circuit 33. The output end of the input determination circuit is connected to the input side of the input determination result register 37.

例えば、μ値判定回路31からハイレベルの第1判定信号が入力され、σ値判定回路33からハイレベルの第2判定信号が入力された場合、入力判定回路35は、入力信号を検出したと判定し、ハイレベルの入力判定信号を入力判定結果として出力する。それ以外の場合、入力判定回路35は、ローレベルの入力判定信号を入力判定結果として出力する。 For example, when a high-level first determination signal is input from the μ value determination circuit 31 and a high-level second determination signal is input from the σ value determination circuit 33, the input determination circuit 35 detects the input signal. Judgment is performed, and a high-level input judgment signal is output as an input judgment result. In other cases, the input determination circuit 35 outputs a low-level input determination signal as an input determination result.

入力判定結果レジスタ37は、入力判定回路35から出力される入力判定結果を格納するレジスタである。入力判定結果レジスタ37の出力側は、入力検出信号発生回路39の入力側と接続されている。入力判定結果レジスタ37は、入力判定結果を入力検出信号発生回路39へ出力する。 The input determination result register 37 is a register that stores the input determination result output from the input determination circuit 35. The output side of the input determination result register 37 is connected to the input side of the input detection signal generation circuit 39. The input determination result register 37 outputs the input determination result to the input detection signal generation circuit 39.

入力検出信号発生回路39は、入力判定回路35における入力判定結果に応じて、入力検出信号を生成し出力する回路である。入力信号が検出された場合、入力検出信号発生回路39は、例えばハイレベルの信号を入力検出信号として出力する。これに対し、入力信号が検出されていない場合、入力検出信号発生回路39は、例えばローレベルの入力検出信号を出力する。 The input detection signal generation circuit 39 is a circuit that generates and outputs an input detection signal according to the input determination result in the input determination circuit 35. When the input signal is detected, the input detection signal generation circuit 39 outputs, for example, a high level signal as an input detection signal. On the other hand, when the input signal is not detected, the input detection signal generation circuit 39 outputs, for example, a low-level input detection signal.

入力検出信号発生回路39の出力側、すなわち、デジタルフィルタ1の出力は、例えば、CPU(Central Processing Unit)等を含むデバイスと接続される。入力端子P1に入力される入力信号が割り込み信号の場合、割り込み信号が検出されると、入力検出信号発生回路39は、例えばハイレベルの割り込み検出信号をデバイスへ出力する。デバイスは、入力される割り込み検出信号に基づき、所定の割り込み処理を行うこととなる。 The output side of the input detection signal generation circuit 39, that is, the output of the digital filter 1, is connected to, for example, a device including a CPU (Central Processing Unit) and the like. When the input signal input to the input terminal P1 is an interrupt signal, when the interrupt signal is detected, the input detection signal generation circuit 39 outputs, for example, a high-level interrupt detection signal to the device. The device performs predetermined interrupt processing based on the input interrupt detection signal.

<ハイレベルの入力信号の検出処理>
次に、本実施の形態における入力信号の検出処理について説明する。図2は、本発明の実施の形態1に係る入力信号の検出処理の一例を示すフロー図である。具体的に述べると、図2は、入力端子P1のハイレベル検知に関わるフローである。図2のフローは、ステップS11〜S19を含む。
<High-level input signal detection processing>
Next, the input signal detection process in the present embodiment will be described. FIG. 2 is a flow chart showing an example of an input signal detection process according to the first embodiment of the present invention. Specifically, FIG. 2 is a flow related to high level detection of the input terminal P1. The flow of FIG. 2 includes steps S11 to S19.

ステップS11では、第1サンプリング回数レジスタ15a、第2サンプリング回数レジスタ15bの初期化が行われる。具体的に述べると、第1サンプリング回数レジスタ15aには、α=1がハイレベルのサンプリング回数の初期値として設定される。同様に、第2サンプリング回数レジスタ15bには、β=1がローレベルのサンプリング回数の初期値として設定される。 In step S11, the first sampling number register 15a and the second sampling number register 15b are initialized. Specifically, α = 1 is set as the initial value of the high-level sampling number in the first sampling number register 15a. Similarly, β = 1 is set as the initial value of the low-level sampling number in the second sampling number register 15b.

なお、判定条件設定レジスタ40に含まれる各レジスタの値(判定条件)a、b、cは、ステップS11に先立って設定されてもよいし、サンプリング回数α、βと併せて設定されてもよい。入力信号をハイレベルとすれば、例えば入力検出レベルの設定値は、a=1に設定される。また、第1閾値b、第2閾値cの値は、所望の判定精度に応じて設定される。なお、判定条件設定レジスタ40に含まれる各レジスタの値a、b、cの設定は、CPUを含むデバイスや、外部装置から行われる。 The values (determination conditions) a, b, and c of each register included in the determination condition setting register 40 may be set prior to step S11, or may be set together with the sampling times α and β. .. If the input signal is set to a high level, for example, the set value of the input detection level is set to a = 1. Further, the values of the first threshold value b and the second threshold value c are set according to the desired determination accuracy. The values a, b, and c of each register included in the determination condition setting register 40 are set from a device including a CPU or an external device.

なお、第1サンプリング回数レジスタ15aのサンプリング回数α、及び第2サンプリング回数レジスタ15bに格納されるサンプリング回数βは、所定の期間ごとに初期化される。 The sampling number α of the first sampling number register 15a and the sampling number β stored in the second sampling number register 15b are initialized at predetermined intervals.

ステップS12では、第1サンプリング回数レジスタ15a、第2サンプリング回数レジスタ15bの初期値を用いた期待値の初期値及び標準偏差の初期値が算出される。信号レベルの期待値μ及び標準偏差σは、α、βを用いて次の式(1)、(2)により算出される。したがって、期待値の初期値μ=1/2、標準偏差の初期値σ=(1/12)1/2と算出される。 In step S12, the initial value of the expected value and the initial value of the standard deviation using the initial values of the first sampling number register 15a and the second sampling number register 15b are calculated. The expected value μ and standard deviation σ of the signal level are calculated by the following equations (1) and (2) using α and β. Therefore, the initial value μ 0 = 1/2 of the expected value and the initial value σ 0 = (1/12) 1/2 of the standard deviation are calculated.

μ=α/(α+β) ・・・(1)
σ=[αβ/((α+β)(α+β+1))]1/2 ・・・(2)
ステップS13において、入力端子P1の端子電圧のサンプリングが行われる。サンプリング回路11には、ハイレベルとローレベルとを周期的に繰り返す所定のサンプリングクロックが入力される。サンプリング回路11は、例えば、サンプリングクロックの立ち上がりのタイミングで入力端子P1の端子電圧をサンプリングする。サンプリング回路11は、サンプリングした端子電圧の信号レベルに応じた所定のサンプリングデータをサンプリングカウンタ10へ出力する。なお、以下では、説明を容易にするため、ハイレベルの端子電圧は、ハイレベルのサンプリングデータに対応し、ローレベルの端子電圧は、ローレベルのサンプリングデータに対応するものとする。
μ = α / (α + β) ・ ・ ・ (1)
σ = [αβ / ((α + β) 2 (α + β + 1))] 1/2 ... (2)
In step S13, the terminal voltage of the input terminal P1 is sampled. A predetermined sampling clock that periodically repeats high level and low level is input to the sampling circuit 11. The sampling circuit 11 samples the terminal voltage of the input terminal P1 at the rising timing of the sampling clock, for example. The sampling circuit 11 outputs predetermined sampling data according to the signal level of the sampled terminal voltage to the sampling counter 10. In the following, for the sake of simplicity, the high-level terminal voltage corresponds to the high-level sampling data, and the low-level terminal voltage corresponds to the low-level sampling data.

ステップS14では、サンプリングされた端子電圧の信号レベルが判定される。サンプリングされた端子電圧がハイレベルであると判定された場合、ステップS15の処理が実行される。この場合、例えば、第1加算器13aには、ハイレベルのサンプリングデータが入力され、第2加算器13bには、論理反転されたローレベルのサンプリングデータが入力される。 In step S14, the signal level of the sampled terminal voltage is determined. If it is determined that the sampled terminal voltage is at a high level, the process of step S15 is executed. In this case, for example, high-level sampling data is input to the first adder 13a, and logically inverted low-level sampling data is input to the second adder 13b.

ステップS15において、ハイレベルのサンプリングデータが入力されると、第1加算器13aは、ハイレベルの端子電圧のサンプリング回数を更新する。具体的に述べると、第1加算器13aは、直前のサンプリング回数αに対し1を加算し、サンプリング回数をαからα+1に更新する。一方、論理反転されたローレベルのサンプリングデータが入力された第2加算器13bは、ローレベルの端子電圧のサンプリング回数を更新しない。すなわち、第2加算器13bは、直前のサンプリング回数βに対する加算を行わず、サンプリング回数はβのままである。 When the high level sampling data is input in step S15, the first adder 13a updates the number of sampling times of the high level terminal voltage. Specifically, the first adder 13a adds 1 to the immediately preceding sampling number α and updates the sampling number from α to α + 1. On the other hand, the second adder 13b to which the logically inverted low-level sampling data is input does not update the sampling frequency of the low-level terminal voltage. That is, the second adder 13b does not add to the immediately preceding sampling number β, and the sampling number remains β.

第1加算器13aは、更新されたサンプリング回数(α+1)を第1サンプリング回数レジスタ15aへ出力する。更新されたサンプリング回数(α+1)は、第1サンプリング回数レジスタ15aに格納される。一方、第2加算器13bは、更新されなかったサンプリング回数(β)を、引き続き、第2サンプリング回数レジスタ15bへ出力する。 The first adder 13a outputs the updated sampling count (α + 1) to the first sampling count register 15a. The updated sampling count (α + 1) is stored in the first sampling count register 15a. On the other hand, the second adder 13b continuously outputs the unupdated sampling count (β) to the second sampling count register 15b.

これに対し、ステップS14において、サンプリングされた端子電圧がローレベルであると判定された場合、ステップS16の処理が実行される。この場合、例えば、第1加算器13aには、ローレベルのサンプリングデータが入力され、第2加算器13bには、論理反転されたハイレベルのサンプリングデータが入力される。 On the other hand, if it is determined in step S14 that the sampled terminal voltage is at a low level, the process of step S16 is executed. In this case, for example, low-level sampling data is input to the first adder 13a, and logically inverted high-level sampling data is input to the second adder 13b.

ステップS16において、ローレベルのサンプリングデータが入力された第1加算器13aは、ハイレベルの端子電圧のサンプリング回数を更新しない。すなわち、第1加算器13aは、直前のサンプリング回数αに対する加算を行わず、サンプリング回数はαのままである。一方、論理反転されたハイレベルのサンプリングデータが入力された第2加算器13bは、ローレベルの端子電圧のサンプリング回数を更新する。具体的に述べると、第2加算器13bは、直前のサンプリング回数βに対し1を加算し、サンプリング回数をβからβ+1に更新する。 In step S16, the first adder 13a to which the low level sampling data is input does not update the number of samplings of the high level terminal voltage. That is, the first adder 13a does not add to the immediately preceding sampling number α, and the sampling number remains α. On the other hand, the second adder 13b to which the logically inverted high-level sampling data is input updates the number of sampling times of the low-level terminal voltage. Specifically, the second adder 13b adds 1 to the immediately preceding sampling number β and updates the sampling number from β to β + 1.

第1加算器13aは、更新されなかったサンプリング回数(α)を、引き続き、第1サンプリング回数レジスタ15aへ出力する。一方、第2加算器13bは、更新されたサンプリング回数(β+1)を第2サンプリング回数レジスタ15bへ出力する。更新されたサンプリング回数(β+1)は、第2サンプリング回数レジスタ15bに格納される。 The first adder 13a continuously outputs the unupdated sampling count (α) to the first sampling count register 15a. On the other hand, the second adder 13b outputs the updated sampling count (β + 1) to the second sampling count register 15b. The updated sampling count (β + 1) is stored in the second sampling count register 15b.

ステップS15、S16に続いて、ステップS17の処理が行われる。ステップS17では、電圧レベルごとのサンプリング回数(α、β)を用いて端子電圧の期待値及び標準偏差が算出される。μ値演算回路21は、第1サンプリング回数レジスタ15aから出力されたハイレベルのサンプリング回数(α)、第2サンプリング回数レジスタ15bから出力されたローレベルのサンプリング回数(β)及び式(1)を用いて、入力端子P1の端子電圧の期待値μを算出する。算出された期待値μは、μ値判定回路31へ出力される。 Following steps S15 and S16, the process of step S17 is performed. In step S17, the expected value and standard deviation of the terminal voltage are calculated using the number of samplings (α, β) for each voltage level. The μ-value calculation circuit 21 calculates the high-level sampling count (α) output from the first sampling count register 15a, the low-level sampling count (β) output from the second sampling count register 15b, and equation (1). It is used to calculate the expected value μ of the terminal voltage of the input terminal P1. The calculated expected value μ is output to the μ value determination circuit 31.

また、σ値演算回路23は、第1サンプリング回数レジスタ15aに格納されたハイレベルのサンプリング回数(α)、第2サンプリング回数レジスタ15bに格納されたローレベルのサンプリング回数(β)及び式(2)を用いて、入力端子P1の端子電圧の標準偏差σを算出する。算出された標準偏差σは、σ値判定回路33へ出力される。 Further, the σ value calculation circuit 23 includes a high-level sampling number (α) stored in the first sampling number register 15a, a low-level sampling number (β) stored in the second sampling number register 15b, and the equation (2). ) Is used to calculate the standard deviation σ of the terminal voltage of the input terminal P1. The calculated standard deviation σ is output to the σ value determination circuit 33.

ステップS18では、ステップS17で算出された期待値μ、標準偏差σを用いた入力信号の検出が行われる。μ値判定回路31は、入力検出レベル設定レジスタ41から出力される入力検出レベルの設定値a、第1閾値設定レジスタ43から出力される検知期待値(第1閾値)b、μ値演算回路21から出力される期待値μを用いて入力信号の検出を行う。具体的に述べると、入力検出レベルの設定値aがハイレベルに対応する値(a=1)に設定されている場合、期待値μが検知期待値bより大きければ(μ>b)、μ値判定回路31は、端子電圧の真の電圧レベルがハイレベルであると判定する。そして、μ値判定回路31は、ハイレベルの第1判定信号を出力する。一方、期待値μが検知期待値b以下であれば(μ≦b)、μ値判定回路31は、端子電圧の真の電圧レベルがハイレベルではない、すなわちローレベルであると判定する。そして、μ値判定回路31は、ローレベルの第1判定信号を出力する。 In step S18, the input signal is detected using the expected value μ and the standard deviation σ calculated in step S17. The μ value determination circuit 31 has an input detection level setting value a output from the input detection level setting register 41, a detection expected value (first threshold value) b output from the first threshold value setting register 43, and a μ value calculation circuit 21. The input signal is detected using the expected value μ output from. Specifically, when the input detection level setting value a is set to a value (a = 1) corresponding to the high level, if the expected value μ is larger than the detection expected value b (μ> b), μ. The value determination circuit 31 determines that the true voltage level of the terminal voltage is a high level. Then, the μ value determination circuit 31 outputs a high-level first determination signal. On the other hand, if the expected value μ is equal to or less than the detected expected value b (μ ≦ b), the μ value determination circuit 31 determines that the true voltage level of the terminal voltage is not a high level, that is, a low level. Then, the μ value determination circuit 31 outputs a low-level first determination signal.

σ値判定回路33は、第2閾値設定レジスタ45から出力される検知誤差(第2閾値)c、σ値演算回路23から出力される標準偏差σを用いて入力信号の検出を行う。具体的に述べると、標準偏差σが検知誤差c未満であれば(σ<c)、σ値判定回路33は、端子電圧の電圧レベルの検出誤差は小さく、すなわち端子電圧のばらつきがほとんどなく、端子電圧は安定していると判定する。そして、σ値判定回路33は、ハイレベルの第2判定信号を出力する。一方、標準偏差σが検知誤差c以上であれば(σ≧c)、σ値判定回路33は、端子電圧の電圧レベルの検出誤差が大きく、すなわち端子電圧のばらつきが大きく、端子電圧は安定していないと判定する。そして、σ値判定回路33は、ローレベルの第2判定信号を出力する。 The σ value determination circuit 33 detects the input signal using the detection error (second threshold value) c output from the second threshold value setting register 45 and the standard deviation σ output from the σ value calculation circuit 23. Specifically, if the standard deviation σ is less than the detection error c (σ <c), the σ value determination circuit 33 has a small detection error of the voltage level of the terminal voltage, that is, there is almost no variation in the terminal voltage. Judge that the terminal voltage is stable. Then, the σ value determination circuit 33 outputs a high-level second determination signal. On the other hand, if the standard deviation σ is greater than or equal to the detection error c (σ ≧ c), the σ value determination circuit 33 has a large detection error of the voltage level of the terminal voltage, that is, a large variation in the terminal voltage, and the terminal voltage is stable. Judge that it is not. Then, the σ value determination circuit 33 outputs a low-level second determination signal.

入力判定回路35は、μ値判定回路31から出力される第1判定信号及びσ値判定回路33から出力される第2判定信号を用いて入力信号の検出を行う。具体的に述べると、入力判定回路35は、ハイレベルの第1判定信号及びハイレベルの第2判定信号が入力されたとき入力信号を検出したと判定する(Yes)。すなわち、入力判定回路35は、端子電圧の真の電圧レベルが入力検出レベル(ここではハイレベル)であり、かつ、標準偏差σが検知誤差c未満であると判定したとき(Yes)、入力信号を検出したと判定する。そして、入力判定回路35は、例えばハイレベルの入力判定信号を出力する。入力判定結果レジスタ37は、入力判定信号に応じた入力判定結果(例えばハイレベル)を格納し、入力検出信号発生回路39へ出力する。ハイレベルの検出条件は、式(3)で表される。 The input determination circuit 35 detects the input signal using the first determination signal output from the μ value determination circuit 31 and the second determination signal output from the σ value determination circuit 33. Specifically, the input determination circuit 35 determines that the input signal is detected when the high-level first determination signal and the high-level second determination signal are input (Yes). That is, when the input determination circuit 35 determines that the true voltage level of the terminal voltage is the input detection level (here, the high level) and the standard deviation σ is less than the detection error c (Yes), the input signal Is determined to have been detected. Then, the input determination circuit 35 outputs, for example, a high-level input determination signal. The input determination result register 37 stores the input determination result (for example, high level) corresponding to the input determination signal and outputs it to the input detection signal generation circuit 39. The high-level detection condition is represented by the equation (3).

μ>b、かつ、σ<c ・・・(3)
ステップS19では、所定の入力検出信号が生成、出力される。具体的に述べると、入力検出信号発生回路39は、入力判定結果レジスタ37から出力されるハイレベルの入力判定結果に応じて、入力検出レベル(ハイレベル)の入力信号が検出されたものとして、例えばハイレベルの入力検出信号を生成し出力する。その後、入力信号の検出処理が終了する。
μ> b and σ <c ... (3)
In step S19, a predetermined input detection signal is generated and output. Specifically, the input detection signal generation circuit 39 assumes that the input detection level (high level) input signal has been detected according to the high-level input determination result output from the input determination result register 37. For example, it generates and outputs a high-level input detection signal. After that, the input signal detection process ends.

なお、入力検出信号発生回路39から出力される入力検出信号は、制御回路等に入力される。例えば、入力信号が割り込み信号である場合、入力検出信号は割り込み検出信号である。割り込み信号が検出されると、割り込み検出信号が制御回路等に入力され、割り込み信号に応じた所定の処理が実行される。 The input detection signal output from the input detection signal generation circuit 39 is input to the control circuit or the like. For example, when the input signal is an interrupt signal, the input detection signal is an interrupt detection signal. When the interrupt signal is detected, the interrupt detection signal is input to the control circuit or the like, and a predetermined process corresponding to the interrupt signal is executed.

一方、ステップS18において、式(3)を満たさない場合(No)、入力判定回路35は、ハイレベルの入力信号は検出されていないと判定し、例えばローレベルの入力判定信号を出力する。入力判定結果レジスタ37は、入力判定信号に応じた入力判定結果(例えばローレベル)を格納し、入力検出信号発生回路39へ出力する。入力検出信号発生回路39は、入力判定結果レジスタ37から出力されるローレベルの入力判定結果に応じて、例えばローレベルの信号を生成し出力する。そして、ステップS13に戻り、ステップS13〜S18の処理が再び実行される。 On the other hand, in step S18, if the equation (3) is not satisfied (No), the input determination circuit 35 determines that the high-level input signal has not been detected, and outputs, for example, a low-level input determination signal. The input determination result register 37 stores the input determination result (for example, low level) corresponding to the input determination signal and outputs it to the input detection signal generation circuit 39. The input detection signal generation circuit 39 generates, for example, a low-level signal and outputs it according to the low-level input determination result output from the input determination result register 37. Then, the process returns to step S13, and the processes of steps S13 to S18 are executed again.

<<ハイレベルの入力信号検出の具体例>>
図3は、ハイレベルの入力信号を検出する際の確率密度分布の変化を例示する図である。具体的に述べると、図3は、初期状態から4回連続でハイレベルの信号がサンプリングされた場合の確率密度分布の変化を示している。図3の横軸は、入力信号の信号レベルがハイレベルである期待値を示し、図3の縦軸は確率密度分布を示している。図3(a)は、初期状態、すなわち図2のステップS11直後の状態を示している。初期状態の確率密度分布は、入力端子の端子電圧の電圧レベルがハイレベルであるかローレベルであるか不明であり、各期待値に対する確率密度分布が一定となっている。初期状態における期待値μは1/2であり、横軸の中央に位置する。この場合、入力信号の電圧レベルがハイレベルである確率は、50%である。
<< Specific example of high-level input signal detection >>
FIG. 3 is a diagram illustrating a change in the probability density distribution when detecting a high-level input signal. Specifically, FIG. 3 shows the change in the probability density distribution when a high-level signal is sampled four times in a row from the initial state. The horizontal axis of FIG. 3 shows the expected value at which the signal level of the input signal is high, and the vertical axis of FIG. 3 shows the probability density distribution. FIG. 3A shows an initial state, that is, a state immediately after step S11 in FIG. Regarding the probability density distribution in the initial state, it is unknown whether the voltage level of the terminal voltage of the input terminal is high level or low level, and the probability density distribution for each expected value is constant. The expected value μ in the initial state is 1/2, and is located in the center of the horizontal axis. In this case, the probability that the voltage level of the input signal is high is 50%.

次に、1回目にハイレベルがサンプリングされると、図3(b)に示すように、確率密度分布は、50%から右側(「1」側)に少し偏った分布となる。確率密度分布のピーク付近が期待値である。したがって、この場合の期待値は、50%からやや大きい値となる。一方、確率密度分布の標準偏差は、初期状態よりもやや小さい値となる。 Next, when the high level is sampled for the first time, as shown in FIG. 3 (b), the probability density distribution becomes a distribution slightly biased from 50% to the right side (“1” side). The expected value is near the peak of the probability density distribution. Therefore, the expected value in this case is a value slightly larger than 50%. On the other hand, the standard deviation of the probability density distribution is slightly smaller than the initial state.

そして、2回目もハイレベルがサンプリングされると、図3(c)に示すように、確率密度分布は、図3(b)よりもさらに右側に偏った分布となる。期待値は、図3(b)の状態よりも大きくなり、標準偏差は、図3(b)の状態よりもさらに小さい値となる。3回目、4回目も続けてハイレベルがサンプリングされると、図3(d)、(e)に示すように、確率密度分布はさらに右側に偏った分布となる。期待値は、図3(d)、(e)へシフトするにつれて大きくなり、横軸の「1」、すなわち100%に近くなる。また、標準偏差は、図3(d)、(e)へシフトするにつれて小さい値となる。 Then, when the high level is sampled the second time, the probability density distribution becomes a distribution biased to the right side of FIG. 3 (b) as shown in FIG. 3 (c). The expected value is larger than the state of FIG. 3 (b), and the standard deviation is even smaller than the state of FIG. 3 (b). When the high level is sampled continuously for the third and fourth times, the probability density distribution becomes a distribution biased to the right side as shown in FIGS. 3 (d) and 3 (e). The expected value increases as it shifts to FIGS. 3 (d) and 3 (e), and becomes close to "1" on the horizontal axis, that is, 100%. Further, the standard deviation becomes smaller as it shifts to FIGS. 3 (d) and 3 (e).

一方、ローレベルがサンプリングされると、確率密度分布は、左側(「0」側)に少しシフトする。このように、サンプリングごとに、確率密度分布のピークは、右側又は左側へシフトする。そして、式(3)の条件を満たすと、ハイレベルの入力信号の検出処理が完了し、例えば割り込みが発生することとなる。 On the other hand, when the low level is sampled, the probability density distribution shifts slightly to the left (“0” side). Thus, with each sampling, the peak of the probability density distribution shifts to the right or left. Then, when the condition of the equation (3) is satisfied, the high-level input signal detection process is completed, and an interrupt is generated, for example.

<ローレベルの入力信号の検出処理>
次に、ローレベルの入力信号の検出処理について説明する。図4は、本発明の実施の形態1に係る入力信号の検出処理の一例を示すフロー図である。図4は、入力端子P1のローレベル検知に関わるフローである。図4のフローは、ステップS11〜S17、S28〜S29を含む。ステップS11〜S17の処理は、図2で説明したハイレベル検知と同様であるので、説明は省略する。
<Low-level input signal detection processing>
Next, the low-level input signal detection process will be described. FIG. 4 is a flow chart showing an example of an input signal detection process according to the first embodiment of the present invention. FIG. 4 is a flow related to low level detection of the input terminal P1. The flow of FIG. 4 includes steps S11 to S17 and S28 to S29. Since the processing of steps S11 to S17 is the same as the high level detection described with reference to FIG. 2, the description thereof will be omitted.

ステップS28では、ステップS18とは異なる条件で入力信号の検出が行われる。具体的に述べると、入力検出レベルの設定値aがローレベルに対応する値(a=0)に設定されている場合、期待値μが検知期待値bに対する所定の値(1−b)より小さければ(μ<1−b)、μ値判定回路31は、端子電圧の真の電圧レベルがローレベルであると判定する。ここで示す値μがハイレベルの入力信号に対応する値であるため、ローレベル検知における期待値μの比較対象が値(1−b)となっている。ただし、ローレベルに対応する検知期待値が、別途設定されてもよい。 In step S28, the input signal is detected under conditions different from those in step S18. Specifically, when the input detection level setting value a is set to a value (a = 0) corresponding to the low level, the expected value μ is more than a predetermined value (1-b) with respect to the detection expected value b. If it is small (μ <1-b), the μ value determination circuit 31 determines that the true voltage level of the terminal voltage is low. Since the value μ shown here is a value corresponding to the high-level input signal, the comparison target of the expected value μ in the low-level detection is the value (1-b). However, the expected detection value corresponding to the low level may be set separately.

そして、μ値判定回路31は、ハイレベルの第1判定信号を出力する。一方、期待値μが検知期待値1−b以上であれば(μ≧1−b)、μ値判定回路31は、端子電圧の真の電圧レベルがローレベルではない、すなわちハイレベルであると判定する。そして、μ値判定回路31は、ローレベルの第1判定信号を出力する。 Then, the μ value determination circuit 31 outputs a high-level first determination signal. On the other hand, if the expected value μ is equal to or higher than the detected expected value 1-b (μ ≧ 1-b), the μ value determination circuit 31 determines that the true voltage level of the terminal voltage is not a low level, that is, a high level. judge. Then, the μ value determination circuit 31 outputs a low-level first determination signal.

σ値判定回路33の動作は、ステップS18と同様である。標準偏差σが検知誤差c未満であれば(σ<c)、σ値判定回路33は、ハイレベルの第2判定信号を出力する。一方、標準偏差σが検知誤差c以上であれば(σ≧c)、σ値判定回路33は、ローレベルの第2判定信号を出力する。 The operation of the σ value determination circuit 33 is the same as in step S18. If the standard deviation σ is less than the detection error c (σ <c), the σ value determination circuit 33 outputs a high-level second determination signal. On the other hand, if the standard deviation σ is equal to or greater than the detection error c (σ ≧ c), the σ value determination circuit 33 outputs a low-level second determination signal.

入力判定回路35は、端子電圧の真の電圧レベルがローレベルであり、かつ、標準偏差σが検知誤差c未満であると判定したとき(Yes)、入力信号を検出したと判定する。そして、入力判定回路35は、例えばハイレベルの入力判定信号を出力する。入力判定結果レジスタ37は、入力判定信号に応じた入力判定結果(例えばハイレベル)を格納し、入力検出信号発生回路39へ出力する。ローレベルの検出条件は、式(4)で表される。 When the input determination circuit 35 determines that the true voltage level of the terminal voltage is low and the standard deviation σ is less than the detection error c (Yes), it determines that the input signal has been detected. Then, the input determination circuit 35 outputs, for example, a high-level input determination signal. The input determination result register 37 stores the input determination result (for example, high level) corresponding to the input determination signal and outputs it to the input detection signal generation circuit 39. The low-level detection condition is represented by the equation (4).

μ<1−b、かつ、σ<c ・・・(4)
ステップS29では、入力検出信号発生回路39は、入力判定結果レジスタ37から出力されるハイレベルの入力判定結果に応じて、ローレベルの入力信号が検出されたものとして、例えばハイレベルの入力検出信号を生成し出力する。その後、入力信号の検出処理が終了する。
μ <1-b and σ <c ... (4)
In step S29, the input detection signal generation circuit 39 assumes that a low-level input signal has been detected according to the high-level input determination result output from the input determination result register 37, for example, a high-level input detection signal. Is generated and output. After that, the input signal detection process ends.

一方、ステップS28において、式(4)を満たさない場合(No)、入力判定回路35は、ローレベルの入力信号は検出されていないと判定し、例えばローレベルの入力判定信号を出力する。そして、ステップS13に戻り、ステップS13〜S28の処理が再び実行される。 On the other hand, in step S28, if the equation (4) is not satisfied (No), the input determination circuit 35 determines that the low-level input signal has not been detected, and outputs, for example, a low-level input determination signal. Then, the process returns to step S13, and the processes of steps S13 to S28 are executed again.

<<ローレベルの入力信号検出の具体例>>
図5は、ローレベルの入力信号を検出する際の確率密度分布の変化を例示する図である。図5は、初期状態から4回連続でローレベルの信号がサンプリングされた場合の確率密度分布の変化を示している。図5に示す各状態における確率密度分布は、ハイレベルの入力信号の検出に係る図3の対応する各状態における確率密度分布と対称になっている。
<< Specific example of low-level input signal detection >>
FIG. 5 is a diagram illustrating a change in the probability density distribution when detecting a low-level input signal. FIG. 5 shows the change in the probability density distribution when a low-level signal is sampled four times in a row from the initial state. The probability density distribution in each state shown in FIG. 5 is symmetrical with the probability density distribution in each corresponding state of FIG. 3 related to the detection of a high-level input signal.

図5(a)は、初期状態、すなわち図4のステップS11直後の状態を示している。初期状態の確率密度分布は、図3(a)と同様である。次に、1回目にローレベルがサンプリングされると、図5(b)に示すように、確率密度分布は、50%から左側(「0」側)に少し偏った分布となる。確率密度分布のピーク付近が期待値である。したがって、この場合の期待値は、50%からやや小さい値となる。一方、確率密度分布の標準偏差は、初期状態よりもやや小さい値となる。 FIG. 5A shows an initial state, that is, a state immediately after step S11 in FIG. The probability density distribution in the initial state is the same as in FIG. 3A. Next, when the low level is sampled for the first time, the probability density distribution becomes slightly biased from 50% to the left side (“0” side) as shown in FIG. 5 (b). The expected value is near the peak of the probability density distribution. Therefore, the expected value in this case is a value slightly smaller than 50%. On the other hand, the standard deviation of the probability density distribution is slightly smaller than the initial state.

そして、2〜4回目もローレベルがサンプリングされると、図5(c)から図5(e)の順に、確率密度分布は、さらに左側に偏った分布となる。また、標準偏差は、図5(c)から図5(e)の順に、小さい値となる。 Then, when the low level is sampled 2 to 4 times, the probability density distribution is further biased to the left in the order of FIGS. 5 (c) to 5 (e). Further, the standard deviation becomes smaller in the order of FIGS. 5 (c) to 5 (e).

一方、ハイレベルがサンプリングされると、確率密度分布は、左側(「1」側)に少しシフトする。このように、サンプリングごとに、確率密度分布のピークは、右側又は左側へシフトする。そして、式(4)の条件を満たすと、ローレベルの入力信号の検出処理が完了し、例えば割り込みが発生することとなる。 On the other hand, when the high level is sampled, the probability density distribution shifts slightly to the left (“1” side). Thus, with each sampling, the peak of the probability density distribution shifts to the right or left. Then, when the condition of the equation (4) is satisfied, the low-level input signal detection process is completed, and an interrupt is generated, for example.

<本実施の形態による主な効果>
本実施の形態によれば、電圧レベルごとのサンプリング回数を用いて入力端子P1の端子電圧の統計処理が行われる。この構成によれば、複数回のサンプリングにより端子電圧の信号レベルの判定が行われるので、ノイズが発生する状況においても端子電圧の電圧レベルを正確に判定することが可能となる。これにより、入力端子P1に入力される入力信号を正確に検出することが可能となる。また、これにより、割り込み信号が入力信号として規定されている場合、割り込み信号の検出が正確に行われ、半導体装置の動作を安定させることが可能となる。
<Main effects of this embodiment>
According to this embodiment, statistical processing of the terminal voltage of the input terminal P1 is performed using the number of samplings for each voltage level. According to this configuration, since the signal level of the terminal voltage is determined by sampling a plurality of times, it is possible to accurately determine the voltage level of the terminal voltage even in a situation where noise is generated. This makes it possible to accurately detect the input signal input to the input terminal P1. Further, as a result, when the interrupt signal is defined as an input signal, the interrupt signal is accurately detected, and the operation of the semiconductor device can be stabilized.

また、本実施の形態によれば、統計処理部は、算出した期待値及び標準偏差を用いたベイズ統計により統計処理を行う。この構成によれば、入力端子P1の端子電圧の電圧レベルの期待値が所定の条件を満たしても、電圧レベルのばらつき(標準偏差)が所定の条件を満たさない場合には、入力信号を検出したと判定されないので、入力信号の検出が確実に行われる。 Further, according to the present embodiment, the statistical processing unit performs statistical processing by Bayesian statistics using the calculated expected value and standard deviation. According to this configuration, even if the expected value of the voltage level of the terminal voltage of the input terminal P1 satisfies the predetermined condition, the input signal is detected when the variation (standard deviation) of the voltage level does not satisfy the predetermined condition. Since it is not determined that the input signal has been detected, the input signal is reliably detected.

(実施の形態2)
次に、実施の形態2について説明する。すでに述べた実施の形態1では、判定条件設定レジスタ40に格納される判定条件(例えば、検知期待値b、検知誤差c)が、ユーザにより任意の値に設定される。すなわち、実施の形態1のデジタルフィルタには、判定条件をシステム環境に最適な値に設定できるという自由度があった。しかし、初心者がデジタルフィルタや半導体装置(例えばマイコン等)を含むシステムを扱う場合や、検出対象の信号が受けるノイズの影響がはっきりしない状況においては、ユーザ側で検知期待値や検知誤差等の判定条件を決められない場合もあり得る。そこで、本実施の形態では、検知期待値や検知誤差等の判定条件を自動設定することが可能なデジタルフィルタについて説明する。
(Embodiment 2)
Next, the second embodiment will be described. In the first embodiment described above, the determination condition (for example, the expected detection value b and the detection error c) stored in the determination condition setting register 40 is set to an arbitrary value by the user. That is, the digital filter of the first embodiment has a degree of freedom that the determination condition can be set to the optimum value for the system environment. However, when a beginner handles a system including a digital filter or a semiconductor device (for example, a microcomputer), or when the influence of noise on the signal to be detected is not clear, the user determines the expected detection value or detection error. It may not be possible to determine the conditions. Therefore, in the present embodiment, a digital filter capable of automatically setting determination conditions such as an expected detection value and a detection error will be described.

図6は、本発明の実施の形態2に係るデジタルフィルタの構成の一例を示す回路図である。図6のデジタルフィルタ101は、図1のデジタルフィルタ1に判定条件設定回路140が追加されている。判定条件設定回路140は、判定条件設定レジスタに格納される判定条件を自動設定する機能ブロックである。具体的に述べると、判定条件設定回路140は、第1閾値設定レジスタ43に格納される検知期待値、第2閾値設定レジスタ45に格納される検知誤差を算出し、算出した検知期待値及び検知誤差をそれぞれのレジスタに格納する。 FIG. 6 is a circuit diagram showing an example of the configuration of the digital filter according to the second embodiment of the present invention. In the digital filter 101 of FIG. 6, a determination condition setting circuit 140 is added to the digital filter 1 of FIG. The determination condition setting circuit 140 is a functional block that automatically sets the determination condition stored in the determination condition setting register. Specifically, the determination condition setting circuit 140 calculates the detection expected value stored in the first threshold value setting register 43 and the detection error stored in the second threshold value setting register 45, and the calculated detection expected value and detection. Store the error in each register.

判定条件設定回路140は、検知反応時間レジスタ141、演算回路143、145、147、149を備えている。検知反応時間レジスタ141の出力側は、演算回路143の入力側と接続されている。演算回路143の出力側は、演算回路145の入力側と接続されている。演算回路145の出力側は、演算回路147、149のそれぞれの入力側と接続されている。演算回路147の出力側は、第1閾値設定レジスタ43の入力側と接続されている。演算回路149の出力側は、第2閾値設定レジスタ45の入力側と接続されている。 The determination condition setting circuit 140 includes a detection reaction time register 141, an arithmetic circuit 143, 145, 147, and 149. The output side of the detection reaction time register 141 is connected to the input side of the arithmetic circuit 143. The output side of the arithmetic circuit 143 is connected to the input side of the arithmetic circuit 145. The output side of the arithmetic circuit 145 is connected to each input side of the arithmetic circuits 147 and 149. The output side of the arithmetic circuit 147 is connected to the input side of the first threshold value setting register 43. The output side of the arithmetic circuit 149 is connected to the input side of the second threshold value setting register 45.

検知反応時間レジスタ141は、検出対象信号(入力信号)に対する検知反応時間を設定するレジスタである。ユーザは、ハイレベル検知又はローレベル検知において許容できる応答時間を検知反応時間「d」として設定し、検知反応時間レジスタ141に格納する。検知反応時間とは、システム上これ以上反応が遅れるとシステムの動作に問題が生じる時間のことをいう。言い換えると、検知反応時間以内に検出対象信号が検出できれば、システムにおいて許容され、検出された入力信号に基づく処理が実行可能である。 The detection reaction time register 141 is a register for setting the detection reaction time for the detection target signal (input signal). The user sets an acceptable response time in high-level detection or low-level detection as the detection reaction time "d" and stores it in the detection reaction time register 141. The detection reaction time is the time when a problem occurs in the operation of the system if the reaction is delayed any more on the system. In other words, if the detection target signal can be detected within the detection reaction time, it is permissible in the system and processing based on the detected input signal can be executed.

検知反応時間レジスタ141に格納された検知反応時間dに基づき、演算回路143〜149において検知期待値、検知誤差の設定値が算出される。演算回路143は、入力信号の検知期間「e」を演算する回路である。なお、以下では、検知期間をリフレッシュ期間と呼ぶ場合がある。演算回路145は、検知期間eにおけるサンプリング回数「f」を演算する回路である。演算回路147は、サンプリング回数fを用い、所定の回数連続で同一の電圧レベルがサンプリングされたときの期待値「x」を演算する回路である。演算回路149は、サンプリング回数fを用い、所定の回数連続で同一の電圧レベルがサンプリングされたときの標準偏差「y」を演算する回路である。 Based on the detection reaction time d stored in the detection reaction time register 141, the calculation circuits 143 to 149 calculate the expected detection value and the set value of the detection error. The calculation circuit 143 is a circuit that calculates the detection period "e" of the input signal. In the following, the detection period may be referred to as a refresh period. The calculation circuit 145 is a circuit that calculates the number of sampling times “f” in the detection period e. The calculation circuit 147 is a circuit that calculates the expected value “x” when the same voltage level is sampled continuously a predetermined number of times by using the sampling number f. The calculation circuit 149 is a circuit that calculates the standard deviation “y” when the same voltage level is sampled continuously a predetermined number of times by using the sampling number f.

図7は、本発明の実施の形態2に係る検知期待値及び検知誤差を自動で設定する方法の一例を示すフロー図である。検知期待値及び検知誤差の自動設定に際し、例えば図7のステップS31〜S35が実行される。 FIG. 7 is a flow chart showing an example of a method of automatically setting the expected detection value and the detection error according to the second embodiment of the present invention. For example, steps S31 to S35 of FIG. 7 are executed when the expected detection value and the detection error are automatically set.

まず、ステップS311において、ユーザは、検知反応時間レジスタ141に、所定の検知反応時間dを設定する。検知反応時間dは、例えば、外部の入力端末等から入力される(S31)。検知反応時間レジスタ141は、設定された検知反応時間dを演算回路143へ出力する。ステップS32において、演算回路143は、例えば、以下に示す式(5)により検知反応時間dを用いてリフレッシュ期間eを演算する。ステップS33において、演算回路145は、ステップS32で算出されたリフレッシュ期間e、及びサンプリング周期Tsから、以下に式(6)を用いてリフレッシュ期間eにおけるサンプリング回数fを演算する。なお、サンプリング周期Tsとは、図13に示すように、サンプリングクロックの立ち上がりごとに入力端子P1の電圧レベルをサンプリングする間隔のことをいう。 First, in step S311 the user sets a predetermined detection reaction time d in the detection reaction time register 141. The detection reaction time d is input from, for example, an external input terminal or the like (S31). The detection reaction time register 141 outputs the set detection reaction time d to the arithmetic circuit 143. In step S32, the calculation circuit 143 calculates the refresh period e using the detection reaction time d according to the following equation (5), for example. In step S33, the arithmetic circuit 145 calculates the number of samplings f in the refresh period e from the refresh period e and the sampling cycle Ts calculated in step S32 using the following equation (6). As shown in FIG. 13, the sampling period Ts means an interval for sampling the voltage level of the input terminal P1 at each rising edge of the sampling clock.

次に、ステップS34について説明する。演算回路147は、サンプリング回数fを用い、以下に式(7)により、f/2回連続で同一の電圧レベルがサンプリングされたときの期待値「x」を演算する。また、これと並行して、演算回路149は、サンプリング回数fを用い、以下に式(8)により、f/2回連続で同一の電圧レベルがサンプリングされたときの標準偏差「y」を演算する。 Next, step S34 will be described. Using the number of samplings f, the arithmetic circuit 147 calculates the expected value “x” when the same voltage level is sampled f / 2 times in succession by the following equation (7). Further, in parallel with this, the arithmetic circuit 149 calculates the standard deviation “y” when the same voltage level is sampled f / 2 times continuously by the following equation (8) using the sampling number f. To do.

e=d/10 ・・・(5)
f=e/(サンプリング周期) ・・・(6)
x=(f+2)/(f+4) ・・・(7)
y=((4f+8)/(((f+4)^2)(f+6)))^1/2 ・・・(8)
ステップS35では、演算回路147で算出された期待値xは、検知期待値(第1閾値)bとして、第1閾値設定レジスタ43へ格納される。また、演算回路149で算出された標準偏差yは、検知誤差(第2閾値)cとして、第2閾値設定レジスタ45へ格納される。なお、ここで算出される期待値xは、例えば、ハイレベルが連続でサンプリングされた場合の値を示している。なお、ここでは、判定条件として、検知期待値及び検知誤差が自動で設定される場合について説明したが、これ以外の判定条件が自動で設定されてもよい。
e = d / 10 ... (5)
f = e / (sampling cycle) ・ ・ ・ (6)
x = (f + 2) / (f + 4) ... (7)
y = ((4f + 8) / (((f + 4) ^ 2) (f + 6))) ^ 1/2 ... (8)
In step S35, the expected value x calculated by the arithmetic circuit 147 is stored in the first threshold value setting register 43 as the detected expected value (first threshold value) b. Further, the standard deviation y calculated by the arithmetic circuit 149 is stored in the second threshold value setting register 45 as a detection error (second threshold value) c. The expected value x calculated here indicates, for example, a value when high levels are continuously sampled. Although the case where the expected detection value and the detection error are automatically set as the judgment conditions has been described here, other judgment conditions may be automatically set.

なお、本実施の形態に係るデジタルフィルタ101では、例えばf回のサンプリングごとに、第1サンプリング回数レジスタ15aのサンプリング回数α、及び第2サンプリング回数レジスタ15bに格納されるサンプリング回数βが初期化される。これは、ステップS33において算出されるリフレッシュ期間eと、サンプリング回数α、βが初期化される期間とを整合させるためである。ステップS32〜S35は、ハードウェアにより自動的に処理される。すなわち、ステップS31において、ユーザにより検知反応時間dが設定されると、式(5)〜(8)の演算と、x、yの格納が自動的に行われる。 In the digital filter 101 according to the present embodiment, for example, the sampling number α of the first sampling number register 15a and the sampling number β stored in the second sampling number register 15b are initialized for each f samplings. To. This is to match the refresh period e calculated in step S33 with the period in which the sampling times α and β are initialized. Steps S32 to S35 are automatically processed by the hardware. That is, in step S31, when the detection reaction time d is set by the user, the operations of the equations (5) to (8) and the storage of x and y are automatically performed.

ユーザは、自動設定された検知期待値b及び検知誤差cを確認し、問題がないと判断すれば、これら設定値を用いた入力信号の検出処理を実行させる。一方、ユーザは、これらの設定値に問題があると判断すれば、検知期待値b及び検知誤差cを手動で再設定し、再設定された値を用いて入力信号の検出処理を実行させる。 The user confirms the automatically set detection expected value b and the detection error c, and if it is determined that there is no problem, causes the user to execute the input signal detection process using these set values. On the other hand, if the user determines that there is a problem with these set values, the expected detection value b and the detection error c are manually reset, and the input signal detection process is executed using the reset values.

本実施の形態によれば、検知期待値b及び検知誤差cを自動で設定することが可能となる。これにより、初心者がデジタルフィルタや半導体装置を含むシステムを扱う場合や、検出対象の信号が受けるノイズの影響がはっきりしない状況においても判定条件の設定が自動で行われる。また、自動設定後においても、ユーザは、検知期待値b及び検知誤差cを手動で設定可能であり、システム環境に適切な値に設定することが可能となる。 According to this embodiment, the expected detection value b and the detection error c can be automatically set. As a result, the determination conditions are automatically set even when a beginner handles a system including a digital filter or a semiconductor device, or when the influence of noise on the signal to be detected is not clear. Further, even after the automatic setting, the user can manually set the expected detection value b and the detection error c, and can set the values appropriate for the system environment.

(実施の形態3)
次に、実施の形態3について説明する。本実施の形態では、入力端子P1の端子電圧の電圧レベルのサンプリング状況に応じて、周波数(サンプリング周期)の異なるサンプリングクロックを切り換えながら入力信号の検出を行うデジタルフィルタについて説明する。
(Embodiment 3)
Next, the third embodiment will be described. In the present embodiment, a digital filter that detects an input signal while switching sampling clocks having different frequencies (sampling cycles) according to the sampling status of the voltage level of the terminal voltage of the input terminal P1 will be described.

図8は、本発明の実施の形態3に係るデジタルフィルタの構成の一例を示す回路図である。図8のデジタルフィルタ201は、図1のデジタルフィルタ1にサンプリングクロック選択回路210が追加されている。サンプリングクロック選択回路210は、入力端子P1の端子電圧の電圧レベルのサンプリング状況に応じて、サンプリングクロックを選択する機能ブロックである。図8に示すように、サンプリングクロック選択回路210は、分周回路211、判定回路213、選択スイッチ215を備えている。 FIG. 8 is a circuit diagram showing an example of the configuration of the digital filter according to the third embodiment of the present invention. In the digital filter 201 of FIG. 8, a sampling clock selection circuit 210 is added to the digital filter 1 of FIG. The sampling clock selection circuit 210 is a functional block that selects a sampling clock according to the sampling status of the voltage level of the terminal voltage of the input terminal P1. As shown in FIG. 8, the sampling clock selection circuit 210 includes a frequency dividing circuit 211, a determination circuit 213, and a selection switch 215.

分周回路211の入力側には、基準サンプリングクロックが入力される。分周回路211は、基準サンプリングクロックを分周し、基準サンプリングクロックとは異なる周波数のサンプリングクロックを生成する。また、分周回路211は、それぞれ周波数が異なる複数のサンプリングクロックを生成してもよい。分周回路211の出力側は、選択スイッチ215の入力側と接続されており、生成したサンプリングクロックを選択スイッチ215へ出力する。 A reference sampling clock is input to the input side of the frequency divider circuit 211. The frequency dividing circuit 211 divides the reference sampling clock and generates a sampling clock having a frequency different from that of the reference sampling clock. Further, the frequency dividing circuit 211 may generate a plurality of sampling clocks having different frequencies. The output side of the frequency divider circuit 211 is connected to the input side of the selection switch 215, and the generated sampling clock is output to the selection switch 215.

判定回路213は、入力端子P1の端子電圧の電圧レベルのサンプリング状況を判定する回路である。判定回路213の入力側は、第1閾値設定レジスタ43の出力側と、μ値演算回路21の出力側と接続されている。すなわち、判定回路213には、検知期待値b、及びサンプリングによる入力端子の電圧レベルの期待値μが入力される。判定回路213の出力側は、選択スイッチ215の入力側と接続されている。判定回路213は、検知期待値b及び期待値μを用いて、端子電圧の電圧レベルのサンプリング状況を判定し、判定結果を選択スイッチ215へ出力する。判定回路213における判定処理については、後述する。 The determination circuit 213 is a circuit for determining the sampling status of the voltage level of the terminal voltage of the input terminal P1. The input side of the determination circuit 213 is connected to the output side of the first threshold value setting register 43 and the output side of the μ value calculation circuit 21. That is, the expected detection value b and the expected value μ of the voltage level of the input terminal by sampling are input to the determination circuit 213. The output side of the determination circuit 213 is connected to the input side of the selection switch 215. The determination circuit 213 determines the sampling status of the voltage level of the terminal voltage using the detection expected value b and the expected value μ, and outputs the determination result to the selection switch 215. The determination process in the determination circuit 213 will be described later.

選択スイッチ215は、サンプリング回路11へ出力するサンプリングクロックを選択する回路である。判定回路213における判定結果に応じてサンプリングクロックを切り換える回路である。選択スイッチ215の入力側には、基準サンプリングクロックと、分周回路211から出力されるサンプリングクロックとが入力される。選択スイッチ215の出力側は、サンプリング回路11と接続されている。選択スイッチ215は、判定回路213における判定結果に応じて、これらのサンプリングクロックからサンプリング回路11へ出力するサンプリングクロックを選択する。 The selection switch 215 is a circuit that selects a sampling clock to be output to the sampling circuit 11. This is a circuit that switches the sampling clock according to the determination result in the determination circuit 213. A reference sampling clock and a sampling clock output from the frequency divider circuit 211 are input to the input side of the selection switch 215. The output side of the selection switch 215 is connected to the sampling circuit 11. The selection switch 215 selects a sampling clock to be output from these sampling clocks to the sampling circuit 11 according to the determination result in the determination circuit 213.

<サンプリングクロックの選択>
次に、サンプリングクロックの選択方法について説明する。図9は、サンプリングクロックの切り換え動作を説明する図である。図9には、ハイレベル検知の例が示されている。図9(a)は、サンプリングクロックの切り換えを行わない場合のサンプリング動作を示す図である。具体的には、図9(a)は、実施の形態1〜2のデジタルフィルタ1、101における処理を示している。図9(b)は、サンプリングクロックの切り換えを行う場合のサンプリング動作を示す図である。すなわち、図9(b)は、本実施の形態のデジタルフィルタ201における処理を示している。
<Selection of sampling clock>
Next, a method of selecting a sampling clock will be described. FIG. 9 is a diagram illustrating a sampling clock switching operation. FIG. 9 shows an example of high level detection. FIG. 9A is a diagram showing a sampling operation when the sampling clock is not switched. Specifically, FIG. 9A shows the processing in the digital filters 1 and 101 of the first and second embodiments. FIG. 9B is a diagram showing a sampling operation when switching the sampling clock. That is, FIG. 9B shows the processing in the digital filter 201 of the present embodiment.

図9の縦軸は、サンプリングした電圧レベルを示し、図9の横軸は、時間を示している。また、図9(a)、(b)に示すそれぞれの矢印は、サンプリングされたタイミングを示している。隣り合う矢印の時間差は、サンプリング周期を示す。 The vertical axis of FIG. 9 shows the sampled voltage level, and the horizontal axis of FIG. 9 shows the time. Further, the respective arrows shown in FIGS. 9A and 9B indicate the sampling timing. The time difference between the adjacent arrows indicates the sampling period.

図9(a)、(b)では、時刻t0でサンプリングが開始されたのち、時刻t1でハイレベルがサンプリングされるまで、ローレベルが連続してサンプリングされている。そして、時刻t1以降は、連続してハイレベルが連続してサンプリングされている。 In FIGS. 9A and 9B, after the sampling is started at time t0, the low level is continuously sampled until the high level is sampled at time t1. Then, after the time t1, the high level is continuously sampled.

図9(a)は、同一のサンプリングクロックを用いてサンプリングされている。すなわち、等間隔のタイミングでサンプリングが行われている。時刻t1以降はハイレベルが検出され、時刻t2において、端子電圧の電圧レベルの期待値及び標準偏差が式(3)の条件を満たし、ハイレベル検知が完了する。 FIG. 9A is sampled using the same sampling clock. That is, sampling is performed at equal intervals. The high level is detected after the time t1, and at the time t2, the expected value and the standard deviation of the voltage level of the terminal voltage satisfy the condition of the equation (3), and the high level detection is completed.

一方、本実施の形態では、図9(b)に示すように、ローレベルが検出されている期間、及び時刻t1においてハイレベルが検出されてからも、ある程度の期間、続けてハイレベルがサンプリングされる時刻t3まで、図9(a)よりも周波数が低いサンプリングクロック(分周されたサンプリングクロック)が用いられる。そして、時刻t3以降は、これまでより周波数が高いサンプリングクロック(基準サンプリングクロック)が選択され、選択されたサンプリングクロックによりサンプリングが行われる。そして、時刻t4において、端子電圧の電圧レベルの期待値及び標準偏差が式(3)の条件を満たし、ハイレベル検知が完了する。すなわち、本実施の形態では、ハイレベルが検出されてからもある程度、ハイレベルの比率が高まるまでは、周波数を抑えたサンプリングクロックによりサンプリングが行われ、ハイレベルが所定の比率まで高まると、周波数を高くしたサンプリングクロックによりサンプリングが行われる。 On the other hand, in the present embodiment, as shown in FIG. 9B, the high level is continuously sampled for a certain period after the low level is detected and the high level is detected at time t1. Until the time t3, a sampling clock (divided sampling clock) having a frequency lower than that in FIG. 9A is used. Then, after time t3, a sampling clock (reference sampling clock) having a higher frequency than before is selected, and sampling is performed by the selected sampling clock. Then, at time t4, the expected value and standard deviation of the voltage level of the terminal voltage satisfy the condition of the equation (3), and the high level detection is completed. That is, in the present embodiment, sampling is performed by a sampling clock that suppresses the frequency until the high level ratio increases to some extent even after the high level is detected, and when the high level increases to a predetermined ratio, the frequency Sampling is performed by a sampling clock with a higher frequency.

判定回路213の動作を具体的に説明する。判定回路213は、第1閾値設定レジスタ43に設定された検知期待値bと、μ値演算回路21において算出された端子電圧の電圧レベルの期待値μとを用い、例えば次に示す式(9)、(10)を用いて、サンプリングクロックの切り換え判定を行う。 The operation of the determination circuit 213 will be specifically described. The determination circuit 213 uses the expected detection value b set in the first threshold value setting register 43 and the expected value μ of the voltage level of the terminal voltage calculated in the μ value calculation circuit 21, for example, the following equation (9). ) And (10) are used to determine the switching of the sampling clock.

μ<(50+b)/2 ・・・(9)
μ≧(50+b)/2 ・・・(10)
例えば、検出期待値bが95%に設定されているとする。ハイレベルの割合が(50+95)/2=72.5%未満のとき、期待値μは式(9)を満たすが、式(10)を満たしていない。これは、図9(b)の時刻t0からt3までの状態を示している。この場合、判定回路213は、期待値μが高まっていないと判定し、判定結果を選択スイッチ215へ出力する。選択スイッチ215は、この判定結果を受けて、サンプリングクロックの切り換えを行わず、例えば分周されたサンプリングクロックを継続して出力する。
μ <(50 + b) / 2 ... (9)
μ ≧ (50 + b) / 2 ・ ・ ・ (10)
For example, it is assumed that the expected detection value b is set to 95%. When the high level ratio is less than (50 + 95) / 2 = 72.5%, the expected value μ satisfies equation (9) but not equation (10). This shows the state from time t0 to t3 in FIG. 9B. In this case, the determination circuit 213 determines that the expected value μ has not increased, and outputs the determination result to the selection switch 215. Upon receiving this determination result, the selection switch 215 does not switch the sampling clock, and continuously outputs, for example, the divided sampling clock.

一方、ハイレベルの割合が(50+95)/2=72.5%以上のとき、期待値μは、式(10)を満たす。これは、図9(b)の時刻t3以降の状態を示している。この場合、判定回路213は、期待値μが十分高まったと判定し、判定結果を選択スイッチ215へ出力する。選択スイッチ215は、この判定結果を受けて、周波数が高いサンプリングクロック(例えば、基準サンプリングクロック)を選択し、選択したサンプリングクロックをサンプリング回路11へ出力する。そして、サンプリングを高速化して入力信号の検出処理が行われる。 On the other hand, when the high level ratio is (50 + 95) / 2 = 72.5% or more, the expected value μ satisfies the equation (10). This shows the state after the time t3 in FIG. 9B. In this case, the determination circuit 213 determines that the expected value μ has sufficiently increased, and outputs the determination result to the selection switch 215. Upon receiving this determination result, the selection switch 215 selects a sampling clock having a high frequency (for example, a reference sampling clock), and outputs the selected sampling clock to the sampling circuit 11. Then, the sampling speed is increased and the input signal detection process is performed.

ここでは、サンプリングクロックの切り換え判定の基準となる判定基準が(50+b)/2のみであったが、判定基準を細分化し、各判定基準に応じたサンプリングクロックが選択されてもよい。 Here, the criterion for switching the sampling clock is only (50 + b) / 2, but the criterion may be subdivided and a sampling clock corresponding to each criterion may be selected.

なお、ローレベル検知では、電圧レベルが反転するだけであり、動作内容はハイレベル検知と同様である。 In low level detection, only the voltage level is inverted, and the operation content is the same as in high level detection.

本実施の形態によれば、入力端子P1の端子電圧の電圧レベルのサンプリング状況に応じて、周波数の異なるサンプリングクロックを切り換える。この構成によれば、入力検出レベルがサンプリングされる割合が高まるまでは、サンプリングクロックの周波数が抑えられるので、入力信号の検出に関わる消費電力が低減される。例えば、分周回路211における分周比が2分周であり、時刻t0から時刻t1までの期間が、時刻t1から入力信号が検出されるまでの期間と比べて十分に長い場合には、入力信号の検出に関わる消費電力は、実施の形態1、2の約2分の1程度にまで抑えられる。 According to this embodiment, sampling clocks having different frequencies are switched according to the sampling status of the voltage level of the terminal voltage of the input terminal P1. According to this configuration, the frequency of the sampling clock is suppressed until the rate at which the input detection level is sampled increases, so that the power consumption related to the detection of the input signal is reduced. For example, when the frequency division ratio in the frequency divider circuit 211 is 2 divisions and the period from time t0 to time t1 is sufficiently longer than the period from time t1 to the detection of the input signal, the input is input. The power consumption related to signal detection is suppressed to about half that of the first and second embodiments.

また、本実施の形態によれば、分周回路211は、それぞれ周波数が異なる複数のサンプリングクロックを生成し、判定回路213は、期待値μの判定基準を細分化する。この構成によれば、期待値μの値に応じて、サンプリングクロックをこまめに切り換えることが可能となる。これにより、消費電力を抑えつつ、入力信号の検出を短時間で行うことが可能となる。 Further, according to the present embodiment, the frequency dividing circuit 211 generates a plurality of sampling clocks having different frequencies, and the determination circuit 213 subdivides the determination criteria of the expected value μ. According to this configuration, it is possible to frequently switch the sampling clock according to the value of the expected value μ. As a result, it is possible to detect the input signal in a short time while suppressing the power consumption.

(実施の形態4)
次に、実施の形態4について説明する。実施の形態4では、実施の形態1〜3のようなベイズ統計を用いた統計処理を行うことなく、入力信号の検出を行うデジタルフィルタについて説明する。
(Embodiment 4)
Next, the fourth embodiment will be described. In the fourth embodiment, a digital filter that detects an input signal without performing statistical processing using Bayesian statistics as in the first to third embodiments will be described.

図10は、本発明の実施の形態4に係るデジタルフィルタの構成の一例を示す回路図である。図10のデジタルフィル301は、サンプリング回路11、サンプリングカウンタ310、判定処理部330、判定条件設定レジスタ340等を備えている。 FIG. 10 is a circuit diagram showing an example of the configuration of the digital filter according to the fourth embodiment of the present invention. The digital fill 301 of FIG. 10 includes a sampling circuit 11, a sampling counter 310, a determination processing unit 330, a determination condition setting register 340, and the like.

サンプリングカウンタ310は、インバータ17、選択スイッチ319、第3加算器313、第3サンプリング回数レジスタ315を有する。インバータ17の入力側は、サンプリング回路11の出力側と接続されている。選択スイッチ319の入力側は、サンプリング回路11の出力側及びインバータ17の出力側と接続されている。また、選択スイッチ319の入力側は、入力検出レベル設定レジスタ41の出力側と接続されている。
選択スイッチ319の出力側は、第3加算器313の入力側と接続されている。第3加算器313の出力側は、第3サンプリング回数レジスタ315の入力側と接続されている。第3サンプリング回数レジスタ315の出力側は、第3加算器313の入力側及び判定処理部330のz値判定回路331と接続されている。
The sampling counter 310 includes an inverter 17, a selection switch 319, a third adder 313, and a third sampling number register 315. The input side of the inverter 17 is connected to the output side of the sampling circuit 11. The input side of the selection switch 319 is connected to the output side of the sampling circuit 11 and the output side of the inverter 17. Further, the input side of the selection switch 319 is connected to the output side of the input detection level setting register 41.
The output side of the selection switch 319 is connected to the input side of the third adder 313. The output side of the third adder 313 is connected to the input side of the third sampling count register 315. The output side of the third sampling number register 315 is connected to the input side of the third adder 313 and the z value determination circuit 331 of the determination processing unit 330.

インバータ17は、論理反転させたサンプリングデータを生成し、選択スイッチ319へ出力する。選択スイッチ319は、サンプリングデータ、及び入力検出レベル設定レジスタ41に設定された入力検出レベルの設定値aに基づく所定の信号を出力する回路である。選択スイッチ319は、例えば、設定値aに対応するサンプリングデータが入力されると、ハイレベルの信号を出力し、設定値aに対応しないサンプリングデータが入力されるとローレベルの信号を出力する。なお、入力検出レベルの設定値aが、ハイレベル及びローレベルのいずれに対応する値であっても、設定値aに対応するサンプリングデータが入力されれば、選択スイッチ319はハイレベルの信号を出力する。 The inverter 17 generates the logically inverted sampling data and outputs it to the selection switch 319. The selection switch 319 is a circuit that outputs sampling data and a predetermined signal based on the input detection level setting value a set in the input detection level setting register 41. For example, the selection switch 319 outputs a high-level signal when sampling data corresponding to the set value a is input, and outputs a low-level signal when sampling data not corresponding to the set value a is input. Regardless of whether the input detection level setting value a corresponds to either the high level or the low level, if the sampling data corresponding to the setting value a is input, the selection switch 319 outputs a high level signal. Output.

第3加算器313は、設定値aに対応する電圧レベルのサンプリング回数(以下、zと表記する場合がある)をカウントする回路である。第3サンプリング回数レジスタ315は、設定値aに対応する電圧レベルのサンプリング回数zを格納するレジスタである。具体的に述べると、第3加算器313は、選択スイッチ319からハイレベルの信号が出力されると、直前のサンプリング回数zに1を加算し、サンプリング回数zの値を更新する。一方、第3加算器313は、選択スイッチ319からローレベルの信号が出力されると、直前のサンプリング回数zを更新しない。第3サンプリング回数レジスタ315は、格納しているサンプリング回数zをz値判定回路331へ出力する。 The third adder 313 is a circuit that counts the number of sampling times (hereinafter, may be referred to as z) of the voltage level corresponding to the set value a. The third sampling count register 315 is a register that stores the sampling count z of the voltage level corresponding to the set value a. Specifically, when a high-level signal is output from the selection switch 319, the third adder 313 adds 1 to the immediately preceding sampling number z and updates the value of the sampling number z. On the other hand, the third adder 313 does not update the immediately preceding sampling number z when a low-level signal is output from the selection switch 319. The third sampling number register 315 outputs the stored sampling number z to the z value determination circuit 331.

判定処理部330は、z値判定回路331、入力判定結果レジスタ37、入力検出信号発生回路39を備えている。z値判定回路331は、入力信号に対応する電圧レベルのサンプリング回数zと、第1閾値bと、検知期間eにおけるサンプリング回数fとを用いて入力信号の検出を行う回路である。 The determination processing unit 330 includes a z-value determination circuit 331, an input determination result register 37, and an input detection signal generation circuit 39. The z-value determination circuit 331 is a circuit that detects an input signal by using the number of samplings z of the voltage level corresponding to the input signal, the first threshold value b, and the number of samplings f in the detection period e.

z値判定回路331の入力側は、第3サンプリング回数レジスタ315の出力側、第1閾値設定レジスタ43の出力側、サンプリング回数設定レジスタ347の出力側と接続されている。z値判定回路331の出力側は、入力判定結果レジスタ37の入力側と接続されている。入力判定結果レジスタ37の出力側は、入力検出信号発生回路39の入力側と接続されている。z値判定回路331による判定処理については、後述する。 The input side of the z-value determination circuit 331 is connected to the output side of the third sampling count register 315, the output side of the first threshold setting register 43, and the output side of the sampling count setting register 347. The output side of the z-value determination circuit 331 is connected to the input side of the input determination result register 37. The output side of the input determination result register 37 is connected to the input side of the input detection signal generation circuit 39. The determination process by the z-value determination circuit 331 will be described later.

判定条件設定レジスタ340は、入力検出レベル設定レジスタ41、第1閾値設定レジスタ43、検知反応時間レジスタ141、演算回路143、145、サンプリング回数設定レジスタ347を備えている。なお、演算回路143、145は、接続関係を考慮し、判定条件設定レジスタ340に設けられているが、判定条件設定レジスタ340の外に設けられてもよい。入力検出レベル設定レジスタ41、第1閾値設定レジスタ43、検知反応時間レジスタ141、演算回路143、145については、すでに述べているので、接続関係の相違点についてのみ説明する。演算回路145の出力側は、サンプリング回数設定レジスタ347の入力側と接続されている。したがって、演算回路145は、算出したサンプリング回数fをサンプリング回数設定レジスタ347へ出力する。サンプリング回数設定レジスタ347は、演算回路145で算出されたサンプリング回数fを格納し、z値判定回路331へ出力する。 The determination condition setting register 340 includes an input detection level setting register 41, a first threshold value setting register 43, a detection reaction time register 141, an arithmetic circuit 143, 145, and a sampling number setting register 347. Although the arithmetic circuits 143 and 145 are provided in the determination condition setting register 340 in consideration of the connection relationship, they may be provided outside the determination condition setting register 340. Since the input detection level setting register 41, the first threshold value setting register 43, the detection reaction time register 141, and the arithmetic circuits 143 and 145 have already been described, only the differences in the connection relationship will be described. The output side of the arithmetic circuit 145 is connected to the input side of the sampling count setting register 347. Therefore, the arithmetic circuit 145 outputs the calculated sampling number f to the sampling number setting register 347. The sampling number setting register 347 stores the sampling number f calculated by the arithmetic circuit 145 and outputs it to the z value determination circuit 331.

<ハイレベルの入力信号の検出処理>
次に、本実施の形態における入力信号の検出処理について説明する。図11は、本発明の実施の形態4に係る入力信号の検出処理の一例を示すフロー図である。なお、図11は、入力検出レベルがハイレベルであるハイレベル検知に関わるフローである。図11のフローは、ステップS41〜S51を含む。
<High-level input signal detection processing>
Next, the input signal detection process in the present embodiment will be described. FIG. 11 is a flow chart showing an example of an input signal detection process according to the fourth embodiment of the present invention. Note that FIG. 11 is a flow related to high level detection in which the input detection level is high. The flow of FIG. 11 includes steps S41-S51.

ステップS41では、入力検出レベル設定レジスタ41の設定値a、第1閾値設定レジスタ43の検知期待値bが設定される。例えば、入力検出レベル設定レジスタ41の設定値は、ハイレベルに対応する値(a=1)に設定される。ステップS42では、検知反応時間レジスタ141の検知反応時間dがユーザにより設定される。なお、ステップS42の処理は、ステップS41において行われてもよい。 In step S41, the set value a of the input detection level setting register 41 and the expected detection value b of the first threshold value setting register 43 are set. For example, the set value of the input detection level setting register 41 is set to a value (a = 1) corresponding to the high level. In step S42, the detection reaction time d of the detection reaction time register 141 is set by the user. The process of step S42 may be performed in step S41.

ステップS43では、サンプリング回数設定レジスタ347にサンプリング回数fが設定される。検知反応時間レジスタ141に検知反応時間dが設定されると、演算回路143は、実施の形態2の式(5)を用いて入力信号の検知期間eを算出する。そして、演算回路145は、演算回路143で算出された検知期間eを用いて実施の形態2と同様にサンプリング回数fを算出し、サンプリング回数設定レジスタ347に格納する。 In step S43, the sampling number f is set in the sampling number setting register 347. When the detection reaction time d is set in the detection reaction time register 141, the arithmetic circuit 143 calculates the detection period e of the input signal using the equation (5) of the second embodiment. Then, the arithmetic circuit 145 calculates the sampling number f in the same manner as in the second embodiment using the detection period e calculated by the arithmetic circuit 143, and stores it in the sampling number setting register 347.

ステップS44では、第3サンプリング回数レジスタ315に格納されるサンプリング回数zが初期化される。ステップS45では、入力端子P1の端子電圧のサンプリングが行われる。ステップS45は、図2のステップS13と同様である。また、ステップS45では、検知期間eにおけるサンプリング回数をカウントする。カウントしたサンプリング回数は、例えば図示しないレジスタに格納されてもよいし、ラッチ回路等で保持されてもよい。 In step S44, the sampling number z stored in the third sampling number register 315 is initialized. In step S45, the terminal voltage of the input terminal P1 is sampled. Step S45 is the same as step S13 of FIG. Further, in step S45, the number of samplings in the detection period e is counted. The counted number of samplings may be stored in a register (not shown), or may be held by a latch circuit or the like.

ステップS46では、サンプリングされた端子電圧の信号レベルが判定される。サンプリングされた端子電圧が、入力検出レベルであるハイレベルであると判定された場合、ステップS47の処理が実行される。ステップS47では、選択スイッチ319は、ハイレベルの信号を出力する。第3加算器313は、選択スイッチ319から出力されたハイレベルの信号に対応して、入力検出レベルのサンプリング回数をzからz+1に更新し、更新したサンプリング回数を第3サンプリング回数レジスタ315に格納する。 In step S46, the signal level of the sampled terminal voltage is determined. When it is determined that the sampled terminal voltage is a high level which is an input detection level, the process of step S47 is executed. In step S47, the selection switch 319 outputs a high level signal. The third adder 313 updates the sampling count of the input detection level from z to z + 1 in response to the high level signal output from the selection switch 319, and stores the updated sampling count in the third sampling count register 315. To do.

ステップS49では、z値判定回路331は、入力信号に対応する電圧レベル、すなわち入力検出レベルのサンプリング回数zと、検知期待値bと、検知期間eにおけるサンプリング回数fとを用いて入力信号の検出を行う。具体的に述べると、z値判定回路331は、まず、検知期間eにおけるサンプリング回数fと検知期待値bとの積(fb)を算出する。そして、z値判定回路331は、入力検出レベルのサンプリング回数zと積fbとを比較する。これらの値が、次に示す式(11)の条件を満たす場合、z値判定回路331は、端子電圧の真の電圧レベルが入力検出レベル(ハイレベル)であると判定し、例えば、ハイレベルの入力検出信号を出力する。 In step S49, the z-value determination circuit 331 detects the input signal using the voltage level corresponding to the input signal, that is, the sampling number z of the input detection level, the expected detection value b, and the sampling number f in the detection period e. I do. Specifically, the z-value determination circuit 331 first calculates the product (fb) of the number of samplings f and the expected detection value b in the detection period e. Then, the z value determination circuit 331 compares the sampling number z of the input detection level with the product fb. When these values satisfy the condition of the following equation (11), the z value determination circuit 331 determines that the true voltage level of the terminal voltage is the input detection level (high level), for example, the high level. Input detection signal is output.

z>bf ・・・(11)
式(11)は、検知期間eにおけるf回のサンプリングのうち、入力検出レベル(ハイレベル)のサンプリング回数zが、b%より高い確率でサンプリングされた場合には、入力信号が検出されたと判定されることを示している。
z> bf ・ ・ ・ (11)
Equation (11) determines that the input signal has been detected when the sampling frequency z of the input detection level (high level) is sampled with a probability higher than b% among the f samplings in the detection period e. It shows that it will be done.

そして、ステップS50の処理が実行される。ステップS50は、図2のステップS19と同様であるので、説明は省略する。そして、入力信号の検出処理は終了する。 Then, the process of step S50 is executed. Since step S50 is the same as step S19 of FIG. 2, the description thereof will be omitted. Then, the input signal detection process ends.

ステップS49において、入力検出レベルのサンプリング回数z及び積fbが式(11)の条件を満たさない場合、z値判定回路331は、端子電圧の真の電圧レベルが入力検出レベル(ハイレベル)ではないと判定し、例えば、ローレベルの入力検出信号を出力する。 In step S49, when the number of samplings z and the product fb of the input detection level do not satisfy the condition of the equation (11), the z value determination circuit 331 does not have the true voltage level of the terminal voltage as the input detection level (high level). For example, a low-level input detection signal is output.

そして、ステップS51の処理が行われる。ステップS51では、検知期間eにおけるサンプリング回数がf回に達したかどうかが判定される。サンプリング回数がf回に達していなければ、ステップS45の処理が再度行われる。これに対し、サンプリング回数がf回に達していれば、ステップS44に戻り、第3サンプリング回数レジスタに格納された値が0に初期化される。また、検知期間eにおけるサンプリング回数も0に初期化される。 Then, the process of step S51 is performed. In step S51, it is determined whether or not the number of samplings in the detection period e has reached f times. If the number of samplings has not reached f, the process of step S45 is repeated. On the other hand, if the number of samplings reaches f, the process returns to step S44, and the value stored in the third sampling number register is initialized to 0. Further, the number of samplings in the detection period e is also initialized to 0.

一方、ステップS46において、サンプリングされた端子電圧が、入力検出レベルであるハイレベルではないと判定された場合、ステップS48の処理が実行される。ステップS48では、選択スイッチ319は、ローレベルの信号を出力する。この場合、第3加算器313は、入力検出レベルのサンプリング回数の更新を行わない。すなわち、サンプリング回数はzのままである。そして、ステップS51の処理が行われる。 On the other hand, in step S46, when it is determined that the sampled terminal voltage is not the high level which is the input detection level, the process of step S48 is executed. In step S48, the selection switch 319 outputs a low level signal. In this case, the third adder 313 does not update the number of samplings of the input detection level. That is, the number of samplings remains z. Then, the process of step S51 is performed.

<ローレベルの入力信号の検出処理>
次に、入力検出レベルがローレベルであるローレベル検知について説明する。図12は、本発明の実施の形態4に係るローレベルの入力信号の検出処理の一例を示すフロー図である。なお、図12は、図11と類似しているため、図11との相違点を中心に説明する。
<Low-level input signal detection processing>
Next, low level detection in which the input detection level is low level will be described. FIG. 12 is a flow chart showing an example of low-level input signal detection processing according to the fourth embodiment of the present invention. Since FIG. 12 is similar to FIG. 11, the differences from FIG. 11 will be mainly described.

ステップS41では、例えば、入力検出レベル設定レジスタ41の設定値は、ローレベルに対応する値(a=0)に設定される。なお、ここでは、第1閾値設定レジスタ43に設定される検知期待値bは、入力検出レベルであるローレベルの検知期待値であるとする。 In step S41, for example, the set value of the input detection level setting register 41 is set to a value (a = 0) corresponding to the low level. Here, it is assumed that the expected detection value b set in the first threshold value setting register 43 is a low-level detection expected value which is an input detection level.

ステップS46では、サンプリングされた端子電圧が、入力検出レベルであるローレベルであるかどうかが判定される。サンプリングされた端子電圧が、ローレベルであると判定された場合、ステップS47の処理が実行される。一方、サンプリングされた端子電圧が、入力検出レベルでないハイレベルであると判定された場合、ステップS48の処理が実行される。 In step S46, it is determined whether or not the sampled terminal voltage is at the low level, which is the input detection level. If it is determined that the sampled terminal voltage is low level, the process of step S47 is executed. On the other hand, when it is determined that the sampled terminal voltage is a high level other than the input detection level, the process of step S48 is executed.

本実施の形態によれば、z値判定回路331は、入力信号に対応する電圧レベルのサンプリング回数zと、検知期待値bと、検知期間eにおけるサンプリング回数fと、を用いて入力信号の検出を行う。この構成によれば、電圧レベルごとのサンプリング回数を用いた統計処理行う必要がなくなり、回路構成が簡略化される。また、この構成によれば、ユーザが理解しやすい判定条件を用いた入力信号の検出を行うことが可能となる。 According to the present embodiment, the z value determination circuit 331 detects the input signal by using the sampling number z of the voltage level corresponding to the input signal, the expected detection value b, and the sampling number f in the detection period e. I do. According to this configuration, it is not necessary to perform statistical processing using the number of samplings for each voltage level, and the circuit configuration is simplified. Further, according to this configuration, it is possible to detect the input signal using the determination conditions that are easy for the user to understand.

以上、本発明者によってなされた発明を実施の形態に基づき具体的に説明したが、本発明は前記実施の形態に限定されるものではなく、その要旨を逸脱しない範囲で種々変更可能であることはいうまでもない。 Although the invention made by the present inventor has been specifically described above based on the embodiment, the present invention is not limited to the embodiment and can be variously modified without departing from the gist thereof. Needless to say.

1、101、201、301…デジタルフィルタ、10、310…サンプリングカウンタ、11…サンプリング回路、20…統計処理部、30、330…判定処理部、40、340…判定条件設定レジスタ、140…判定条件設定回路、210…サンプリングクロック選択回路、P1…入力端子 1, 101, 201, 301 ... Digital filter, 10, 310 ... Sampling counter, 11 ... Sampling circuit, 20 ... Statistical processing unit, 30, 330 ... Judgment processing unit, 40, 340 ... Judgment condition setting register, 140 ... Judgment condition Setting circuit, 210 ... Sampling clock selection circuit, P1 ... Input terminal

Claims (18)

入力端子の端子電圧のサンプリングにおいて、電圧レベルごとに前記端子電圧のサンプリング回数をカウントするサンプリングカウンタと、
前記電圧レベルごとの前記サンプリング回数を用いて前記端子電圧の統計処理を行う統計処理部と、
統計処理結果を用いて入力信号の検出を行い、前記入力信号を検出すると入力検出信号を出力する判定処理部と、
を備えている、
デジタルフィルタ。
In sampling the terminal voltage of the input terminal, a sampling counter that counts the number of samplings of the terminal voltage for each voltage level and
A statistical processing unit that performs statistical processing of the terminal voltage using the number of samplings for each voltage level, and
A judgment processing unit that detects an input signal using the statistical processing result and outputs an input detection signal when the input signal is detected.
Is equipped with
Digital filter.
請求項1に記載のデジタルフィルタにおいて、
前記統計処理部は、前記統計処理結果として、前記端子電圧の前記電圧レベルの期待値及び標準偏差を算出する、
デジタルフィルタ。
In the digital filter according to claim 1,
The statistical processing unit calculates the expected value and standard deviation of the voltage level of the terminal voltage as the statistical processing result.
Digital filter.
請求項2に記載のデジタルフィルタにおいて、
前記統計処理部は、算出した前記期待値及び前記標準偏差を用いたベイズ統計により前記統計処理を行う、
デジタルフィルタ。
In the digital filter according to claim 2,
The statistical processing unit performs the statistical processing by Bayesian statistics using the calculated expected value and the standard deviation.
Digital filter.
請求項2に記載のデジタルフィルタにおいて、
前記入力信号の検出に関する判定条件を格納する判定条件設定レジスタを備え、
前記判定処理部は、前記統計処理結果と前記判定条件とを用いて前記入力信号を検出する、
デジタルフィルタ。
In the digital filter according to claim 2,
A judgment condition setting register for storing a judgment condition related to the detection of the input signal is provided.
The determination processing unit detects the input signal using the statistical processing result and the determination condition.
Digital filter.
請求項4に記載のデジタルフィルタにおいて、
前記判定条件は、前記入力信号の電圧レベルを示す入力検出レベルと、前記端子電圧の真の電圧レベルの判定に用いられる第1閾値と、前記端子電圧の前記電圧レベルのばらつきの判定に用いられる第2閾値と、を含む、
デジタルフィルタ。
In the digital filter according to claim 4,
The determination conditions are used for determining an input detection level indicating the voltage level of the input signal, a first threshold value used for determining the true voltage level of the terminal voltage, and a variation in the voltage level of the terminal voltage. Including the second threshold,
Digital filter.
請求項5に記載のデジタルフィルタにおいて、
前記判定処理部は、前記端子電圧の前記電圧レベルの前記期待値と前記第1閾値とを比較し、前記端子電圧の前記真の電圧レベルが前記入力検出レベルであると判定し、かつ、前記端子電圧の前記電圧レベルの前記標準偏差が前記第2閾値未満であると判定したとき、前記入力検出信号を出力する、
デジタルフィルタ。
In the digital filter according to claim 5,
The determination processing unit compares the expected value of the voltage level of the terminal voltage with the first threshold value, determines that the true voltage level of the terminal voltage is the input detection level, and said When it is determined that the standard deviation of the voltage level of the terminal voltage is less than the second threshold value, the input detection signal is output.
Digital filter.
請求項4に記載のデジタルフィルタにおいて、
前記判定条件設定レジスタに格納される前記判定条件を設定する判定条件設定回路を備えている、
デジタルフィルタ。
In the digital filter according to claim 4,
A judgment condition setting circuit for setting the judgment condition stored in the judgment condition setting register is provided.
Digital filter.
請求項7に記載のデジタルフィルタにおいて、
前記判定条件設定回路は、前記入力信号の電圧レベルを示す入力検出レベルと、前記端子電圧の真の電圧レベルの判定に用いられる第1閾値と、前記端子電圧の前記電圧レベルのばらつきの判定に用いられる第2閾値と、を設定する、
デジタルフィルタ。
In the digital filter according to claim 7,
The determination condition setting circuit determines an input detection level indicating the voltage level of the input signal, a first threshold value used for determining the true voltage level of the terminal voltage, and a variation in the voltage level of the terminal voltage. Set the second threshold to be used,
Digital filter.
請求項7に記載のデジタルフィルタにおいて、
前記判定条件設定回路は、前記入力信号に対する検知反応時間を設定する検知反応時間レジスタを備えている、
デジタルフィルタ。
In the digital filter according to claim 7,
The determination condition setting circuit includes a detection reaction time register that sets a detection reaction time for the input signal.
Digital filter.
請求項9に記載のデジタルフィルタにおいて、
前記判定条件設定回路は、前記検知反応時間及び前記入力端子の前記端子電圧のサンプリング周期を用い、所定の回数連続で同一の電圧レベルがサンプリングされたときの期待値を前記端子電圧の真の電圧レベルの判定に用いられる第1閾値として算出し、所定の回数連続で同一の電圧レベルがサンプリングされたときの標準偏差を前記端子電圧の前記電圧レベルのばらつきの判定に用いられる第2閾値として算出する、
デジタルフィルタ。
In the digital filter according to claim 9,
The determination condition setting circuit uses the detection reaction time and the sampling cycle of the terminal voltage of the input terminal, and sets the expected value when the same voltage level is sampled a predetermined number of times in succession as the true voltage of the terminal voltage. Calculated as the first threshold used to determine the level, and the standard deviation when the same voltage level is sampled a predetermined number of times in succession is calculated as the second threshold used to determine the variation in the voltage level of the terminal voltage. To do,
Digital filter.
請求項1に記載のデジタルフィルタにおいて、
前記入力端子の前記端子電圧のサンプリングのタイミングを規定するサンプリングクロックを選択するサンプリングクロック選択回路を備えている、
デジタルフィルタ。
In the digital filter according to claim 1,
A sampling clock selection circuit for selecting a sampling clock that defines the sampling timing of the terminal voltage of the input terminal is provided.
Digital filter.
請求項11に記載のデジタルフィルタにおいて、
前記サンプリングクロック選択回路は、基準サンプリングクロックを分周し、前記基準サンプリングクロックとは異なる周波数のサンプリングクロックを生成する分周回路と、
前記入力端子の前記端子電圧の電圧レベルのサンプリング状況を判定する判定回路と、
前記判定回路における判定結果に応じてサンプリングクロックを切り換えるスイッチ回路と、
を備えている、
デジタルフィルタ。
In the digital filter according to claim 11,
The sampling clock selection circuit divides the reference sampling clock and generates a sampling clock having a frequency different from that of the reference sampling clock.
A determination circuit that determines the sampling status of the voltage level of the terminal voltage of the input terminal, and
A switch circuit that switches the sampling clock according to the judgment result in the judgment circuit, and
Is equipped with
Digital filter.
請求項12に記載のデジタルフィルタにおいて、
前記判定回路は、前記端子電圧の真の電圧レベルの判定に用いられる第1閾値と、前記入力端子の前記端子電圧の電圧レベルの期待値とを用いて、前記端子電圧の電圧レベルのサンプリング状況を判定する、
デジタルフィルタ。
In the digital filter according to claim 12,
The determination circuit uses the first threshold value used for determining the true voltage level of the terminal voltage and the expected value of the voltage level of the terminal voltage of the input terminal to sample the voltage level of the terminal voltage. To judge,
Digital filter.
請求項12に記載のデジタルフィルタにおいて、
前記分周回路は、それぞれ周波数が異なる複数の前記サンプリングクロックを生成する、
デジタルフィルタ。
In the digital filter according to claim 12,
The frequency divider circuit generates a plurality of the sampling clocks having different frequencies.
Digital filter.
入力端子の端子電圧のサンプリングにおいて、入力信号に対応する電圧レベルのサンプリング回数をカウントするサンプリングカウンタと、
前記入力信号に対応する電圧レベルのサンプリング回数を用いて入力信号の検出を行い、前記入力信号を検出すると入力検出信号を出力する判定処理部と、
を備えている、
デジタルフィルタ。
In sampling the terminal voltage of the input terminal, a sampling counter that counts the number of samplings of the voltage level corresponding to the input signal, and
A determination processing unit that detects the input signal using the number of samplings of the voltage level corresponding to the input signal and outputs the input detection signal when the input signal is detected.
Is equipped with
Digital filter.
請求項15に記載のデジタルフィルタにおいて、
前記入力信号の検出に関する判定条件を格納する判定条件設定レジスタを備え、
前記判定処理部は、前記入力信号に対応する電圧レベルのサンプリング回数と、前記判定条件と、を用いて前記入力信号を検出する、
デジタルフィルタ。
In the digital filter according to claim 15,
A judgment condition setting register for storing a judgment condition related to the detection of the input signal is provided.
The determination processing unit detects the input signal using the number of samplings of the voltage level corresponding to the input signal and the determination condition.
Digital filter.
請求項16に記載のデジタルフィルタにおいて、
前記判定条件設定レジスタは、前記入力信号の電圧レベルを示す入力検出レベルを設定する入力検出レベル設定レジスタと、前記端子電圧の真の電圧レベルの判定に用いられる第1閾値を設定する第1閾値設定レジスタと、前記入力信号に対する検知反応時間を設定する検知反応時間レジスタと、前記検知反応時間を用いて算出される、検知期間におけるサンプリング回数を設定するサンプリング回数設定レジスタと、を備え、
前記判定処理部は、前記入力信号に対応する電圧レベルのサンプリング回数と、前記第1閾値と、前記検知期間におけるサンプリング回数と、を用いて前記入力信号の検出を行う、
デジタルフィルタ。
In the digital filter according to claim 16,
The determination condition setting register includes an input detection level setting register that sets an input detection level indicating the voltage level of the input signal, and a first threshold that sets a first threshold used for determining the true voltage level of the terminal voltage. It includes a setting register, a detection reaction time register that sets the detection reaction time for the input signal, and a sampling number setting register that sets the number of samplings in the detection period, which is calculated using the detection reaction time.
The determination processing unit detects the input signal using the number of samplings of the voltage level corresponding to the input signal, the first threshold value, and the number of samplings in the detection period.
Digital filter.
請求項1に記載のデジタルフィルタにおいて、
前記入力信号は、割り込み信号である、
デジタルフィルタ。
In the digital filter according to claim 1,
The input signal is an interrupt signal.
Digital filter.
JP2019031484A 2019-02-25 2019-02-25 Digital filter Pending JP2020137043A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019031484A JP2020137043A (en) 2019-02-25 2019-02-25 Digital filter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019031484A JP2020137043A (en) 2019-02-25 2019-02-25 Digital filter

Publications (1)

Publication Number Publication Date
JP2020137043A true JP2020137043A (en) 2020-08-31

Family

ID=72263678

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019031484A Pending JP2020137043A (en) 2019-02-25 2019-02-25 Digital filter

Country Status (1)

Country Link
JP (1) JP2020137043A (en)

Similar Documents

Publication Publication Date Title
US6038649A (en) Address generating circuit for block repeat addressing for a pipelined processor
JP6812781B2 (en) Delay circuit, count value generation circuit and physical quantity sensor
US8874978B2 (en) Information processing apparatus, information processing system, controlling method for information processing apparatus and program
WO1994012983A1 (en) Look ahead flag for fifo
US9673794B2 (en) Noise analysis apparatus, electronic device, and noise-source identification system
KR20030017527A (en) Baud rate generator with fractional devider
US20020008548A1 (en) Device for detecting abnormality of clock signal
JP2020137043A (en) Digital filter
KR20190107431A (en) Pwm apparatus with improved resolution
JP4686420B2 (en) Sampling data averaging circuit
JP2006318002A (en) Clock frequency-dividing circuit
CN107247819B (en) Filtering method and filter for sensor
US10756716B2 (en) Electronic device and noise removal system
CN115632653A (en) Phase discrimination method, phase discriminator, clock recovery module, ethernet chip and vehicle
CN113346877B (en) Clock period detection method and circuit based on dichotomy
US10802656B2 (en) Touch sensor circuit
US7743272B1 (en) Methods and apparatus for generating precise timing information using progressive block averaging
EP4329196A1 (en) Entropy source circuit and entropy value generation method
JP4215748B2 (en) Digital signal output apparatus and digital signal output method
JP2010206603A (en) Delay generator and ic tester
JPH06104741A (en) Didital pll device
KR200431691Y1 (en) The pulse generation time comparator
KR0174707B1 (en) Clock generator
JP2021007224A (en) Delay circuit, count value generation circuit and physical quantity sensor
CN114297968A (en) Signal de-bouncing method and device, electronic equipment and readable storage medium