码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2021-03-16 14:12:50      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:正弦   vol   ref   title   tps   loading   数字信号   alt   mic   

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;

技术图片

 

 

  

 

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

标签:正弦   vol   ref   title   tps   loading   数字信号   alt   mic   

原文地址:https://www.cnblogs.com/cczero/p/14534303.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!