CN112629570A - 一种基于fpga的编码器滤波算法 - Google Patents

一种基于fpga的编码器滤波算法 Download PDF

Info

Publication number
CN112629570A
CN112629570A CN202011344154.4A CN202011344154A CN112629570A CN 112629570 A CN112629570 A CN 112629570A CN 202011344154 A CN202011344154 A CN 202011344154A CN 112629570 A CN112629570 A CN 112629570A
Authority
CN
China
Prior art keywords
encoder
fpga
filtering algorithm
state
pulse width
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011344154.4A
Other languages
English (en)
Other versions
CN112629570B (zh
Inventor
陈诚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Xiantong Technology Co ltd
Original Assignee
Wuhan Xiantong Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Xiantong Technology Co ltd filed Critical Wuhan Xiantong Technology Co ltd
Priority to CN202011344154.4A priority Critical patent/CN112629570B/zh
Publication of CN112629570A publication Critical patent/CN112629570A/zh
Application granted granted Critical
Publication of CN112629570B publication Critical patent/CN112629570B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01DMEASURING NOT SPECIALLY ADAPTED FOR A SPECIFIC VARIABLE; ARRANGEMENTS FOR MEASURING TWO OR MORE VARIABLES NOT COVERED IN A SINGLE OTHER SUBCLASS; TARIFF METERING APPARATUS; MEASURING OR TESTING NOT OTHERWISE PROVIDED FOR
    • G01D5/00Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable
    • G01D5/12Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable using electric or magnetic means
    • G01D5/244Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable using electric or magnetic means influencing characteristics of pulses or pulse trains; generating pulses or pulse trains
    • G01D5/245Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable using electric or magnetic means influencing characteristics of pulses or pulse trains; generating pulses or pulse trains using a variable number of pulses in a train
    • G01D5/2451Incremental encoders

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)

Abstract

本发明提供一种基于FPGA的编码器滤波算法,包括以下步骤:增量式编码器;FPGA;空闲状;计数状;判决状,该装置滤波效果好,能够完全滤除低于设定脉宽阈值的干扰信号,并对有用信号的边沿不产生影响;滤波的脉宽阈值灵活可配置,根据不同的应用场合选择不同的脉宽阈值即可移植使用,该滤波算法消耗的逻辑资源极少。

Description

一种基于FPGA的编码器滤波算法
技术领域
本发明涉及基于FPGA的编码器滤波算法设备领域,具体为一种基于FPGA的编码器滤波算法。
背景技术
编码器作为常见传感器的一种,主要用于检测机械运动的角度、距离、速度、位置或计数,是一种高集成度的数字化检测装置,其具有精度高、响应快、分辨率高、性能可靠等优点,近些年来,编码器已经发展为一种成熟的高性能、多规格的系列工业化产品,主要应用于各类数字电子电路中,凡是需要检测、伺服控制的产品都可用到编码器,光电编码器根据输出脉冲的方式和光电码盘刻度方法的不同,可以分为增量式光电编码器、绝对式光电编码器以及复合式光电编码器三大类,在实际的工业应用中,增量式光电编码器经常与大型机电设备协同工作,电磁环境较为复杂,编码器的输出信号也比较容易受到干扰产生毛刺,从而导致误检测,影响了系统的控制精度,。
发明内容
针对现有技术存在的不足,本发明目的是提供一种基于FPGA的编码器滤波算法,以解决上述背景技术中提出的问题,本发明结构新颖,使用时基于FPGA的编码器滤波消抖算法用于滤除编码器在实际工作中产生的尖峰干扰,提高编码器检测的可靠性。
为了实现上述目的,本发明是通过如下的技术方案来实现:一种基于FPGA的编码器滤波算法,包括以下步骤:
步骤一:进入到增量式器的内部,增量式编码器的工作频率一般小于10KHz,即周期大于100US,相邻两个边沿的时间大于50US;而干扰脉冲的宽度一般小于4US,因此,我们可以选定一个阈值,例如5US,并在软件中检测编码器信号中相邻两个边沿的时间宽度,将宽度低于5US的脉冲剔除,即可得出纯净的编码器信号;
步骤二:使编码器信号进入到FPGA实现滤波算法的状态机内部;
步骤三:系统复位后首先进入到空闲状态;
步骤四:当检测到跳变,系统进入到计数状态;并在计数状态下不停的检测是否还有跳变的到来;
步骤五:当计数值达到5US时,系统进入到判决状态。
作为本发明的一种优选方式,所述步骤四如果有跳变则计数器清零重新计数。
作为本发明的一种优选方式,所述步骤五判断当前值S2和跳变之前的状态值S1是否相等,并返回空闲状态。
本发明的有益效果:
1.该基于FPGA的编码器滤波算法滤波效果好,能够完全滤除低于设定脉宽阈值的干扰信号,并对有用信号的边沿不产生影响。
2.该基于FPGA的编码器滤波算法滤波的脉宽阈值灵活可配置,根据不同的应用场合选择不同的脉宽阈值即可移植使用,该滤波算法消耗的逻辑资源极少。
附图说明
图1为本发明一种基于FPGA的编码器滤波算法的结构示意图;
图2为本发明一种基于FPGA的编码器滤波算法的理想波形的结构示意图;
图3为本发明一种基于FPGA的编码器滤波算法的实际波形的结构示意图;
图4为本发明一种基于FPGA的编码器滤波算法的FPGA实现滤波算法的状态机跳转图;
具体实施方式
为使本发明实现的技术手段、创作特征、达成目的与功效易于明白了解,下面结合具体实施方式,进一步阐述本发明。
请参阅图1至图4,本发明提供一种技术方案:一种基于FPGA的编码器滤波算法,包括以下步骤:
步骤一:进入到增量式器的内部,增量式编码器的工作频率一般小于10KHz,即周期大于100US,相邻两个边沿的时间大于50US;而干扰脉冲的宽度一般小于4US,因此,我们可以选定一个阈值,例如5US,并在软件中检测编码器信号中相邻两个边沿的时间宽度,将宽度低于5US的脉冲剔除,即可得出纯净的编码器信号;
步骤二:使编码器信号进入到FPGA实现滤波算法的状态机内部;
步骤三:系统复位后首先进入到空闲状态;
步骤四:当检测到跳变,系统进入到计数状态;并在计数状态下不停的检测是否还有跳变的到来;
步骤五:当计数值达到5US时,系统进入到判决状态。
作为本发明的一种优选方式,所述步骤四如果有跳变则计数器清零重新计数。
作为本发明的一种优选方式,所述步骤五判断当前值S2和跳变之前的状态值S1是否相等,并返回空闲状态。
其步骤二至步骤五的FPGA中实现的部分主要代码如下:
Figure BDA0002799359440000041
以上显示和描述了本发明的基本原理和主要特征和本发明的优点,对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化囊括在本发明内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。
此外,应当理解,虽然本说明书按照实施方式加以描述,但并非每个实施方式仅包含一个独立的技术方案,说明书的这种叙述方式仅仅是为清楚起见,本领域技术人员应当将说明书作为一个整体,各实施例中的技术方案也可以经适当组合,形成本领域技术人员可以理解的其他实施方式。

Claims (3)

1.一种基于FPGA的编码器滤波算法,其特征在于:包括以下步骤:
步骤一:进入到增量式器的内部,增量式编码器的工作频率一般小于10KHz,即周期大于100US,相邻两个边沿的时间大于50US;而干扰脉冲的宽度一般小于4US,因此,我们可以选定一个阈值,例如5US,并在软件中检测编码器信号中相邻两个边沿的时间宽度,将宽度低于5US的脉冲剔除,即可得出纯净的编码器信号;
步骤二:使编码器信号进入到FPGA实现滤波算法的状态机内部;
步骤三:系统复位后首先进入到空闲状态;
步骤四:当检测到跳变,系统进入到计数状态;并在计数状态下不停的检测是否还有跳变的到来;
步骤五:当计数值达到5US时,系统进入到判决状态。
2.根据权利要求1一种基于FPGA的编码器滤波算法,其特征在于:所述步骤四如果有跳变则计数器清零重新计数。
3.根据权利要求1一种基于FPGA的编码器滤波算法,其特征在于:所述步骤五判断当前值S2和跳变之前的状态值S1是否相等,并返回空闲状态。
CN202011344154.4A 2020-11-25 2020-11-25 一种基于fpga的编码器滤波算法 Active CN112629570B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011344154.4A CN112629570B (zh) 2020-11-25 2020-11-25 一种基于fpga的编码器滤波算法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011344154.4A CN112629570B (zh) 2020-11-25 2020-11-25 一种基于fpga的编码器滤波算法

Publications (2)

Publication Number Publication Date
CN112629570A true CN112629570A (zh) 2021-04-09
CN112629570B CN112629570B (zh) 2022-04-08

Family

ID=75303964

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011344154.4A Active CN112629570B (zh) 2020-11-25 2020-11-25 一种基于fpga的编码器滤波算法

Country Status (1)

Country Link
CN (1) CN112629570B (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114413941A (zh) * 2021-12-29 2022-04-29 歌尔光学科技有限公司 光电池探测系统、编码控制方法、处理芯片、设备和介质
CN115290149A (zh) * 2022-10-08 2022-11-04 青岛鼎信通讯股份有限公司 一种应用于电子远传水表的计量信号滤波方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100097052A1 (en) * 2008-10-16 2010-04-22 Lillestolen Kirk A Resolver interface and signal conditioner
EP2495976A2 (en) * 2011-03-04 2012-09-05 ViXS Systems Inc. General video decoding device for decoding multilayer video and methods for use therewith
CN106571820A (zh) * 2016-10-19 2017-04-19 上海铼钠克数控科技股份有限公司 基于fpga的编码器信号的滤波方法及滤波系统
CN108155910A (zh) * 2017-12-21 2018-06-12 中国船舶重工集团公司第七0七研究所 一种基于fpga的高速正余弦编码器解码方法
US10615818B1 (en) * 2019-06-02 2020-04-07 Nxp Usa, Inc. Mixed chopping and correlated double sampling two-step analog-to-digital converter

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100097052A1 (en) * 2008-10-16 2010-04-22 Lillestolen Kirk A Resolver interface and signal conditioner
EP2495976A2 (en) * 2011-03-04 2012-09-05 ViXS Systems Inc. General video decoding device for decoding multilayer video and methods for use therewith
CN106571820A (zh) * 2016-10-19 2017-04-19 上海铼钠克数控科技股份有限公司 基于fpga的编码器信号的滤波方法及滤波系统
CN108155910A (zh) * 2017-12-21 2018-06-12 中国船舶重工集团公司第七0七研究所 一种基于fpga的高速正余弦编码器解码方法
US10615818B1 (en) * 2019-06-02 2020-04-07 Nxp Usa, Inc. Mixed chopping and correlated double sampling two-step analog-to-digital converter

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
马利等: "基于FPGA的光电编码器电路抗干扰设计", 《辽宁大学学报》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114413941A (zh) * 2021-12-29 2022-04-29 歌尔光学科技有限公司 光电池探测系统、编码控制方法、处理芯片、设备和介质
CN115290149A (zh) * 2022-10-08 2022-11-04 青岛鼎信通讯股份有限公司 一种应用于电子远传水表的计量信号滤波方法

Also Published As

Publication number Publication date
CN112629570B (zh) 2022-04-08

Similar Documents

Publication Publication Date Title
CN112629570B (zh) 一种基于fpga的编码器滤波算法
CN101995533B (zh) 一种数字增量式编码器断线实时检测的方法和系统
US11852666B2 (en) Circuit and method for width measurement of digital pulse signals
CN103575312B (zh) 一种用于光电转台的增量式光电编码器的消抖方法
CN104901657A (zh) 一种全数字去抖动电路及方法
CN103869094B (zh) 一种主泵转速测量信号处理方法
CN104202040A (zh) 位电平检测电路以及方法
CN104317253A (zh) 一种用于伺服电机位置控制的系统方法
CN105245203A (zh) 高精度低速时钟占空比检测系统及方法
CN107186710A (zh) 一种机械手精确快速回原的方法
CN104518755A (zh) 数字电路噪声滤波器及数字滤波方法
Hebert et al. A high efficiency interface for a biphase incremental encoder with error detection (servomotor control)
CN207339817U (zh) 一种键相前置放大器
CN1474508A (zh) 一种低频时钟监测高频时钟脉冲丢失检测电路
CN2713741Y (zh) 时钟检测电路
JPS57111196A (en) Signal error detector
CN112782474A (zh) 频率检测电路及频率检测方法
CN202770457U (zh) 旋转变压器角码转换器
CN102957426A (zh) 一种可程控旋转编码器的自适应电路
CN214335060U (zh) 频率检测电路
CN213305368U (zh) 边沿调制发射器及数字隔离器
CN104406545A (zh) 基于增量式旋转光学编码器的旋转角度测量与计算
CN104320094A (zh) 脉冲信号驻波保护电路
KR101235527B1 (ko) 고속 카운터
CN102122224B (zh) 一种触控检测的电路模块及方法

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: No. 02, 5 / F, block 7, Fenghuang Industrial Park, No. 52, Liufang Avenue, fozuling street, Donghu New Technology Development Zone, Wuhan City, Hubei Province, 430000

Patentee after: Wuhan Xiantong Technology Co.,Ltd.

Address before: No. 02, 5 / F, block 7, Fenghuang Industrial Park, No. 52, Liufang Avenue, fozuling street, Donghu New Technology Development Zone, Wuhan City, Hubei Province, 430000

Patentee before: WUHAN XIANTONG TECHNOLOGY Co.,Ltd.