Hi Pablo,
As sougata mentioned, you'll have problems with switch bounce and button press duration causing repeated interrupt flag resets.
Since your code is not 'seeing' an interrupt until after the PWM statements are finished, why not just test the state of the interrupt flag in the pauses in between your PWM loops?
As far as interrupting on power up without a button press, you might try a bit a a pause at the start of the program, then clear the interrupt flags.
Arch
EDIT - ooh... that won't work 'cause it won't sort out the different buttons - darn!




Bookmarks