Irda mode in msp430f5438 giving constant output for all commands.

Thread Starter

Manasu24

Joined Jan 12, 2015
1
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:
void irda_init(void)
{
System_printf("in irda init\n");
System_flush();
   UCA1CTL0 =0x00;
   UCA1CTL1 |= UCSWRST;                      // Set SW Reset
   UCA1CTL1 = UCSSEL_2 + UCSWRST;
   UCA1BR0 = 3;                          // Baudrate = 9600
   UCA1BR1 = 0;
   UCA1MCTL = UCBRS_7 + UCBRF_0 + UCOS16;
   UCA1IRTCTL = UCIRTXPL2 + UCIRTXPL0 + UCIRTXCLK + UCIREN;
   UCA1IRRCTL = UCIRRXPL;                    // Light = low pulse
   UCA1CTL1 &= ~UCSWRST;                      // Resume operation
   UCA1IE |= UCRXIE;                        // Enable RX int
System_printf("out irda\n");
System_flush();
}
void hwi_irda(void)
{
   UCA1IE &= ~UCRXIE;                        // Enable RX int
   System_printf("data=> %d \n",UCA1RXBUF);
   System_flush();
   UCA1RXBUF=0;
   UCA1IE |= UCRXIE;                        // Enable RX int
}
Output:

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

THANKS IN ADVANCE
 
Top