比较器
AD:
精度:10位
转换速率:500 KSPS
量程:0~3.3v
void adc_init(void)
{
ADCCON = (1 << 14) | (49 << 6) | (1 << 1);
}
unsigned short adc_read(void)
{
unsigned short value = ADCDAT0;
while(~(ADCCON & (1 << 15)));
value = ADCDAT0 & 0x3ff;
return value;
}