期刊文献+

模数转换/数字滤波集成式模块化编程方法

Integrated modular programming method of analog-to-digital conversion/digital filtering
原文传递
导出
摘要 随着科技的发展,微处理器被广泛地应用到工业及人们生活中的现代化产品与仪器中。模数转换(A/D)是现代化高科技产品的重要的环节之一。常用微处理器通常有8个模拟量信号采集端口,模拟量信号采集程序编制过程中,需要对每个模拟量输入端口的7个寄存器19个bit位进行配置,程序代码冗余繁多,且容易出错,给编程和调试带来了较大困难。同时,为确保模拟量采集的精度和稳定性,通常需要数字滤波处理,如果滤波次数选用不当,会导致CPU运行效率低下。针对上述问题,提出一种模数转换/数字滤波集成式模块化编程方法,最大程度地减少程序的冗余代码,减少程序编制的复杂程度,程序调试简单化,提高了CPU的运行效率。本文提出的模数转换/数字滤波集成式模块由初始化子模块、A/D转换模块和数字滤波子模块组成。初始化子模块中,只配置数模转换过程的单次性寄存器及相应位。A/D转换模块由A/D转换函数体构成,将多次复用的寄存器及相应位通过参数传递到函数体中。数字滤波的滤波次数通过参数传递到A/D转换函数体中,且以2的整数次幂作为滤波次数,避免CPU做除法运算使得CPU的运行效率进一步提高。在程序实现中,只要将本文提出的模块引入程序中并进行简单的配置,数模转换与滤波即可同时完成。使用该模块可以大大节省程序编制的工作量,减少人为错误代码概率,同时数字滤波一次完成,使得程序变得简单、清晰、无代码冗余。该模块易维护、易调试,具有很强的移植性,可以移植到所有工控单片机的A/D转换程序中。为程序员提供了方便快捷的编程思想与方法。 With the development of technology,microprocessors are widely used in modern products and instruments in industry and people’s lives.Analog-to-digital conversion(A/D)is the most important part of modern high-tech products.Commonly used microprocessors usually have 8 analog signal acquisition ports.During the process of analog signal acquisition,the 19 registers of each of the analog input ports need to be configured to make the program code redundant.It is easy to make mistakes,which brings unimaginable difficulties to programming and debugging.At the same time,in order to ensure the accuracy and stability of analog acquisition,digital filtering is usually required.If the number of filtering is improperly selected,the CPU will be inefficient.Aiming at above problems,this paper proposes an integrated modular programming method of analog-to-digital conversion/digital filtering,which minimizes the redundant code of the program,reduces the complexity of programming,and simplifies program debugging.The analog-to-digital conversion/digital filtering integrated module proposed in this paper consists of an initialization sub-module,an A/D conversion module and a digital filtering sub-module.In the initialization sub-module,only the singleuse registers are configured.The multiple-use registers and corresponding bits are passed to the function body through parameters.The number of digital filtering is put into the A/D conversion function body by parameters,which is the integer power of 2 to avoid division operation in CPU.As long as the module proposed in this paper is introduced into the program and simple configuration,digital-to-analog conversion and filtering can be completed meanwhile,which can greatly reduce the workload of programming and reduce the probability of human error code,then digital filtering is completed at the same time.This module is easy to maintain,debug and has a strong portability,which provide convenient,quick programming ideas and methods to programmers.
作者 杜光月 郑焕祺 刘大伟 曹书博 周玉成 DU Guang-yue;ZHENG Huan-qi;LIU Da-wei;CAO Shu-bo;ZHOU Yu-cheng(Shandong Jianzhu University,Jinan 250101,China)
出处 《木材加工机械》 2019年第2期9-15,共7页 Wood Processing Machinery
基金 泰山学者优势特色学科人才团队(2015162)
关键词 模数转换 数字滤波 模块化 analog-to-digital conversion digital filtering modular
  • 相关文献

参考文献3

二级参考文献6

共引文献7

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部