Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <xc.h>
- #include <stdint.h>
- uint8_t INT_CNT = 0; //initialisation of an interrupt counter
- void interrupt INTERRUPT_InterruptManager(void) {
- if (INT_CNT == 4) {
- INT_CNT = 0;
- }
- if (PIR4bits.TMR2IF == 1 && PIE4bits.TMR2IE == 1) //is interrupt "valid"
- {
- switch (INT_CNT) {
- case 0: LATC = 0x10;
- break;
- case 1: LATC = 0x20;
- break;
- case 2: LATC = 0x40;
- break;
- case 3: LATC = 0x80;
- break;
- }
- }
- PIR4bits.TMR2IF = 0; //clear interrupt flag
- INT_CNT++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement