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

P89c669 Serial Interrupt for UART 1

Hi All

i had tried to communicate the p89c669 uart1 with the PC with what ever char i had type thatshould display on Hypretrrminal, but hear i am facing problem, in my program i had created the 9600 baudrate using this following(11.0592MHz)

BRGCON = 0x00;
BRGR1 = 0x04;
BRGR0 = 0x7E;
IEN1 = 0x01;

but in serial isr which interrupt number i had to mention.
and S1BUF is not at all receiving any character..

Please Guide me whether i did any wrong..

#include<reg669.h>

unsigned char c = '\0';

void serial_init()
{
   BRGCON = 0x00;
   BRGR1  = 0x04;
   BRGR0  = 0x7E;
   BRGCON = 0x01;
   IEN1  |= 0x01;
   TI_1   = 1;
   RI_1   = 0;
}
void serial_isr(void) interrupt 7 using 1
{
    if(RI_1)
    {
       c = S1BUF;
       RI_1 = 0;
       TI_1 = 1;
     }
     else if(TI_1)
     {
        if(c != '\0')
            S1BUF = c;
        TI_1 = 0;
      }
}
void main(void)
{
    serial _init();

    while(1){}
}

Thanks in Advance

0