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

Using Built in Baud rate generator on 89C669

Hi,

Does anyone have any sample code that shows how to set up uart 0 to use the internal Baud rate generator ?

Parents Reply Children
  • My Code for Using Built in baud generator for both serial ports. Hope it helps :-

    // initialise on board comms
    BRGCON = 0;
    //12 MHz
    BRGR0 = 0xD2;
    BRGR1 = 0x4; //Set To Baud rate generator to 9600
    //11.0592 MHz
    // BRGR0 = 0x7E;
    // BRGR1 = 0x4; //Set To Baud rate generator to 9600

    BRGCON = 3;
    T2CON = 0x30; // RCLK=1. TCLK = 1, Timer 2 Disabled


    SCON = 0x50; // SCON: mode 1, 8-bit UART, enable rcvr
    REN_0 = 1;
    ES0 = 1; // Enable Interrupt
    TI_0 = 1; // TI: set TI to send first char of UART

    //Uart 2
    S1CON = 0x50; // SCON: mode 1, 8-bit UART, enable rcvr
    REN_1 = 1;
    ES1 = 1;
    TI_1 = 1; // TI: set TI to send first char of UART