This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430FR6989: Multiple Interrupts

Part Number: MSP430FR6989
Other Parts Discussed in Thread: BOOSTXL-EDUMKII

Tool/software: Code Composer Studio

Hi I am trying to run a code which has multiple interrupts set in, such as the vector interrupt for ADC12 signals and  an interrupt for push-buttons. The ADC signals work fine. However, the button interrupt does not seem to be working. What can be the possible reason for this? My launchpad (MSP430FR6989) is hooked up to the Booster Pack BOOSTXL-EDUMKII and I am trying to use the buttons on the BoosterPack (corresponding to P3.0 and P3.1 on the launchpad). Given below is a simplified version of the code:

 

;-------------------------------------------------------------------------------
            .cdecls C,LIST,"msp430.h"       ; Include device header file
;-------------------------------------------------------------------------------
;--- external references -------------------------------------------------------
            .ref initGPIO
            .ref initClocks
            .ref myLCD_init
            .ref myLCD_showChar
            .ref myLCD_displayNumber
            .def    RESET                   ; Export program entry-point to
                                            ; make it known to linker.
;-------------------------------------------------------------------------------
            .global _main
            .global __STACK_END
            .sect   .stack                  ; Make stack linker segment ?known?

            .data
LISTI: .word 0x0000,0x0001,0x0002,0x0001,0x0003,0x0000,0x0001,0x0004,0x0000,0x0001,0x0005,0x0000          ; first element initially 0000
VAR1: .space 2
VAR2: .space 2
VARX: .space 2
VARY: .space 2
VARZ: .space 2
VARS: .space 2
VARLA: .space 2
VARIND: .space 2
VARSCR: .space 2
VARSHK: .space 2
VAREXT: .space 2

      .bss Result, 2


            .text                           ; Assemble to Flash memory
            .retain                         ; Ensure current section gets linked
            .retainrefs

_main
RESET       mov.w   #__STACK_END,SP         ; Initialize stackpointer
StopWDT     mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT

         call	#initGPIO
	     ;calla	#initClocks
	     call	#myLCD_init

                           bic.b #BIT3,&P3OUT
                           bic.b #BIT6,&P2OUT
                           bic.b #BIT6,&P3OUT
SetUpBoosterLed            bis.b #BIT6,&P3DIR
                           bis.b #BIT6,&P2DIR
                           bic.b #BIT3,&P3OUT
                           bic.b #BIT6,&P2OUT
                           bic.b #BIT6,&P3OUT


SetupGPIO   bic.b   #BIT0,&P1OUT            ; Clear LED to start
            bis.b   #BIT0,&P1DIR            ; P1.0 output

            bic.b   #BIT7,&P9OUT            ; Clear LED to start
            bis.b   #BIT7,&P9DIR            ; P1.0 output
            ;bis.b   #BIT1,&P1SEL1           ;
            ;bis.b   #BIT1,&P1SEL0           ;

            bic.b   #BIT0,&P3DIR            ; Set P3.0 as an input button with pull-up resistor
            bis.b   #BIT0,&P3REN
            bis.b   #BIT0,&P3OUT

            bic.b   #BIT1,&P3DIR            ; Set P3.1 as an input button with pull-up resistor
            bis.b   #BIT1,&P3REN
            bis.b   #BIT1,&P3OUT


SetupP9     bis.b   #BIT2,&P9SEL0           ;
            bis.b   #BIT2,&P9SEL1           ;


            mov.w   #0x0002, R10            ;
            mov.w   #0x0000, R8
            bis.b #BIT7, &P2DIR              ;100 600 200  (Bad Noise)

SetupP8     bis.b #BIT7,&P8SEL0
            bis.b #BIT7,&P8SEL1

            bis.b #BIT6,&P8SEL0
            bis.b #BIT6,&P8SEL1

            mov.w #0,&VARSCR

            mov.w #0x0000,&VARIND
            mov.w #0,R5

UnlockGPIO  bic.w   #LOCKLPM5,&PM5CTL0      ; Disable the GPIO power-on default
                                            ; high-impedance mode to activate
                                            ; previously configured port setting
ButnInterrupt
            bis.b   #BIT0,&P3IES            ; Configure P3.0 as a high-to-low interrupt
            bic.b   #BIT0,&P3IFG
            bis.b   #BIT0,&P3IE

            bis.b   #BIT1,&P3IES            ; Configure P3.1 as a high-to-low interrupt
            bic.b   #BIT1,&P3IFG
            bis.b   #BIT1,&P3IE


SetupADC12  mov.w   #ADC12SHT0_2+ADC12ON+ADC12MSC,&ADC12CTL0 ; 16x
            bis.w   #ADC12SHP+ADC12CONSEQ_1,&ADC12CTL1    ; ADCCLK = MODOSC; sampling timer
            bis.w   #ADC12RES_2,&ADC12CTL2  ; 12-bit conversion results

            bis.w   #ADC12INCH_10,&ADC12MCTL0; A10 ADC input select; Vref=AVCC Joystick hor
            bis.w   #ADC12INCH_4,&ADC12MCTL1 ; A4 Joystick Vertical

            bis.w   #ADC12INCH_5+ADC12EOS,&ADC12MCTL2 ; A5 Accelerometer Z

            bis.w   #ADC12IE2,&ADC12IER0    ; Enable ADC conv complete interrupt
                     

Mainloop    mov.w   #35000,R15               ; Delay ~5000 cycles between conversions
L1          dec.w   R15                     ; Decrement R15
            jnz     L1                      ; Delay over?
            bis.w   #ADC12ENC+ADC12SC,&ADC12CTL0 ; Start sampling/conversion
            nop                             ;
            bis.w   #LPM0+GIE,SR            ; Enter LPM0 w/ interrupt
            nop                             ; for debug
            jmp     Mainloop                ; Again
            nop
NeedHere
;-------------------------------------------------------------------------------
ADC12_ISR;  ADC12 interrupt service routine
;-------------------------------------------------------------------------------
            add.w   &ADC12IV,PC             ; add offset to PC
            reti                            ; Vector  0:  No interrupt
            reti                            ; Vector  2:  ADC12MEMx Overflow
            reti                            ; Vector  4:  Conversion time overflow
            reti                            ; Vector  6:  ADC12HI
            reti                            ; Vector  8:  ADC12LO
            reti                            ; Vector 10:  ADC12IN
            jmp     MEM0                    ; Vector 12:  ADC12MEM0 Interrupt
            jmp     MEM1                    ; Vector 14:  ADC12MEM1
            jmp     MEM2                    ; Vector 16:  ADC12MEM2
            reti                            ; Vector 18:  ADC12MEM3
            reti                            ; Vector 20:  ADC12MEM4
            reti                            ; Vector 22:  ADC12MEM5
            reti                            ; Vector 24:  ADC12MEM6
            reti                            ; Vector 26:  ADC12MEM7
            reti                            ; Vector 28:  ADC12MEM8
            reti                            ; Vector 30:  ADC12MEM9
            reti                            ; Vector 32:  ADC12MEM10
            reti                            ; Vector 34:  ADC12MEM11
            reti                            ; Vector 36:  ADC12MEM12
            reti                            ; Vector 38:  ADC12MEM13
            reti                            ; Vector 40:  ADC12MEM14
            reti                            ; Vector 42:  ADC12MEM15
            reti                            ; Vector 44:  ADC12MEM16
            reti                            ; Vector 46:  ADC12MEM17
            reti                            ; Vector 48:  ADC12MEM18
            reti                            ; Vector 50:  ADC12MEM19
            reti                            ; Vector 52:  ADC12MEM20
            reti                            ; Vector 54:  ADC12MEM21
            reti                            ; Vector 56:  ADC12MEM22
            reti                            ; Vector 58:  ADC12MEM23
            reti                            ; Vector 60:  ADC12MEM24
            reti                            ; Vector 62:  ADC12MEM25
            reti                            ; Vector 64:  ADC12MEM26
            reti                            ; Vector 66:  ADC12MEM27
            reti                            ; Vector 68:  ADC12MEM28
            reti                            ; Vector 70:  ADC12MEM29
            reti                            ; Vector 72:  ADC12MEM30
            reti                            ; Vector 74:  ADC12MEM31
            reti                            ; Vector 76:  ADC12RDY

MEM2
            mov.w   &ADC12MEM2,&VARZ
            mov.w   &ADC12MEM1, R9
            mov.w   &ADC12MEM0, R14
            ;DO STUFF

ExitLPM0    bic.w   #LPM0,0(SP)             ; Exit
            reti



MEM0                   ; Clear LED as default
            bic.w   #LPM0,0(SP)
            reti
MEM1                   ; Clear LED as default
            bic.w   #LPM0,0(SP)
            reti
;-------------------------------------------------------------------------------
PORT3_0_ISR;    P3.0 Interrupt Service Routine
;-------------------------------------------------------------------------------


            bit.b #BIT1, &P3IFG
            jnz Pin3_1Stuff

            sub.w #4, SP               ; DEBOUNCING ACCOUNTED
            mov.w #5000, 0(SP)
            clr.w 2(SP)



testloop    bit.b #BIT0, &P3IN
            jnz   not_down
            inc.w 2(SP)
not_down    dec.w 0(SP)
            jnz   testloop

;---------------LOOP COMPLETED ---------------

            cmp.w #800, 2(SP)
            jl    exit
            bic.b   #BIT0, &P3IFG
            ;DO STUFF
;--------------EXIT ISR ----------------------
exit:       clr.b &P3IFG
            add.w #4, SP
            jmp SKipthere
Pin3_1Stuff
            sub.w #4, SP                 ; Accounting for Debouncing of switches
            mov.w #5000, 0(SP)
            clr.w 2(SP)

testloop2    bit.b #BIT1, &P3IN
             jnz   not_down2
             inc.w 2(SP)
not_down2   dec.w 0(SP)
            jnz   testloop2

;---------------LOOP COMPLETED ---------------


          cmp.w #800, 2(SP)
          jl    exit2
          bic.b #BIT1, &P3IFG
           
          ; DO STUFF

exit2:      clr.b &P3IFG
            add.w #4, SP
SKipthere
            reti

;------------------------------------------------------------------------------
;           Interrupt Vectors
;------------------------------------------------------------------------------
            .sect   ".reset"                ; MSP430 RESET Vector
            .short  RESET                   ;
            .sect   ADC12_VECTOR            ; ADC12 Vector
            .short  ADC12_ISR               ;
            .sect   ".int37"                ;Button Interrupt
            .short  PORT3_0_ISR
            .end
;-------------------------------------------------------THE END--------------------------------------------------------------------------------------------------------------------------------------------

**Attention** This is a public forum