Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 63713

Forum Post: RE: measuring current in sleep mode

$
0
0
thank you for ur reply... I have initialized the clock frequency ...even then for LPM4 i'm not getting current value as 0.1 uA getting 50 micro amps..here is my code #include #define LED0 BIT0 #define LED1 BIT6 #define BUTTON BIT3 static int control; //to make the value non-volatile int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; P1DIR = 0x00; P1OUT = 0x00; P1DIR |= (LED0 + LED1); // Set P1.0 to output direction P1OUT &= ~(LED0 + LED1); // set P1.0 to 0 (LED OFF) P1IE |= BUTTON; // P1.3 interrupt enabled P1IES |= BUTTON; // P1.3 Hi/lo edge P1IFG &= ~BUTTON; // P1.3 IFG cleared __enable_interrupt(); // enable all interrupts _BIS_SR(LPM4_bits + GIE); // Enter LPM4 w/interrupt } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { P1IFG &= ~BUTTON; // P1.3 IFG cleared control++; //incrementing interrupt count if(control == 10) //checking the count value { P1OUT ^= (LED0 + LED1); // P1.0 = toggle control = 0;//making control to zero } }

Viewing all articles
Browse latest Browse all 63713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>