Is it possible To change baud rate at runtime?
I need to change The baud rate from 9600 to 115200 and then back to 9600. I did try with define but PBP3 does'nt like it and gives error at compiling. Is there a way To do the baud Switching from 9600 To 115200 and back To 9600? How?
Thank you for any help.
Alberto
Re: Is it possible To change baud rate at runtime?
Absolutely. But you can't use DEFINE because it's a compile time thing.
You can skip the DEFINE altogether and do it manually all the way, what to set the registers to depends on the oscillator speed. For example, setting 9600 baud when running at 8MHz:
Code:
RCSTA = $90
TXSTA = $20
SPBRG = 51
SPBRGH = 0
BAUDCON.3 = 1
/Henrik.
Re: Is it possible To change baud rate at runtime?
Thank you Henrik, very kind of you.
Alberto