Jump to content

retnuH

Members
  • Content Count

    6
  • Joined

  • Last visited

Everything posted by retnuH

  1. Hi, what do people suggest to use for debugging on Mac OSX when writing programs in Energia? Is using MSPDebug with the embedded msp430-gcc the best way to go? Or is perhaps a more complete solution like bsp430 a better way to go, with more controllable makefiles, etc? Cheers, H
  2. retnuH

    Problem with interrupts on P1 and a timer

    Thanks, you've been really helpful!
  3. Hi there, I'm trying to write something that tries to use power as efficiently as possible. The main idea is that the circuit will be in LPM4 most of the time, until a button is pressed. Once pressed, the button will start a timer, go into LPM3, and some led's will blink periodically (for a few seconds). Once thats done, it will just go back to LPM4 and wait for the button to be pressed again. For simplicity, I'm just trying to get things working in LPM0 (I think I've got the switching modes worked out ok) on a Launchpad with the -2553 chip. I'm using Energia with the msp430-gcc toolchain. So far, the button press starts the timer, and the lights flash ok, but for some reason, it won't respond to a second button press. I've tweaked and fiddled a fair bit, but I'm a bit stumped. Not really sure how to proceed! Any advice appreciated, H #include #define GREEN_LED_MASK BIT6 #define RED_LED_MASK BIT0 #define PUSH2_MASK BIT3 unsigned char count = 0; unsigned char times = 0; unsigned int mode = LPM0_bits; void setup() { P1DIR = (GREEN_LED_MASK | RED_LED_MASK); pinMode(PUSH2, INPUT_PULLUP); digitalWrite(RED_LED, HIGH); digitalWrite(GREEN_LED, LOW); do { P1IFG = 0; } while (P1IFG != 0); P1IE = PUSH2_MASK; P1IES = 0; eint(); } void loop() { _BIS_SR(mode); } interrupt (TIMER0_A0_VECTOR) TA0_ISR(void) { if (++count > 2*times) { P1OUT = GREEN_LED_MASK; TACTL = TACLR; count == 0; } else { P1OUT ^= GREEN_LED_MASK | RED_LED_MASK; } } interrupt (PORT1_VECTOR) PORT1_ISR(void) { ++times; do { P1IFG = 0; } while (P1IFG != 0); P1OUT = RED_LED_MASK; TACCR0 = 0x1FFF; TACCTL0 = CCIE; // Set up Timer A "Up to CCR0" mode, divide by 2^n, clock from SMCLK (2)/ACLK (1), clear timer TACTL = MC_1 | ID_0 | TASSEL_1 | TACLR; }
  4. retnuH

    Problem with interrupts on P1 and a timer

    I actually joined the forum on Thursday, just before the switchover, and made my first post then, so I was just using the old forum link from the 43oh main site. I received the reply notification email and just followed the link. Didn't even realize there was going to be a change until I followed the link! H
  5. retnuH

    Problem with interrupts on P1 and a timer

    Thanks a million, the clearing of the bit in POUT explained everything. Thanks also for the Energia specific advice, I appreciate it! The thanks buttons seemed to have gone with the recent forum change, so I "liked" the post until I figure out how to do otherwise. Thanks again, H
  6. retnuH

    Problem with interrupts on P1 and a timer

    I got your sample to work, thanks! Still can't figure out why my interrupt on P1 stops working in my code, though. Are there any cases where interrupts are automatically enabled or disabled?
×