Skip to content

Instantly share code, notes, and snippets.

@blondie7575
Created August 19, 2012 23:49
Show Gist options
  • Save blondie7575/3398663 to your computer and use it in GitHub Desktop.
Save blondie7575/3398663 to your computer and use it in GitHub Desktop.
AVR interrupt setup
// Configure INT2 (interrupt 2, on line PB2) to be a rising
// edge interrupt that we'll get from the CPU
// See ATmega324PA datasheet p68
cbi EIMSK,INT2_BIT
ldi accum,EICRA
ori accum,_BV(ISC20) | _BV(ISC21)
sts EICRA,accum
cbi EIFR,INTF2
sbi EIMSK,INT2_BIT
...
INT2_vect:
sbi PORTB,led
reti
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment