#include "mega64.h"
#include "Delay.h"
#define lemp3 PORTC.7
int addata;
interrupt [ADC_INT] void ad_handler(void)
{
int ADC;
//lemp3=1;
addata=ADCH*256+ADCL;
if (addata>100)
lemp3=1;
if(addata<100)
lemp3=0;
ADCSRA|=0X40;
}
void main(void)
{
PORTF=0x00;
DDRF=0x00; //ADC转换通道,后三位为输出。
ADMUX=0X20; //模拟量寄存器控制
ADCSRA=0X86;
ADCSRA|=0X40;
SREG=0X80;
while (1)
{
;
}
} |