<< WGM00) | (1 << WGM01) | (1 << WGM01) | (1 << WGM00); TCCR0 |= (1<
6.atmega128 ad 转换的程序 做例子用 想要经典一点的/*********************************包含头文件********************************/#include #include /********************************数码管段码表*******************************/extern const unsigned char tab[]={0x3f,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07, 0x7F,0x6F};/*********************************端口定义**********************************/#define sclon PORTG |=BIT(0); //时钟高#define scloff PORTG &=~BIT(0);#define dion PORTG |=BIT(1); //数据高#define dioff PORTG &=~BIT(1);/*********************************全局变量**********************************/unsigned int adc_rel;int dat;/****************************************************************************函数功能:ADC初始化函数入口参数:出口参数:****************************************************************************/void adc_init(void){ADCSRA=0x00; //关ADCADMUX = (1<
文章插图