adc.h

来自「avr基础程序大全」· C头文件 代码 · 共 17 行

H
17
字号
#include <iom16v.h>
#include <macros.h>
#define  uchar unsigned char
#define  uint  unsigned int
uint mega16_adc()
{
     uint addata;
	 DDRA&=~BIT(0);
	 PORTA&=~BIT(0);
	 ADMUX=0x40;
	 ADCSR=0X80;
	 ADCSR|=BIT(6);
	 while(!(ADCSR&(BIT(4))));
     addata=ADCL;
	 addata=addata+ADCH*256;
	 return addata;
} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?