Part Number: MSP430F5438A
Tool/software: Code Composer Studio
Hi,
I am doing a coursework, using MSP430F5438A microcontroller and Code Composer Studio v7.
My task is to measure the temperature and write it on the LCD. I have a digital temperature sensor with a PWM (gives duty-cycle) output, which goes on a P8.0/TA0.0.
All functions for LCD work properly, but the temperature is not being written on the LCD, even though interrupt function also works properly.
I am not sure if I have set all the registers correct. I have done this:
TA0CTL = TACLR; // Setting this bit clears TAR, the clock divider logic, and the count direction
TA0CTL = TASSEL__SMCLK | MC_2; // SMCLK, mode control: continual
TA0CCTL0 = CCIE | CM_1 | SCS | CAP | CCIS_1; // CCR0, capture on rising edge
In the interrupt function, I change Capture mode depending on the which of the half-periods I measure, positive or negative. I change it this way:
if (TA0CCTL0 & CCIFG) { // CCP0 interrupt
if ((TA0CCTL0 & CM_1) && (pp_done == 0)) { // rising edge
TA0CTL = TACLR; // Setting this bit clears TAR, the clock divider logic, and the count direction
TA0CTL = TASSEL__SMCLK | MC_2; // SMCLK, mode control: continual
TA0CCTL0 &= ~CM0;
TA0CCTL0 |= CM1; // Set CCP0 module interrupt on the falling edge
TA0CCTL0 &= ~CCIFG; // Reset the interrupt flag
}
...
}
Datasheet is given on the link http://www.ti.com/lit/ds/symlink/msp430f5438a.pdf
User’s Guide http://www.ti.com/lit/ug/slau208p/slau208p.pdf
Do you see any incorrect set-up?
Thank you in advance for your help.