Other Parts Discussed in Thread: TIR1000
Tool/software: Code Composer Studio
Hello,
I am using MSP430FR6972 with TIR1000.
My plan is to receive data through IRDA(Rx pin of UART1) and send that data to Serial Monitor via 'UART0'.
I have used PWM program (P1.0) for 16xclock cycle.
I am trying to receive the program,
but it is not working.
I upload the program below.
Can you please tell me,
what I am doing wrong.?
Regards,
Srijit.
int main(void){ WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer PJSEL0 = BIT4 | BIT5; PJDIR = 0xFFFF; //IRRx-------------------------- P1DIR |= BIT0; // P1.0 PWM P1SEL0 |= BIT0; //PIN DEFINE=========================================================================== PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode //IRDA================================================================================ CSCTL0_H = CSKEY >> 8; CSCTL1 = DCOFSEL_3; 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(); uart_init(); ////UART0 //PWM------------------------------------------- TA0CCR0 = 103; // PWM Period ( 104......38400Hz that is 16x clock of 2400) TA0CCTL1 = OUTMOD_3; // CCR1 reset/set TA0CCR1 = 20; // CCR1 PWM duty cycle P1.0 (3/16 LOW) TA0CTL = TASSEL__SMCLK | MC__UP | TACLR; // SMCLK, up mode, clear TAR ird_rx() ; while(1) { //======IRDA============================== //------receive------------------------------------------------------------------- // putchar('S'); __bis_SR_register(GIE + LPM3_bits); //// // putchar(RxByte); ////UART0 ....working properly __delay_cycles(50000); //// } // return 0; } IRDA PROGRAM : void ird_rx(void) /////transmitting valued----data REAL DATA & Receive not working { P3SEL0 |= BIT5 | BIT4; // irda operation RX P3SEL1 &= ~(BIT5 | BIT4); UCA1CTLW0 |= UCSWRST ; //Transmitting some values UCA1CTL1 |= UCSSEL__SMCLK ; UCA1BR0 = 104; //2400 /4 mhz UCA1BR1 = 0; UCA1MCTLW |= UCOS16 | UCBRF_3 ; UCA1IRTCTL = UCIRTXPL2 + UCIRTXPL0 + UCIRTXCLK + UCIREN; UCA1IRRCTL = UCIRRXPL; // UCA1IRCTL = UCIRTXPL2 + UCIRTXPL0 + UCIRTXCLK + UCIRRXPL + UCIRRXFL2 + UCIRRXFE + UCIREN; UCA1CTL1 &= ~UCSWRST ; UCA1IE |= UCRXIE; } #pragma vector=USCI_A1_VECTOR __interrupt void USCIA1RX_ISR (void) { RxByte = UCA1RXBUF; putchar(RxByte); ////UART0 ....TRANSMIT BY UART0 LPM3_EXIT; }