pic12f675 芯片
GP1用作ADC输入,下面的程序调了3天没调通,返回的数据总是0或者0xffff,不知道问题在哪了
unsigned int ADCRead()
{
unsigned int temp;
ADON=1;
GO_nDONE=1; //adc start
while(GO_nDONE);
temp=ADRESH<<8+ADRESL;
return(temp);
}
void ADCInit()
{
TRISIO1=1;//ADC //GP1输入
ADCON0=0b10000100; //右对齐,AN0
ANSEL =0b00010010; //Fosc/8
} |