Skip to content

Instantly share code, notes, and snippets.

@yamamaya
Created April 20, 2014 07:33
Show Gist options
  • Save yamamaya/11107646 to your computer and use it in GitHub Desktop.
Save yamamaya/11107646 to your computer and use it in GitHub Desktop.
// Timer1 interrupt handler
void __attribute__( ( interrupt ) ) _T1Interrupt( ) {
flag1 = 1;
flag2 = 1;
IFS0bits.T1IF = 0;
}
while ( 1 ) {
IEC0bits.T1IE = 0; // Disable Timer1 interrupt
f1 = flag1;
f2 = flag2;
flag1 = 0;
flag2 = 0;
IEC0bits.T1IE = 1; // Enable Timer1 interrupt
if ( ! f1 && f2 ) {
// what's up!?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment