宇航计测技术 ›› 2023, Vol. 43 ›› Issue (3): 85-90.doi: 10.12060/j.issn.1000-7202.2023.03.16

• 精密测试技术 • 上一篇    下一篇

基于单片机的高精度波形信号直接生成方法研究

陈砚圃1,刘含1,郭博2,石立春1   

  1. 1.西京学院计算机学院,西安 710123; 2.西京学院电子信息学院,西安 710123
  • 出版日期:2023-06-25 发布日期:2023-07-08
  • 作者简介:陈砚圃(1963-),男,教授,博士,研究方向:智能仪表与电子测量技术。
  • 基金资助:
    国家自然科学基金项目(62275079);陕西省重点研发计划项目(2022GY-118);西安市创新能力强基计划项目(2021JH-06-0069)资助。

Research on MCU Direct Generation Method of High Accuracy Signal Waveform

CHEN Yan-pu1, LIU Han1, GUO Bo2, SHI Li-Chun1   

  1. 1. School of Computer Science, Xijing University, Xi’an 710123, China;  2. School of Electronic Information, Xijing University, Xi’an 710123, China
  • Online:2023-06-25 Published:2023-07-08

摘要: 针对直接数字频率合成(DDS)技术不适于单片机直接实现的问题,提出了一种波形信号生成的整周期循环法。借助片内嵌有直接存储器存取控制器(DMA)和数模转换器(DAC)等外设的单片机,该方法可以在不引入DDS专用芯片的情况下直接生成预设波形信号,且在生成信号时完全不占用单片机的CPU时间。对生成波形信号的整周期循环法进行了理论分析,导出了生成信号的频率及最大相对频偏公式,给出了算法实现流程。采用STM32单片机对整周期循环法生成正弦信号进行了实验测试。实验表明生成信号的频率精度高,且波形稳定、质量好。

关键词: 波形信号生成, 直接数字频率合成, 直接存储器存取控制器, STM32单片机

Abstract: Aiming at the weakness that Direct Digital Synthesis (DDS) technology is not suitable for the direct realization of MCU, an integer-period repetition method for waveform signal generation is proposed. By using a MCU embedded with on-chip peripherals such as Direct Memory Access controller (DMA) and Digital-to-Analog Converter (DAC), this method can directly generate preset waveform signal without introducing ASIC chips, and the signal generation process does not occupy CPU time of MCU at all. The integer-period repetition method of generating waveform signal is analyzed theoretically, the formula of generating signal frequency and maximum relative frequency deviation is derived, and the algorithm implementation flow is given. STM32 MCU is used to test the sine signal generated by the integer-period repetition method. The experiment shows that the frequency accuracy of the generated signal is high, and the waveform is stable and of good quality.

Key words: Waveform signal generation, Direct Digital Synthesis(DDS), Direct Memory Access controller (DMA), STM32 MCU

中图分类号: