0
votes

So I enabled my program to try and accept interrupts, when a button is pushed. The ORIGINAL code without interrupts, or sound1, is just a single sound door.bell, that works when a button is pushed.

So as you can see, I am trying to add interrupts to try and change the value of SelTune which determines the type of sound the doorbell is set to play.

So my questions are: (1) How do I choose a specific button to act as an interrupt source rather than the whole default array of buttons 4-7 (RBIF)?

(2) Are there any other problems with the code that need fixing? Will it work? I ask this, as I am not able to test it now, as I don't have the necessary stuff with me.

Thanks a lot.

(trimmed)

INTERRUPT:
BTFSS INTCON,RBIF ;Test if a change on PORTB caused the interrupt
GOTO exit_interrupt  ;If not exit from the interrupt routine
    decfsz SelTune
BCF INTCON,RBIF  ;We should clear RBIF flag to enable it again
exit_interrupt NOP ;exit interrupt label
RETFIE   ;Enable general interrupts and return


END ;///////////////////////////////////////////////////////////////////////////
1

1 Answers

0
votes

Maybe you should check, in the interrupt routine, which key was pressed? Hard to say much more without any idea of the HW.