基于单片机数字信号波形显示发生器

1493下载地址 https://docs.qq.com/doc/DWEpnR2pOWU91b3p4?pub=1&dver=2.1.0

一个51单片机做的数字信号发生器仿真 可连续调频调幅,显示幅度值,频率,任选波形.

 

#include<reg51.h>
#include<absacc.h>
#define DAC0832 XBYTE[0x7fff]
#define ADC0808 XBYTE[0xfeff]
#define ADC08081 XBYTE[0xefff]
sbit s0=P2^1;
sbit s1=P2^2;
sbit s2=P2^3;
sbit s3=P3^0;
sbit A0=P2^5;
sbit A1=P2^6;
sbit B0=P3^4;
sbit B1=P3^5;
unsigned int i,j;
unsigned int x=0;
unsigned char freq,voltage;
unsigned char f[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xbf};
unsigned char v[]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0x3f};
char code s[]={0,22,44,64,82,98,111,120,126,127,126,120,111,98,82,64,44,22,0,-22,-44,-64,-82,-98,-111,-120,-126,-127,-126,-120,-111,-98,-82,-64,-44,-22}; //正弦波形表   
char code jc[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35};
char code sj[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
char code fb[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255};
void delay(unsigned int i)
{
while(i--);
}            
void sin()
{
while(s0==0)
{
ADC0808=0;
for(x=0;x<9;x++)
{
P1=f[(33-freq/8)%10];
A0=1;

 

 

  

 

posted @ 2021-03-15 16:10  roadroad  阅读(195)  评论(0编辑  收藏  举报
电设屋
上千套电子毕设课设方案