This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Data recieved from UART does not latch on any Port

I have this very strange problem. I am recieving data on UART and when I try to throw the data on any port, it shows up mometarily on the port and then all the port goes to zero. I do not understand this but the code works fine in debugger with SIN command.Here is the code if any one want to give a suggestion .Thanks


#include "REG51CC01.h"

void serial_IT(void) interrupt 4 using 2
{

char uart_data=0;

if (RI == 1)
{
RI = 0; // clear reception flag
uart_data = SBUF; // Read data
P2=uart_data; //Output recieve data

}


}



void main (void)
{
unsigned char del=0;
SCON = 0x50; /* uart in mode 1 (8 bit), REN=1 */
T2CON &= 0xF0; /* EXEN2=0; TR2=0; C/T2#=0; CP/RL2#=0; */
T2CON |= 0x30; /* RCLK = 1; TCLK=1; */
TH2=0xFF; /* init value */
TL2=0xFD; /* init value */
RCAP2H=0xFF; /* reload value, 115200 Bds at 11.059MHz */
RCAP2L=0xFD; /* reload value, 115200 Bds at 11.059MHz */
ES = 1; /* Enable serial interrupt */
EA = 1; /* Enable global interrupt */
TR2 = 1; /* Timer 2 run */

while(1);

}

0