speedEC
Full Member level 6
Dear All,
I need some help on solving comparator issue on PIC16F628A. I have used Hi-Tech C compiler. I have not enabled GIE and since I have not used interrupt isr. This is the code that works fine.
But, The following code not works. I don't know why?
Thanks
I need some help on solving comparator issue on PIC16F628A. I have used Hi-Tech C compiler. I have not enabled GIE and since I have not used interrupt isr. This is the code that works fine.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 main(){ . // setting interrupts . . . while{ if (RBIF){ . . . } if (INTF){ . . . } BATT_LOW_LED = !BATT_STATUS_HIGH; // If C2OUT Low then Lit LED CMCON; // read CMCON CMIF = 0; // clear Comparator Flag CMIE = 1; // Enable Comparator Interrupt delay_ms(1000); SLEEP(); } }
But, The following code not works. I don't know why?
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 main(){ . // setting interrupts . . . while{ if (RBIF){ . . . } if (INTF){ . . . } if (CMIF != 0){ BATT_LOW_LED = !BATT_STATUS_HIGH; // If C2OUT Low then Lit LED CMCON; // read CMCON CMIF = 0; // clear Comparator Flag CMIE = 1; // Enable Comparator Interrupt delay_ms(1000); } SLEEP(); } }
Thanks