static void adc_init(void)
{
ADCON = 0x00; //ADON, VDD as vref, no trigger
/***************************************************************************************
24M SYSCLK, 100ksps
****************************************************************************************/
ADT = 136;
// ADREF Ñ¡ÔñÍⲿ²Î¿¼
//ADCON |= 1<<4;
// ÅäÖÃP1.1 -- P1.2 ΪAIN0+ AIN0-
ADCH |= 0x01;
//
ADCDS |= 0x01;
// PGA 64±¶·Å´ó
PGAM = 0xC0|(1<<2);
// ¿ªÆôPGA
}
|