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.

Count external pulse from a water flow sensors

Other Parts Discussed in Thread: MSP430G2553

Hello everybody,

I am a beginner with MSP430, and I want to do an object who measure water flow, and display it on a LCD screen. I developed it with an arduino platform: I use hardware counter of the atmel chip.

But, I want to do this object with low power consumption (with battery), so I have started to develop it with the msp 430 launchpad.

#include <msp430g2553.h>

 

void main(void) {

       WDTCTL = WDTPW + WDTHOLD;               // Stop watchdog timer

       TA0CCR0 = 0xFFFF;                              // Count limit (16 bit)

       P1SEL |= BIT0;                            // Use P1.0 as TimerA input

       P1SEL2 &= ~BIT0;                            //

       P1DIR &= ~BIT0;                             //

       P1OUT &= ~BIT0;                             // Enable pull down resistor to reduce stray counts

       P1REN |= BIT0;

       TA0CCTL0 = 0x10;                               // Enable counter interrupts, bit 4=1

       TA0CTL |= TACLR;

       TA0CTL |= TASSEL_0 + MC_1;

       _BIS_SR(LPM0_bits + GIE);           // LPM0 (low power mode) with interrupts enabled

}

 

#pragma vector=TIMER0_A0_VECTOR

   __interrupt void Timer0_A0 (void) {         // Timer0 A0 interrupt service routine

 

       //P1OUT ^= BIT0;                                      // Toggle red LED

}

 

My program work, but I’m not able to select another pin, It work only with the P1.0 pin. Is it possible to select another input? Is my program is good?

 

I want to print it on a small screen, with low power, any idea for it?

 

Thanks you in advance, sorry for my bad English

 

Kind regards  

**Attention** This is a public forum