while(TRUE) {
//This are to prove that the comparator are actually working by toggling a LED when an interrupt occurs
if (interrupt_active(INT_TIMER2)) {
clear_interrupt(INT_TIMER2);
if (interrupt_active(INT_COMP2)) {
clear_interrupt(INT_COMP2);
output_toggle(LED);
}
}
Cnt = CM2CON0;
clear_interrupt(INT_COMP2);
sleep();
//To check when it comes out of sleep
delay_cycles(1);
output_toggle(LED);
delay_ms(500);
output_toggle(LED);
}
}
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Tue Jun 18, 2019 9:33 am
Here is part of the interrupt list from the 16F1825.h file.
The one you need is shown in bold. Enable it. This one
acts as a gate for the comparator interrupt and others.
Joined: 12 Nov 2012 Posts: 357 Location: South Africa
Posted: Tue Jun 18, 2019 9:51 am
Well done PCM.
Armed with this info I looked through the datasheet again and noticed it, probably won't forget this one in a while, and even then I probably would have used the getenv to locate the bit.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum