CN103631161A - Filtering method based on state machine - Google Patents
Filtering method based on state machine Download PDFInfo
- Publication number
- CN103631161A CN103631161A CN201310424881.5A CN201310424881A CN103631161A CN 103631161 A CN103631161 A CN 103631161A CN 201310424881 A CN201310424881 A CN 201310424881A CN 103631161 A CN103631161 A CN 103631161A
- Authority
- CN
- China
- Prior art keywords
- state
- output
- width
- signal
- low level
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
A digital filtering technology applying and detecting transient pulses in signals uses a CPLD as hardware to detect the width of transient pulses in signals, filter small-width pulses and output wide pulses through a state-machine-based method under the drive of a high-frequency clock. According to the method, an appropriate filter width n is selected first, and the number of states of the state machine is S0-Sn. When the width after signal mutation is within a filter width range and if an output signal is not consistent with an input signal, the state machine is switched from the state S(k-1) to Sk, namely, the accumulated width after signal mutation is added with 1, or the state machine returns to the state S0, and at the moment, output is consistent with historical output. When the width after signal mutation is not within the filter width range and if the output signal is not consistent with the input signal, the state machine is switched from the state Sn to the state S0, and at the moment, the output signal is consistent with the input signal. The filtering method based on the state machine has been applied to speed detection of a military vehicle and has achieved the expected effect.
Description
Technical field:
The invention belongs to a kind of digital filtering technique, in software, the data that collect are eliminated to the processing of disturbing.
Background technology
When test macro obtains data from the external world, severe due to working site environment, usually has adding of some random disturbance, noise signal.Some undesired signal is often irregular, so just to test macro, has brought error.In order to overcome these errors, except hardware filtering, also have digital filtering, by certain calculation procedure, the data that gather are carried out to certain processing, thereby eliminate or weaken the impact of interference noise.Digital filtering is realized by software algorithm, compares with hardware filtering, does not need to increase hardware device, only need before program enters control algolithm, add the program of a piece of digital filtering.At present, SCM Based digital filtering method has a variety of, and classical has: arithmetic mean law is the different time sampling in one-period, then asks its mean value, and this method can effectively be eliminated the interference of preiodic type; Median filtering method, is that the variate-value in several cycles that collect is sorted, and then gets the intermediate value of the value that sequences order, and this method can effectively prevent that the data that are subject to bursty interference from entering.But these methods all could not effectively solve the filtering of square-wave signal in speed of a motor vehicle detection at present.
Summary of the invention
The invention provides a kind of digital filtering technique can be used in industrial controlling software.This technology is under high frequency clock drives, and by transient pulse width in the method detection signal of state machine, the pulse that filtering width is short, exports broad pulse.The present invention has applied to the speed of a motor vehicle of certain military vehicle and has processed, and obtains better effects.
In the speed of a motor vehicle detects, for obtaining the accurate speed of a motor vehicle, need to process the signal period collecting.The measurement in cycle does not need to obtain the accurate numerical value of external signal, only needs to export 1 when the signal collecting is high level, during for low level, exports 0.But in actual acquisition process, due to the deficiency of collecting device self and the interference of environment, inevitably can produce various burrs, the measuring accuracy in cycle is affected.In order to address this problem, the present invention proposes the filtering method based on state machine.The thought of the method is, supposes that the width of burr is less than filter width n, when input signal, do not undergo mutation, and thinks that input signal is actual signal; When input signal is undergone mutation, adopt counter, the deration of signal after sudden change is counted.If counting width is less than filter width, think that this sudden change is caused by burr, to its filtering, if counting width is greater than filter width, think that this sports real sign mutation.The technical scheme of the method is: introduce sign mutation width variable St afterwards, suppose that the state conversion of this sequential circuit occurs in the rising edge of CP.According to filter width n, St is divided into S
0to S
nindividual state.When input signal is not undergone mutation, St keeps S always
0state.When signal is undergone mutation, suppose to be currently output as low level CLKA_filt=0, and CLKA=1 while being input as high level, St is by state S
0become state S
1, physical significance, for the signal accumulative total width after sudden change is 1, is less than filter width, and now output still keeps low level CLKA_filt=0.When second rising edge clock arrives, CLKA=1 when input is still high level, St is by state S
1become state S
2, physical significance, for signal accumulative total width after sudden change is 2, is less than filter width, output low level CLKA_filt=0; If at this moment be input as low level CLKA=0, St is by state S
1become state S
0, the deration of signal that physical significance is this sudden change is less than filter width, is judged as burr signal, carries out filtering, output low level CLKA_filt=0.By that analogy, at the k(1~n) individual rising edge clock is when arrive, and is input as high level if current, and St is by state S
k-1become state S
k, output low level; If current, be input as low level, St is by state S
kbecome state S
0, output low level.When St has been S
nstate, if when next rising edge clock arrives, input is still high level, St is by state S
nbecome state S
0, output high level, physical significance is that the accumulative total width after sign mutation is greater than filter width, is judged as true sudden change, otherwise gets back to S
0state, output low level.The state transition table of this state machine is in Table (one).
Table one: state-transition table (CLKA_filt is output, and CLKA is input)
Accompanying drawing explanation
Fig. 1 is the St state transition diagram of state machine.Be wherein state in circle, arrow is state conversion direction, and xx/x represents respectively the output of previous moment, current input, current output.
embodiment
The present invention adopts verilog language to realize this function, and its filter mainly realizes by nested if statement.Concrete methods of realizing is as follows: when rising edge arrives, first judge the level of current output, if current output state is low level, whether judgement input is low level, if so, keep output low level state zero clearing, continue to wait for subsequently the arrival on clock edge; If not, see whether high level state arrives, and whether counter reaches filter width: if be less than filter width, keep output low level, counter adds 1, otherwise output high level and counter O reset.Wait for the arrival of next rising edge.If current output state is high level, whether judgement input is high level, if so, keeps output high level state zero clearing, continues to wait for subsequently the arrival on clock edge; If not, see whether low level state arrives, and whether counter reaches filter width: if be less than filter width, keep output high level, counter adds 1, otherwise output low level and counter O reset.Continue to wait for the arrival of next rising edge.
Specific procedure following (7 is filter width):
Claims (6)
1. a digital filtering technique for the transient pulse in application and detection signal, is characterized in that usining that CPLD is as hardware, under high frequency clock drives, and by transient pulse width in the method detection signal of state machine, the pulse that filtering width is short, output broad pulse.This state machine has memory function, i.e. the output in its arbitrary moment is not only relevant with current input, also relevant with the state in a upper moment.Use this state machine first to choose suitable filter width, the width after sign mutation is less than filter width, thinks burr, carries out filtering, if the width after sign mutation is greater than filter width, thinks actual signal, and output.
2. as claimed in claim 1, it is characterized in that being applied to the transient signal in detection signal, filter the short pulse of width, output broad pulse.
3. as claimed in claim 1, it is characterized in that it is a digital filtering technique of being realized by programmed algorithm, this program is driven by high frequency clock, according to actual needs, can, at rising edge or the falling edge working procedure of clock, realize filter function.
4. as claimed in claim 1, it is characterized in that this state machine memory function, the output in its arbitrary moment, not only relevant with current input, also relevant with the output in a upper moment.
5. as claimed in claim 1, the status number of this state machine determines by filter width n, and state is S
0~S
n.State S
k(k=0,1 ... n) be defined as, the accumulative total width after input signal sudden change is k.
6. as described in claim 4,5, the state transformation rule of state machine is:
When rising edge clock/negative edge arrives
Step 1: judged whether reset signal, if having, state returns S
0state, output zero clearing, waits for next clock edge, otherwise enters step 2;
Step 2: judge whether current output is high level (low level);
Step 3: if output is high level (low level), whether judgement input is high level (low level);
Step 4: if input is high level (low level), current state S
kbeing converted to next state is S
0, output high level (low level);
Step 5: if the low level of being input as (high level) judges whether current state is S
n, if so, S
nbe converted to next state S
0, output low level, (high level), otherwise current state S
kbeing converted to next state is S
k+1, output high level (low level).
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310424881.5A CN103631161A (en) | 2013-09-17 | 2013-09-17 | Filtering method based on state machine |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310424881.5A CN103631161A (en) | 2013-09-17 | 2013-09-17 | Filtering method based on state machine |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103631161A true CN103631161A (en) | 2014-03-12 |
Family
ID=50212354
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310424881.5A Pending CN103631161A (en) | 2013-09-17 | 2013-09-17 | Filtering method based on state machine |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103631161A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105301341A (en) * | 2014-05-28 | 2016-02-03 | 英飞凌科技股份有限公司 | Method and device used for measuring amount with reference |
CN108638866A (en) * | 2018-06-22 | 2018-10-12 | 浙江吉利控股集团有限公司 | Electric vehicle power-on and power-off control method, apparatus and system |
CN110061718A (en) * | 2019-03-11 | 2019-07-26 | 湖北三江航天红峰控制有限公司 | A kind of self-adaptive digital signal is along filtering method and system |
CN111413549A (en) * | 2020-04-26 | 2020-07-14 | 上海航天计算机技术研究所 | High-reliability pulse width signal detection system, platform and method |
CN116131810A (en) * | 2023-04-17 | 2023-05-16 | 山东云海国创云计算装备产业创新中心有限公司 | Signal processing device, chip, method and equipment |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2004088842A2 (en) * | 2003-03-31 | 2004-10-14 | Koninklijke Philips Electronics N.V. | A fir filter device for flexible up- and downsampling |
CN1710429A (en) * | 2005-06-24 | 2005-12-21 | 东南大学 | Oscilloscope condition triggering method based on finit state machine |
WO2006117752A1 (en) * | 2005-04-29 | 2006-11-09 | Koninklijke Philips Electronics, N.V. | I2c slave/master interface enhancement using state machines |
CN101257288A (en) * | 2008-04-11 | 2008-09-03 | 哈尔滨理工大学 | Finite impulse response digit filter capable of configuring parameter |
CN101615313A (en) * | 2009-07-22 | 2009-12-30 | 大连理工大学 | A kind of operation states of intelligent tanks for dangerous chemical transportation monitoring method |
CN102467816A (en) * | 2010-11-18 | 2012-05-23 | 深圳艾科创新微电子有限公司 | Infrared remote control signal decoding method and device |
CN102651724A (en) * | 2011-02-25 | 2012-08-29 | 上海华虹集成电路有限责任公司 | Signaling demodulation method and signaling demodulation device in China mobile multimedia broadcasting (CMMB) system |
-
2013
- 2013-09-17 CN CN201310424881.5A patent/CN103631161A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2004088842A2 (en) * | 2003-03-31 | 2004-10-14 | Koninklijke Philips Electronics N.V. | A fir filter device for flexible up- and downsampling |
WO2006117752A1 (en) * | 2005-04-29 | 2006-11-09 | Koninklijke Philips Electronics, N.V. | I2c slave/master interface enhancement using state machines |
CN101208676A (en) * | 2005-04-29 | 2008-06-25 | 皇家飞利浦电子股份有限公司 | I2C slave/master interface enhancement using state machines |
CN1710429A (en) * | 2005-06-24 | 2005-12-21 | 东南大学 | Oscilloscope condition triggering method based on finit state machine |
CN101257288A (en) * | 2008-04-11 | 2008-09-03 | 哈尔滨理工大学 | Finite impulse response digit filter capable of configuring parameter |
CN101615313A (en) * | 2009-07-22 | 2009-12-30 | 大连理工大学 | A kind of operation states of intelligent tanks for dangerous chemical transportation monitoring method |
CN102467816A (en) * | 2010-11-18 | 2012-05-23 | 深圳艾科创新微电子有限公司 | Infrared remote control signal decoding method and device |
CN102651724A (en) * | 2011-02-25 | 2012-08-29 | 上海华虹集成电路有限责任公司 | Signaling demodulation method and signaling demodulation device in China mobile multimedia broadcasting (CMMB) system |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105301341A (en) * | 2014-05-28 | 2016-02-03 | 英飞凌科技股份有限公司 | Method and device used for measuring amount with reference |
US10048297B2 (en) | 2014-05-28 | 2018-08-14 | Infineon Technologies Ag | Method and apparatus for measuring a disturbed variable |
CN105301341B (en) * | 2014-05-28 | 2019-04-19 | 英飞凌科技股份有限公司 | Method and apparatus for measuring the amount with interference |
CN108638866A (en) * | 2018-06-22 | 2018-10-12 | 浙江吉利控股集团有限公司 | Electric vehicle power-on and power-off control method, apparatus and system |
CN108638866B (en) * | 2018-06-22 | 2020-07-07 | 浙江吉利控股集团有限公司 | Power-on and power-off control method, device and system for electric automobile |
CN110061718A (en) * | 2019-03-11 | 2019-07-26 | 湖北三江航天红峰控制有限公司 | A kind of self-adaptive digital signal is along filtering method and system |
CN111413549A (en) * | 2020-04-26 | 2020-07-14 | 上海航天计算机技术研究所 | High-reliability pulse width signal detection system, platform and method |
CN111413549B (en) * | 2020-04-26 | 2022-07-12 | 上海航天计算机技术研究所 | High-reliability pulse width signal detection system, platform and method |
CN116131810A (en) * | 2023-04-17 | 2023-05-16 | 山东云海国创云计算装备产业创新中心有限公司 | Signal processing device, chip, method and equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103631161A (en) | Filtering method based on state machine | |
CN104502684B (en) | A kind of totally digitilized peak value due in discrimination method | |
CN103185837B (en) | Method for measuring frequency of power system | |
CN101685135A (en) | Test device and test method for testing circuit board | |
CN102353500B (en) | Extraction method of unbalanced signal for dynamic balance measurement | |
CN107314775B (en) | A kind of switching at runtime based on 3-axis acceleration sensor calculates the step-recording method of axis | |
CN103760414B (en) | Based on the low speed recurrence interval collection method of anti-interference low-pass filtering | |
CN102128979A (en) | Equal-precision frequency measuring circuit and frequency measuring method thereof | |
CN105699738A (en) | PWM-based AC signal effective value measurement method | |
CN102707083B (en) | Motor speed calculating method | |
CN102809687B (en) | Digital measurement method for alternating-current frequency | |
CN105116318A (en) | Method for realizing burr detection in logic analyzer | |
CN107782964A (en) | Alternative output pulse signal frequency and measuring system, the measuring method counted | |
CN105245203A (en) | System and method for duty ratio detection employing high precision and low speed clock | |
CN106645780A (en) | Rotating speed detection method and system base on DSP | |
CN102147426A (en) | Broadband triggering circuit of digital oscilloscope | |
CN103941075A (en) | Pulse real-time detection method and circuit for nanosecond pulse width electrochemical machining | |
CN104201948B (en) | Control device and method of position-free sensor of switched reluctance motor | |
CN102043090A (en) | Measurement system for frequency-shift signal parameter of track circuit | |
CN206075260U (en) | A kind of computer data acquiring control system based on FPGA | |
CN103472276A (en) | Electric energy meter electricity stealing judgment method and electric energy measurement system with same | |
CN202940701U (en) | Rotation speed and displacement measurement system for rotation motor | |
CN109188077A (en) | A kind of signal frequency measuring method, system, device and readable storage medium storing program for executing | |
CN101937069B (en) | Voltage characteristic detection system and method of SOC (System On Chip) intelligent electric meter | |
CN202033420U (en) | Special circuit for time parameter tests of analog integrated circuit test system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20140312 |
|
WD01 | Invention patent application deemed withdrawn after publication |