TI_ISR_TRAP MSP430FR6989 - Page 1
Forum section: electronics / general

author: Mattjd
author_rank: Regular Contributor
timestamp: October 08, 2017, 05:14:34 pm
content: Hello,When I am executing my code, if I press down the button P1.1 during debugging mode, LED associated with P1.0 stops blinking. When I pause the debugging session, this file pops upCode:;******************************************************************************;* ISR_TRAP.ASM - v16.9.4 *;* *;* Copyright (c) 2003-2017 Texas Instruments Incorporated *;* http://www.ti.com/ *;* *;* Redistribution and use in source and binary forms, with or without *;* modification, are permitted provided that the following conditions *;* are met: *;* *;* Redistributions of source code must retain the above copyright *;* notice, this list of conditions and the following disclaimer. *;* *;* Redistributions in binary form must reproduce the above copyright *;* notice, this list of conditions and the following disclaimer in *;* the documentation and/or other materials provided with the *;* distribution. *;* *;* Neither the name of Texas Instruments Incorporated nor the names *;* of its contributors may be used to endorse or promote products *;* derived from this software without specific prior written *;* permission. *;* *;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *;* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *;* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *;* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *;* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *;* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *;* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *;* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *;* *;******************************************************************************;-----------------------------------------------------------------------------;-- default ISR handler if user does not supply;-- simply puts device into lpm0;-----------------------------------------------------------------------------.sect".text:_isr:__TI_ISR_TRAP".align2.global__TI_ISR_TRAP__TI_ISR_TRAP:BIS.W #(0x0010),SRJMP __TI_ISR_TRAPNOP ; CPU40 Compatibility NOP;******************************************************************************;* BUILD ATTRIBUTES *;* HW_MPY_INLINE_INFO=1: file does not have any inlined hw mpy *;* HW_MPY_ISR_INFO =1: file does not have ISR's with mpy or func calls *;******************************************************************************.battr "TI", Tag_File, 1, Tag_HW_MPY_INLINE_INFO(1).battr "TI", Tag_File, 1, Tag_HW_MPY_ISR_INFO(1)My codeCode:// Author: Matt Dxxxxxxxx// Lab: 3// Section: Button Delay// Device: FR6989#include <msp430.h>volatile unsigned int button_count;int main(void){WDTCTL = WDTPW | WDTHOLD; // stop watchdog timerPM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode// to activate previously configured port settingsP1DIR |= BIT0; // Set P1.0 to output direction -- LEDP9DIR |= BIT7; // Set P9.7 to output direction --- LEDP1DIR &= ~BIT1; // Set P1.1 to button inputP1REN |= BIT1; // Enable Pull Up Resistor for pin1.1P1OUT |= BIT1; //SPECIFIED AS A PULLUP FOR P1.1P1IES &= ~BIT1; //Have flag set on Low to HighP1IE |= BIT1; //enable interrupts for Pin 1.1P1IFG &= ~BIT1; //Clear Pin 1.1 flag so no immediate interruptP1DIR &= ~BIT2; // Set P1.2 to button inputP1REN |= BIT2; // Enable Pull Up Resistor for pin1.2P1OUT |= BIT2; //SPECIFIED AS A PULLUP FOR P1.2P1IES |= BIT2; //Have flag set on High to LowP1IE |= BIT2; //enable interrupts for Pin 1.1P1IFG &= ~BIT2; //Clear Pin 1.1 flag so no immediate interruptTA0CCTL0 |= CCIE; // TA0CCR0 interrupt enabledTA0CCR0 = 3277; //Set value of TA0CCR0 for comparisonTA0CTL |= TASSEL_1 + MC_1; //Pick ACLK & Set Counter to Up ModeTA0CTL |= TACLR; //Clear Timer A0TA1CCTL0 |= CCIE; // TA1CCR0 interrupt enabledTA1CCR0 = 512; //Set value of TA1CCR0 for comparisonTA1CTL |= ID_3; //Divide clock by 8, ACLK will be chosen, so 4096 hzTA1EX0 |= TAIDEX_7; //Divide ACLK further by 8 to 512 hzTA1CTL |= TACLR; //Clear Timer A1_enable_interrupt();for(;;){while(!(P1IN & BIT1)){if(TA1R == 0){TA1CTL |= TASSEL_1 + MC_1; //Pick ACLK & Set Counter to Up Mode}}}}#pragma vector = TIMER0_A0_VECTOR__interrupt void TimerA0_ISR (void){P1OUT ^= BIT0;}#pragma vector = TIMER1_A1_VECTOR__interrupt void TimerA1_ISR (void){P9OUT ^= BIT7;button_count++;}#pragma vector = PORT1_VECTOR__interrupt void P1_ISR(void){switch(P1IV){case P1IV_P1IFG1:{TA0CCR0 = 3277*button_count; //slow down blink speedbreak;}case P1IV_P1IFG2:{TA0CCR0 = 3277; //reset blink speedbreak;}}}What I am attempting to do is count the number of seconds that I have the button associated with P1.1 held down, so when I hold down the button, Timer A1 gets activated, every second it enters TimerA1_ISR, blinks LED P9.7 (to indicate a second has passed), and increments button_count. When I let go of button P1.1, I should enter P1_ISR and change the value TA0CCR0, which alters the led frequency (slowing it down) of P1.0I think something is wrong with my TimerA1_ISR but Idk what. I set a break for it, but never enter it. When I hold down the button, the LED P1.0 stops blinking, I pause the debugger and the isr_trap comes up.edit: when the LED stops blinking and I pause the debug, SR_CPUOFF = 1, indicating LPM0, which makes sense that the LED stops blinking.

author: Cervisia
author_rank: Regular Contributor
timestamp: October 09, 2017, 10:57:26 am
content: Those interrupt vector names can be confusing. From the gcc header file:Code:#define TIMER3_A1_VECTOR (33) /* 0xFFD0 Timer3_A2 CC1, TA */#define TIMER3_A0_VECTOR (34) /* 0xFFD2 Timer3_A2 CC0 */#define TIMER2_A1_VECTOR (36) /* 0xFFD6 Timer2_A3 CC1, TA */#define TIMER2_A0_VECTOR (37) /* 0xFFD8 Timer2_A3 CC0 */#define TIMER1_A1_VECTOR (39) /* 0xFFDC Timer1_A3 CC1-2, TA1 */#define TIMER1_A0_VECTOR (40) /* 0xFFDE Timer1_A3 CC0 */#define TIMER0_A1_VECTOR (44) /* 0xFFE6 Timer0_A5 CC1-4, TA */#define TIMER0_A0_VECTOR (45) /* 0xFFE8 Timer0_A5 CC0 */

author: Mattjd
author_rank: Regular Contributor
timestamp: October 09, 2017, 05:18:19 pm
content: How did you access that to find all of this?

author: Cervisia
author_rank: Regular Contributor
timestamp: October 09, 2017, 07:20:36 pm
content: Er, I just opened the msp430fr6989.h file in an editor and searched for those symbols.