Hi All,
Glad to be back with an issue again. Recently i've been trying to receive data from an IR remote which used 38KHz Txer and an Encoder(HOLTEK's HOL6221A). I was able reverse engineer and got the codes beneath the keys(Row and Column) from the encode's datasheet. I'm using TSOP1738 as IR receiver. The data when Txed from Remote to IR Rxer,it is being received perfectly(Checked in Oscilloscope) though there timing constraints to be considered in depth.
I'm trying to receive and decode the 16-bit data from Remote using MSP430 Launchpad. I tried a for loop with an Interrupt enabled port pin(P1.3) to 16-bit long data.But couldn't find it useful. Then i figured out that it is possible and moved on to serial commn. When i'm trying to Rx data from UART Rx pin, using the below code, i was unsuccessful in doin so. I can't understand the problem with the code at all. I'm trying to watch the data using CCS Serial Window(with Target Config.) but couldn't have gone to Rx ISR at all even though i pressed the remote continuously. Is it the problem with interrupt triggering or the Hardware ,or the method i'm following.?? How can i achieve receiving the data(16-bit). Any other alternatives like SPI and I2C??? How it can be done?
After receiving the data, how i can check and compare and perform the actions accordingly to the key pressed.???
Please look the at Serial Rx module i wrote. The Remote's key configurations are there at first.
/*
Remote Controller Key Configurations
SW1 - R1,C7 - K25 -- 0001 100 0/1
SW2 - R1,C6 - K21 -- 0010 100 0/1
SW3 - R2,C7 - K26 -- 1001 100 0/1
SW4 - R2,C6 - K22 -- 1010 100 0/1
SW5 - R3,C7 - K27 -- 0101 100 0/1
SW6 - R3,C6 - K23 -- 0110 100 0/1
SW7 - R1,C8 - K29 -- 0011 100 0/1
SW8 - R2,C8 - K30 -- 1011 100 0/1
SW9 - R3,C8 - K31 -- 0111 100 0/1
*/
#include "msp430g2553.h"
//#define TXLED BIT0
#define RXLED BIT0
#define RXD BIT1
static unsigned char IR_data[16];
int i = 0;
void main (void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
DCOCTL = 0; // Select lowest DCOx and MODx settings<
BCSCTL1 = CALBC1_1MHZ; // Set DCO
DCOCTL = CALDCO_1MHZ;
P2DIR = 0xFF; // All P2.x outputs< //Disabling PORT2
P2OUT &= 0x00; // All P2.x reset
P1DIR |= RXLED;
P1SEL |= RXLED;
P1SEL |= RXD ;
P1DIR |= RXD;
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 0x08; // 1MHz 115200
//UCA0BR1 = 0x00; // 1MHz 115200
UCA0MCTL = UCBRS2 + UCBRS0; // Modulation UCBRSx = 5
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UC0IE |= UCA0RXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ int until Byte RXed
while (1)
{ }
}
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
P1OUT |= RXLED;
//for (i = 0; i <= 16; i++)
IR_data[i++] = UCA0RXBUF; // RX next character
if (i == sizeof IR_data - 1) // RX over?
UC0IE &= ~UCA0RXIE; // Disable USCI_A0 RX interrupt
P1OUT &= ~RXLED;
}