lpc932 uart baudrate

Started by jensenhu, February 13, 2005, 05:15:26 AM

Previous topic - Next topic

jensenhu

Hi:

I need to program lpc932 with the following baud rate for may application 600, 1200, 2400, 4800, 9600, 19200 with the selection of even, no or odd parity, data bit 7 or 8, stop bit 1 or 2.

I don't know if there is a place I can find out these settings. I use internal RC oscillator.


void UART_init()
{   
   SCON=0x50; // select BRG as UART Baud Rate Gen
   SSTAT=0x60; // separate Rx / Tx interrupts
   BRGR0=0xF0; // setup BRG for 9600 baud @ 7.373MHz internal RC oscillator
   BRGR1=0x02;
   BRGCON = 0x03;           // enable BRG
}


Thanks

Jensen

jensenhu

Hi :

I just found the values by using the formula from the lp932 user manual.
Here are the values if anyone needs it. I checked these values with PC hyperterminal program, all values work fine. The clock is internal RC oscillator. It is 7.3728 mhz

    //38400:B0, 19200:170, 9600:2F0, 4800:5F0, 2400:BF0, 1200:17F0, 600:2FF0, 300:5FF0
    //BRGR1,BRGR0 = HEX(7372800/BAUD RATE-16)
    //MODE 1 SCON=Ox50: no parity
    //MODE 3 SCON=OxD0: Even or odd parity have to be checked/set by software.

Jensen