正弦信号发生器的设计
摘 要
正弦交流信号是一种应用极为广泛的信号。在许多测试仪中需要用标准的正弦信号检测一些物理量。正弦信号用作标准信号时,要求正弦信号必须有较高的精度、稳定度及较低的失真率。传统的正弦信号发生器的频率变动由机械驱动可变元件完成,当这种信号发生器用于低频信号输出往往需要的RC值很大,这样不但参数准确度难以保证,而且体积和功耗都很大。而基于单片机技术和D/A转换电路构成的正弦信号发生器就可以解决这些问题。
本文主要介绍了数字式正弦信号发生器的波形产生原理和单片机控制原理。本次设计以单片机技术为基础,通过AT89C51芯片在一定时间内输出一系列的离散数字样点信号,然后通过D/A转换器转换成平滑的正弦波信号,最后通过运算放大器输出。本次设计采用模块化设计的方法,软硬件相结合,硬件设计包括:数码管频率和振幅显示电路、D/A转换正弦信号输出电路、时钟复位电路、键盘频率和振幅输入电路;软件设计包括:显示子程序、D/A转换子程序以及数据计算处理子程序、键盘频率输入子程序。通过软、硬件的结合,既可以实现波形参数的独立连续变化,又具有良好的人机对话界面,原理简单,使用方便。软硬件设计完成后利用KeilμVision2集成开发环境编译该最小系统的程序,利用Proteus仿真软件设计该系统的电路原理图,最后通过两个工具的完美结合对该课题进行系统的软件模拟仿真,结果满足设计要求。本次设计的数字式正弦信号发生器的参数可调,输出波形平滑规则、频率稳定、有较强的实用性。
关键词: 单片机 正弦波 信号发生器
Abstract
The sine signal is a very extensive application of the signal. the standard sinusoidal signal also beneeded in many tester to detect some physical quantities.Sinusoidal signal as a standard signal, demanded that sinusoidal signal must have a high accuracy, stability and low distortion rate .The traditional sine signal generator of variable frequency is drived by mechanical components, when this signal generator used for low frequency signal output often need RC value greatly, It is hard to ensure accuracy parameters,the volume and power consumption.But based on the single chip microcomputer and D/A transformation of sine signal generator circuit can solve these problems.
This paper mainly introduces the sinusoidal signal generator of digital waveform principle and single-chip microcomputer control principle. Design with micro-controller technology as the foundation, by AT89C51 chip in A certain period of D/A number of discrete output series of converter, then wording point signal converting smooth sine signals, through the operational amplifier output. This design USES modular design method, combining software with hardware design, including: digital tube amplitude and frequency display circuit, D/A transformation sinusoidal output circuit, clocking circuit and reset circuit keyboard input frequency and amplitude, Software design includes: display subroutines, D/A transformation and the data processing procedure, keyboard input frequency subroutine subroutine. Through the combination of hardware and software, can achieve continuous variation of parameters, and is independent of good human-machine conversation interface, the principle of simple and easy to use. After the completion of the hardware and software design using Keil muon Vision2 integrated environmental compile the program using the minimum system, Proteus simulation software design of the system through the circuit principle diagram, the perfect combination of two tools on the system software simulation, the results can satisfy the design requirements. The design of digital sine signal generator parameters is adjustable and the output waveform is smooth, stable, and practical.
Key words:Micro Controller Unit Sine wave Signal generator
目 录
1 引言 1
2 总体结构设计 2
2.1 单片机概述 2
2.1.1 单片机的发展 2
2.1.2 单片机的用途 3
2.2 系统设计的功能 3
2.3 波形发生和输出频率的方法 4
2.3.1 波形发生的方法 4
2.3.2 输出频率的方法 4
3 系统硬件设计 5
3.1 硬件电路芯片的选择 5
3.1.1 CPU芯片 AT89C51 5
3.1.2 D/A转换器芯片DAC0832 8
3.1.3 显示器的选择 9
3.1.4 运算放大器HA17741 10
3.2 电路接口的设计 11
3.2.1 LED数码管显示电路 11
3.2.2 D/A转换正弦信号输出电路 12
3.2.3 时钟电路及复位电路 13
3.2.4 键盘频率和振幅输入电路 15
3.2.5 电源电路的设计 15
4 系统软件程序的设计 17
4.1 主程序功能模块 17
4.2 显示子程序模块 17
4.3 D/A转换子程序模块 18
4.4 键盘控制频率输入子程序模块 19
4.5 数据计算处理子程序模块 20
5 系统调试 22
5.1 PROTEUS与KEIL uVision2介绍 22
5.2 软硬件的调试 23
5.2.1 软件调试 23
5.2.2 硬件调试 23
6 结论 25
6.1 实验结果 25
6.2 讨论分析 25
谢辞 27
参考文献 28
附录 29
电路图 29
源程序 30
外文资料翻译 41