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

Serial ISR not sending given SBUF character

Dear All,

I am trying to send constant character for testing my serial ISR routine behavior. With following code I am not receiving any characters at PC hyperterminal.

void init_serial(void)
{

SCON = 0x50;
T2CON =0x34;
RCAP2H=0xFF; //57.6K Bds at 20 MHz
RCAP2L=0xF5; //57.6K Bds at 20 MHz

ES = 1; // Enable serial interrupt
TR2 = 1; // Timer 2 run
TI = 0;
RI = 0;

} // end void init_serial(void)

static void MODEMHandler(void) interrupt 4 using 2
{

unsigned char RxData;
if (RI)

{
RxData = SBUF;
RI = 0;

}
if(TI)

{
SBUF = 0x41;
TI = 0;

}

}

void main(void)
{

init_serial();
EA = 1 ; /* enable global interrupts */

while(1)

{

TI = 1;

}

}

What's the wrong with this code?

Thanks.