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
  • Hi

    #define Kristall        19660800
    #define Baud            19200
    #define	BRATE		(Kristall/Baud)-16
    
    void    StartRS232(void)
    {
    BRGR0 = BRATE & 0x00ff;
    BRGR1 = (BRATE & 0xff00) / 256;
    SM0_0 = 0;
    SM1_0 = 1;
    SM0_1 = 0;
    SM1_1 = 1;
    RCLK = 1;
    TCLK = 1;
    BRGCON = 0x03;
    REN_0 = 1;
    REN_1 = 1;
    TI_0 = 1;
    TI_1 = 1;
    }
    

Reply
  • Hi

    #define Kristall        19660800
    #define Baud            19200
    #define	BRATE		(Kristall/Baud)-16
    
    void    StartRS232(void)
    {
    BRGR0 = BRATE & 0x00ff;
    BRGR1 = (BRATE & 0xff00) / 256;
    SM0_0 = 0;
    SM1_0 = 1;
    SM0_1 = 0;
    SM1_1 = 1;
    RCLK = 1;
    TCLK = 1;
    BRGCON = 0x03;
    REN_0 = 1;
    REN_1 = 1;
    TI_0 = 1;
    TI_1 = 1;
    }
    

Children
No data