打印

请问为什么频率一高波形就变成这样了,电路和程序如下

[复制链接]
1307|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主

本来波形应该是这个样子的





但是频率一高就变成这样了





电路如图

用的是atmega16和dac0832

程序如下#include<iom16v.h>  #include<macros.h>   
#define uchar unsigned char       
#define uint unsigned int
unsigned int k=0,c=1;
unsigned char i;
#pragma data:code

flash unsigned char juchi1[333]={160,173,186,197,209,219,229,238,245,251,254,254,30,44,59,73,88,102,115,129,142,155,167,179,190,200,210,220,228,236,243,248,252,254,254,26,38,50,61,72,84,94,105,115,125,134,143,152,161,169,176,184,190,197,203,209,214,219,224,228,232,236,239,242,245,247,249,251,252,253,254,254,254,254,254,254,254,253,253,252,252,252,251,251,251,252,252,252,253,253,254,254,254,254,254,254,254,253,253,251,250,248,246,244,241,238,235,231,227,222,218,212,207,201,195,188,181,173,166,158,149,140,131,122,112,101,91,80,69,57,46,34,23,11,2,251,246,240,233,225,217,207,197,186,175,163,151,138,124,111,97,83,69,54,39,25,11,0,249,243,235,226,216,205,193,181,168,155,142,128,113,99,84,69,54,39,24,10,0,249,243,235,226,217,207,196,185,173,161,149,136,123,110,97,84,71,58,45,33,21,9,1,251,246,241,234,228,221,213,205,198,189,181,173,164,157,148,140,132,124,117,109,101,94,87,80,73,67,60,54,49,43,38,33,29,25,20,17,14,11,8,6,4,3,1,1,0,0,0,0,0,0,0,0,0,1,1,3,4,6,8,11,14,17,20,25,29,33,38,43,49,54,60,67,73,80,87,94,101,109,117,124,132,140,148,157,164,173,181,189,198,205,213,221,228,234,241,246,251,254,254,252,33,45,58,71,84,97,110,123,136,149,161,173,185,196,207,217,226,235,243,249,253,254,24,39,54,69,84,99,113,128,142};

#pragma data:data
unsigned int f=10;

void delaynus(unsigned int n)
{
if (n == 0)
return ;  
  while (--n);
}
void main(void)            //主函数
{

  unsigned char i,j;
  DDRA=0xff;
  PORTA=0xff;
  DDRC=0xff;
  PORTC=0xff;
                while(1)
                {
       
                PORTC=juchi1[k];
       
                k++;
                if(k==333) k=0;
                delaynus(1);
                }
}





相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

29

主题

59

帖子

0

粉丝