Carlos Candido

Calculation (SCI baud rate)

Discussion created by Carlos Candido on Apr 14, 2006
Latest reply on Apr 19, 2006 by David Payne
Hi,
I always used in the GP32 9600baud.  but I want to use others baud_rate and in agreement the calculation of datasheet I am not obtaining to make formulates it for all baud_rate.
 
init_sci( baud );
----------------------------------------------
my_Fbus = 8000000mhz
SCC1 = 0x40;    
SCC2 = 0x2C;
SCBR = 0x30; = 9600baud
----------------------------------------------
calculation no run !!
SCBR = (unsigned char)((8000000UL /2 )  /baud / 64 *1 *4);
 
-------------------------------------------------
datasheet :

          Fbus = XTAL/4 2.4576 MHz *

 Baud Rate = -------------------- = ---------- = 9600 bps *

               64 x SCP1:0 x SCR2:0 64 x 1 x 4 *

SCBR = 0x02; /* Select a baud rate of 9600 bps with Fbus = 2.4576 MHz */

 

 

thanks

 

Outcomes