仿真图1简介:文章来源:https://www.toymoban.com/news/detail-403802.html
本系统采用51单片机作为系统的MCU(具体型号见下图),该系统显示器为四位数码管,可实时显示波形的参数情况
可显示四种波形,分别是方波、正弦波、三角波、锯齿波。
该设计具有电压表功能,可显示当前所测电压参数,其中ADC芯片采用的是PCF8591
该设计不支持调节波形的占空比
波形输出通过仿真软件的示波器可以查看得到
系统设计有一个功能按键作为波形切换功能。
文章来源地址https://www.toymoban.com/news/detail-403802.html
#include <reg51.h>
#include <PCF8591.h>
#include <seg.h>
sbit KEY = P3^7;
unsigned char code sin_num[]={
0,0,0,0,0,0,0,0,1,1,1,1,1,2,2,2,
2,3,3,4,4,4,5,5,6,6,7,7,8,8,9,9,
10,10,11,12,12,13,14,15,15,16,17,18,18,19,20,21,
22,23,24,25,25,26,27,28,29,30,31,32,34,35,36,37,
38,39,40,41,42,44,45,46,47,49,50,51,52,54,55,56,
57,59,60,61,63,64,66,67,68,70,71,73,74,75,77,78,
80,81,83,84,86,87,89,90,92,93,95,96,98,99,101,102,
104,106,107,109,110,112, 113,115,116,118,120,121,123,124,126,128,
129,131, 132,134,135, 137, 139,140,142,143,145,146,148, 149,151,153,
154,156,157,159,160,162,163,165, 166,168,169,171,172,174,175,177,
178,180,181, 182,184,185,187,188,189,191,192,194,195,196,198,199,
200,201,203,204,205,206,208,209,210,211,213,214,215,216,217,218,
219,220,221,223,224,225,226,227,228,229,230,230,231,232,233,234,
235,236,237,237,238,239,240,240,241,242,243,243,244,245,245,246,
246,247,247,248,248,249,249,250,250,251,251, 251,252,252,253,253,
253,253,254,254,254,254,254,255,255,255,255, 255,255,255,255,255
}; //这是正弦波上升半周期的采样
uchar Recv_Buffer;//数据接收缓冲
uchar Voltage[]="0.000V ";//数据分解为电压x.xx
float Vol_Am; //放大后的电压值
uchar key_ms;
uchar mode;
void delay(unsigned int x)//延时
{
while(--x);
}
void key_pro()
{
if(KEY == 0) key_ms++;
if(key_ms >= 5)
{
if(KEY == 0)
{
key_ms = 0;
mode++;
if(mode >= 5) mode = 0;
while(!KEY);
}
}
}
void DAC_Wave()
{
int i;
switch(mode)
{
case 1:
到了这里,关于基于51单片机的波形发生器proteus仿真数码管LCD12864显示的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!