HighTechPower
Member level 5
Hi. Recently I designed a circuit with PIC12F683. It's pins not working properly until I declare CMCON0 register although I'm not using it's internal comparator. Is it not true that to declare pins as digital or analog I have to use either CMCON0 or ANSEL register and not both. However when I omit the CMCON0 line in code below then circuit does not work properly (e.g. POWER_GOOD pin does not go high). I'm using ADC that is why I have declared ANSEL register.
Code:
#define POWER_GOOD GP0
void init_micro (void)
{
OSCCON = 0b01100111;
TRISIO = 0b00001010;
CMCON0 = CMCON0 | 0b00000100;
ANSEL = 0b01010010;
GPIO = 0b00000000;
POWER_GOOD = TRUE;
__delay_ms(100);
}