Hi all,
Can someone please guide me on how to use a timer my situation?
As I understand that using __delay_cycles(15000); is not good solution for power consumption.
I do not want to use external cyrstal and prefer the lowest power internal oscillator, timing precision is not critical at all.
~1/4 second to 2 seconds of adjustable timer will be great.
Thanks,
Jay
#include <msp430.h> int main(void) { WDTCTL = WDTPW | WDTHOLD; P1DIR = 0xFF; P1OUT = 0x00; P2DIR = 0xFF; P2OUT = 0x00; P1OUT &= ~BIT0; P1DIR |= BIT0; P1OUT |= BIT3; P1REN |= BIT3; P1IES |= BIT3; P1IE |= BIT3; PM5CTL0 &= ~LOCKLPM5; P1IFG &= ~BIT3; while(1) { __bis_SR_register(LPM4_bits | GIE); P1OUT |= BIT0; __delay_cycles(15000); P1OUT &= ~BIT0; } } #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { P1IFG &= ~BIT3; __bic_SR_register_on_exit(LPM4_bits); }