Log in

View Full Version : Hser Baud Calculator



carl_schell
- 12th January 2005, 20:39
Hi all -

I am in the middle of a project and got tired of having to calculate HSER_SPBRG values - so I created a calculator in excel to do so more easily. I tried to make it very straight forward.

All you do is type in 3 inputs (in the yellow boxes)

1.) Ocs. Speed ie: 4
2.) HSER_BAUD ie: 9600
3.) HSER_TXSTA ie: 24h

and the HSER_SPBRG value is calculated as is your actual Baud Rate and the % Error.

It checks to see if you are using High speed or Low speed because there are 2 different formulas.

Hope it helps you. It is an excel spreadsheet - but the forum won't let me post it as that - so I am attaching it with the as a ".txt" - so you will have to change the ".txt" to ".xls"

=>Right click on link - click "save target as" - change type to "all" - and rename extension to ".xls" - this should work -

Best Regards,
Carl

-------------------------------------------------------
PIC Development Boards with Bootloader!

www.schellelectronics.com

Free shipping worldwide

e-mail: [email protected]
-------------------------------------------------------


P.S. -

Here is a sample of my Define Statements:

DEFINE OSC ' Sets your Oscilator Speed (in Mhz)

DEFINE HSER_BAUD 9600 ' BAUD Rate ( Bits Per Second - BPS )
DEFINE HSER_SPBRG 129 ' Baud Rate Generator Register Value (0 to 255!)
DEFINE HSER_RCSTA 90h ' 90h Sets Serial Port Enable and Continuous Receive Enable
DEFINE HSER_TXSTA 24h ' Sets Tx Enable and Either High ("24h") or Low ("20h") Speed