Hello
I need only in the start of my program a 2400 baudrate, later im programm during runtime i need to change the baurate to 9600, but become error by the compiler "Redefinition of CON bmode"
How can i do that?
Thanks in advance
Best regards
Pedro
Hello
I need only in the start of my program a 2400 baudrate, later im programm during runtime i need to change the baurate to 9600, but become error by the compiler "Redefinition of CON bmode"
How can i do that?
Thanks in advance
Best regards
Pedro
You can change your baudrate any time during runtime by issuing the command
SPBRG = x,
where "x" is a number you will find in your datasheet and
is based on your oscillator, and the BRGH and BRG16 settings.
After changing the baud rate, pause at least two byte-times before you
attempt to use the serial port.
Charles Linquist
Hi Pedro,
What Charles said is proper for HSERIN and HSEROUT, I have a little program I use to test serial LCD units using SEROUT and it works for several baudrates, here is a sample of the code.
each output having a different baudrate.Code:SEROUT PortB.7,N2400,[254,128,"2400 baud line 1~"]'inverted pause 100 serout PortB.6,N9600,[254,128,"9600 baud line 1~"] '128 so as not to add space pause 100 SEROUT PortB.5,T2400,[254,128,"2400 baud line 1~"]'true pause 100 serout PortB.4,T9600,[254,128,"9600 baud line 1~"] '128 so as not to add space pause 1000
JS
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi Joe
What Charles say is what i need
i have this for soft usart
bmode con 16780' serin2' 16780 = 2400 true
'
'and set with this the hardware usart for 10466 baudrate, i have not tested, next week
'can i test, and hope that this work
'
' Set receive register to receiver enabled
DEFINE HSER2_RCSTA 90h
' Set baud rate
' Set SPBRG directly (normally set by HSER_BAUD)
DEFINE HSER2_SPBRG 23
Regards
Pedro
Bookmarks