hasan mustafa

908lj12_interrupt_problem

Discussion created by hasan mustafa on Jul 25, 2007
Latest reply on Aug 7, 2007 by hasan mustafa
Dear All
 
i face a strange error; iam using two buttons PTD6 & PTD7,,,,,when i press any one of them, it goes for the interrupt serviseroutine, and do the same action,  the question is how can i distinguish between the two sources of Intrrupt;, 
 
my init.
Init_KBI:
      ; /;* Keyboard Interrupt KBI7 and KBI6 */
        mov #2,KBSCR;     /;* Falling edges only MODEK = 0 */
        ; /;* Enable 7 & 6 Keyboard interrupts */
       mov #$C0,KBIER;      
        BSET KBSCR_ACKK,KBSCR
          BCLR KBSCR_IMASKK,KBSCR
        rts
 
my ISR
 
KB_ISR:
  psha
       brclr PTD_PTD7,PTD,kbout7   ; I distinguish bet. the two Interrupts here
       BCLR KBIER_KBIE7,KBIER;
       mov #$FF ,LDAT9
        bra kbout

  kbout7:   
         brclr PTD_PTD6,PTD,kbout ; I distinguish bet. the two Interrupts here

        BCLR KBIER_KBIE6,KBIER;
        mov #1,ButtonFlag  
        bra kbout
    
      kbout:
   BCLR KBSCR_ACKK,KBSCR
    pula   
      rti
 
 
best regards
hasan

Outcomes