PDA

View Full Version : How to change baud rate with HSEROUT?



Dick Ivers
- 16th November 2011, 20:31
I'm using HSEROUT to send data to Hyperterminal from a 12F1822 running at 16 mhz. It works fine with these parameters from the PBP3 Manual:

'Define hserout parameters
define hser_txsta 20h
define hser_baud 2400
define hser_spbrg 25
define hser_spbrgh 0

If I overwrite 2400 baud to anything else,e.g.,4800 or 9600, the circuit continues to transmit at 2400 baud. Why is this? Is 2400 a fixed baud rate for HSEROUT?

Darrel Taylor
- 16th November 2011, 22:05
Dick,

First, the defines need to be uppercase.
define HSER_BAUD 4800.
Otherwise PBP will use the default value of 2400.

You also have conflicting defines.

define hser_baud 2400
define hser_spbrg 25

Those both specify the baud rate.
Choose one or the other.

I would recommend getting mister-e's PicMultiCalc. http://www.picbasic.co.uk/forum/content.php?r=159-New-PIC-Utility.-PICMultiCalc
Let it do the hard work for you.

Dick Ivers
- 17th November 2011, 02:48
Darrel,

Thanks,.... looks like I had MCSX's Editor Options highlighter set for "lower case" by mistake .... fixed now.

HSEROUT now working at 9600 baud with these defines:

'Define hserout parameters
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 9600

Dick