1、 页 1 基于单片机原理的基于单片机原理的波形发生器波形发生器 摘要摘要: 本系统采用单片机 C8051 为控制核心,输出数字量,然后由 DAC0832 把数字量转 换成模拟量;但是输出的是电流,需要用运放(OP07),把电流转换成电压量。 显示利用的是 LCD1602 的液晶,显示其波形,幅值。按键应用的是独立按键,用来波形的切换,幅 值,频率的调解。其运算核心,我们通过 MATLAB 对正弦波,三角板,正弦波进行采 样,得到一组组数据,然后同过数组存储;利用中断对数组进行扫描。其频率的调解 就是调节其中断间隔的时间, 幅值就是调节其数字的大小 (同时乘以某个小于 1 的数) 。 为了波形的
2、合成,我们采用的点的个数都是 20 个。 关键词:AT-89C51 DAC0832 独立按键 OP07 页 2 T The he D Design of esign of WWaveform aveform G Generator enerator B Based on 51ased on 51 Abstract: This system adopts single-chip C8051 as the control core, digital output, and then by DAC0832 convert digital to analog; But the output is cu
3、rrent, the need to use operational amplifier (OP07), the amount of current into a voltage. Display using the LCD1602 LCD, display the waveform amplitude. Key applications is independent, switch to waveform, amplitude, frequency of mediation. Its core operation, we use MATLAB to sine wave, triangle,
4、the sine wave samples, groups of data, and then with an array of storage; Using the interrupt for scanning array. The frequency of mediation is to adjust one interval time, amplitude is adjusting the size of its digital (multiplied by a certain number of less than 1) at the same time. For the wavefo
5、rm synthesis, we adopt the number of points is 20. Keywords:AT-89C51 DAC0832 Separate button OP07 页 3 一一、题目要求题目要求及分析及分析 设计任务:设计制作一个波形发生器,该波形发生器能产生正弦波、方波、三角 波和由用户编辑的特定形状波形。 示意图如下: 图 1 设计要求图 设计要求: 1.具有产生正弦波、方波、三角波三种周期性波形的功能; 2.用键盘输入编辑生成上述三种波形(同周期)的线性组合波形,以及由基波及其 谐波(5 次以下)线性组合的波形。 3.具有波形存储功能。 4.输出波形的频率
6、范围为 100Hz20kHz(非正弦波频率按 10 次谐波计算) ;重复 频率可调,频率步进间隔100Hz。 5.输出波形幅度范围 O5V(峰峰值) ,可按步进 0.1V(峰峰值)调整。 6.具有显示输出波形的类型、重复频率(周期)和幅度的功能。 7.增加红外配置功能(串口配置程序或其他方式) 页 4 二二、总体系统方案设计总体系统方案设计 题目要求实现的任务是设计并制作一个函数信号发生器,能够产生正弦波、方波、 三角波,要求不用 DDS 和专用的波形产生芯片,频率范围在 1Hz1MHZ 可调,在频 率范围为 1HZ10KHz 时,步进不大于 10Hz 在频率范围为 10KHz1MHz 时,步进不 大于 100Hz,并且电压范围在 05V 可调,步进为 0.1V,能够实时的显示波形的类型 及其频率和幅值。现在对以下方案进论证和验证。 2.1 总体设计思路总体设计思路 根据题目的要求,经过仔细的考虑各种要素,制定了整体方案:以 AT89C51 单片 机为控制核心,P0 口接 DAC0832 信号输入并进行数模转换,P1 口接矩阵键盘,P2 口 接液晶