ADC不能连续转换

2019-03-24 20:47发布

#include<iom16v.h>
#include<macros.h>
#define uint unsigned int
void init_port()端口初始化
{
  DDRA&=~BIT(0);
  DDRB=0xff;
  PORTB=0;
}
void init_adc()
{
ADMUX=0x00;通道0,外接参考电压
ADCSRA=0xe7;开ADC使能,开自动触发,启动转换,连续转换模式
SFIOR=0x00;
}
void main()
{
          uint tep1,tep2;
        init_port();
        //ADCSRA|=BIT(6);
        init_adc();
        while(1)
        {
        while(!(ADCSRA&0x10));等待转换完成
        tep1=ADCL;
        tep2=ADCH;
        tep2=tep1+256*tep2;
        PORTB=tep2;   送到PB口
        //ADCSRA|=BIT(6);
    }
}

为什么只能转换一次了,不是已经设置为连续转换吗,谢谢 此帖出自小平头技术问答
0条回答

一周热门 更多>