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

atmel 89c52 UART sample program

guys iam new to this area
i have started working on this thing since last week
i am testing UART program using 89c52 with baudrate 2.4k(0xf4). using 11.592 crystal and sample program is from atmel. nothing is coming out from that txd pin. please help me..

Parents
  • here is the code
    #include<at89X52.h>
    unsigned char outgoing;
    bit gone;
    void sertrans(void) interrupt 4 using 1
    { if(TI)
    { SBUF=outgoing;
    TI=0;
    gone=1;
    } }

    int main(void)
    { TMOD = 0x20;
    TH1 = 0xF4;
    SCON = 0x50;
    IE = 0x90;
    TR1 = 1;
    outgoing = 'A';
    gone = 0;
    TI = 1;
    while(1) { if (gone) { outgoing = 'A'; gone = 0; }
    } }

Reply
  • here is the code
    #include<at89X52.h>
    unsigned char outgoing;
    bit gone;
    void sertrans(void) interrupt 4 using 1
    { if(TI)
    { SBUF=outgoing;
    TI=0;
    gone=1;
    } }

    int main(void)
    { TMOD = 0x20;
    TH1 = 0xF4;
    SCON = 0x50;
    IE = 0x90;
    TR1 = 1;
    outgoing = 'A';
    gone = 0;
    TI = 1;
    while(1) { if (gone) { outgoing = 'A'; gone = 0; }
    } }

Children