# 8051 baud rate

• posted

Hi all,

I am working on 8051 based Vehicle tracking system, which works on th following principle:

1. GPS system transmit the current longitude/latitude/GMT to MC
2. MC transmit this position information via a SMS to a mobile phon through a GSM device
3. Crystal freequency is 11.0592 MHz

I want to set the transmission baudrate of MC to GSM device at 1152000 t send the SMS massage.

The calculation for machine freequency = 11.0592 MHz/12/32 = 28800 Hz

28800/0.025 = 1152000, where 0.025 should be loaded in TH1, then wha should be the hex value & is this calculation correct?

1. should I chnage th crystal value to get the baud rate to 1152000. I so, Please suggest the crystal value

• posted

martin

• posted

principle:

GSM device

the SMS massage.

Do you actually want 1152000 (*very* fast) or 115200 (standard PC uart frequency)...?

If the former, you are quite out of luck with a standard 8051 - it just can't go that fast.

the hex value & is this calculation correct?

if by chance you mean 115200:

To calculate Timer-1 divisor:

divisor = crystal/384/baudrate

Note that only integer divisors in the range of 1-256 can be used.

To calculate the baudrate from the divisor:

baudrate = crystal/384/divisor

So the fastest baudrate you can get with this calculation and

11059200 Mhz is: 11059200 / 384 / 1 = 28800

But ... you may not have noticed the SMOD bit (PCON.7) - this but means: "Double the serial baud rate when using modes 1, 2 or 3 and Timer-1"

So: you can get: 28800*2 = 57600

1/2 way there, but not 115200.

To get 115200 using Timer-1 you would need double the crystal speed, or 22.118400 Mhz - Assuming you have an 8051 derivative that will go that fast (see NOTE1)

To get a baudrate of 1152000 you would need a crystal 10 times that frequency (221.184Mhz) - and I don't think you will find any 8051 derivative that can go that fast (wish ya could!)

If by chance you really have an 8052, then you have the option of using timer-2 to generate the baudrate. The formula is:

Baudrate = crystal/32/divisor

So with an 11.059Mhz 8032 you can get 115200 with a divisor of 3 which is quite possible.

To get 1152000 with a divisor of 1 (lowest), you would need 1152000x32 or 36.864 Mhz - I don't know if anyone makes an 8032 derivative that fast or not.

NOTE1: If you are using a faster 805x derivative, check the clocking and baudrate calculations, as they often are not the same as the original Intel spec.

NOTE2: When loading the divisor into the timer, you actually load (256-divisor) for Timer-1 and (65536-divisor) for Timer-2 - the timer counts up not down.

Dave

-- dave06a@ Low-cost firmware development tools: