Irda mode in msp430f5438 giving constant output for all commands.

Discussion in 'Embedded Systems and Microcontrollers' started by Manasu24, Jan 12, 2015.

  1. Manasu24

    Thread Starter New Member

    Jan 12, 2015
    1
    0
    Hi,
    I have been trying to use the inbuilt IrDA decoder and encoder in msp430f5438.
    but it is giving output as 255 always and for all type of commands and for all different remotes.
    the ir receiver i am using is TSOP38438.
    Please help me if you can.



    Code (Text):
    1.  
    2. void irda_init(void)
    3. {
    4. System_printf("in irda init\n");
    5. System_flush();
    6.    UCA1CTL0 =0x00;
    7.    UCA1CTL1 |= UCSWRST;                      // Set SW Reset
    8.    UCA1CTL1 = UCSSEL_2 + UCSWRST;
    9.    UCA1BR0 = 3;                          // Baudrate = 9600
    10.    UCA1BR1 = 0;
    11.    UCA1MCTL = UCBRS_7 + UCBRF_0 + UCOS16;
    12.    UCA1IRTCTL = UCIRTXPL2 + UCIRTXPL0 + UCIRTXCLK + UCIREN;
    13.    UCA1IRRCTL = UCIRRXPL;                    // Light = low pulse
    14.    UCA1CTL1 &= ~UCSWRST;                      // Resume operation
    15.    UCA1IE |= UCRXIE;                        // Enable RX int
    16. System_printf("out irda\n");
    17. System_flush();
    18. }
    19. void hwi_irda(void)
    20. {
    21.    UCA1IE &= ~UCRXIE;                        // Enable RX int
    22.    System_printf("data=> %d \n",UCA1RXBUF);
    23.    System_flush();
    24.    UCA1RXBUF=0;
    25.    UCA1IE |= UCRXIE;                        // Enable RX int
    26. }
    27.  
    28.  
    29.  
    Output:

    data=> 255
    data=> 255
    data=> 255
    data=> 255
    data=> 255
    data=> 255
    data=> 255
    data=> 255

    THANKS IN ADVANCE
     
Loading...