Hi, Does anyone have any sample code that shows how to set up uart 0 to use the internal Baud rate generator ?
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; }
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
Dear Andy, I am also facing the same problem with 89C669. Do you have any solution for this? Please help me. Thanks in advance. Suhas
View all questions in Keil forum