We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
Why do you have a while loop to set the TI bit? Don't you think a single assign would be enough to kick-start the transmission?