Other Parts Discussed in Thread: MSP430FR6989
Tool/software: Code Composer Studio
Hello ,
I am making CAPTURE PROGRAM.
I am using MSP430FR6972 (I am making a pulse counter)
My intention is 1) to take the analog Value through capture program,
2) and then send to value to scope (to check the frequency).
I am also using UART program , and checking the "Tx data" to scope
( I am not sure...i am doing correct or not ...... The data received by CAPTURE .....is sending via uart)
But I am getting some random value at SCOPE ( some time MHz, sometimes KHz)
unsigned int timerAcapturePointer = 0; int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer PM5CTL0 &= ~LOCKLPM5; //===============================PIN DEFINED=========================================== P1SEL0 |=BIT3 ; // Pulse Capture P1SEL1 &=~BIT3; P1DIR &=~BIT3; //====================================CLOCK============================================== /* // Clock System Setup CSCTL0_H = CSKEY >> 8; // commented CSCTL2 |= SELA_7; //commented CSCTL2 |= SELA__VLOCLK; // commented CSCTL0_H = 0x00; // commented // __delay_cycles(1000); // commented */ CSCTL0_H = CSKEY >> 8; CSCTL1 = DCOFSEL_0; CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK; CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; CSCTL4 &= ~LFXTOFF; do { CSCTL5 &= ~LFXTOFFG; SFRIFG1 &= ~OFIFG; }while (SFRIFG1&OFIFG); CSCTL0_H = 0; //======================================================================================= // LCD_init(); //commented uart_init(); // adc(); //commented //=================CAPTURE ============================================================ // Timer0_A3 Setup TA0CCTL2 = CM_1 | CCIS_1 | SCS | CAP | CCIE; // Capture rising edge,Use CCI2B=ACLK,Synchronous capture,Enable capture mode,Enable capture interrupt TA0CTL = TASSEL__SMCLK | MC__CONTINUOUS; // Use SMCLK as clock source,Start timer in continuous mode while(1) { __bis_SR_register(LPM3_bits | GIE); } } TIMER INTERRUPT : #pragma vector = TIMER0_A1_VECTOR __interrupt void Timer0_A1_ISR(void) { switch (__even_in_range(TA0IV, TA0IV_TAIFG)) { case TA0IV_TA0CCR1: break; case TA0IV_TA0CCR2: timerAcapturePointer = TA0CCR2; putchar(timerAcapturePointer); __delay_cycles(100000); LPM3_EXIT; break; case TA0IV_TA0IFG: break; default: break; } } I am using MSP430FR6972. And I want to check the Frequency on the "SCOPE". There is NO PROBLEM with UART.
CAN YOU PLEASE CHECK IT,,
AND PLEASE TELL ME .....
where Am I doing wrong?
(I m not sure of the program too......so please response)
Regards,
Srijit.