Ringo42
Joined: 07 May 2004 Posts: 263
|
change baud rate at runtime |
Posted: Wed Oct 19, 2005 9:01 pm |
|
|
How do I change the baud rate using data from the eeprom?
I've tried things like
if(data==1)
{
#use rs232(baud=19200,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,Restart_WDT)
printf("Setting baud rate to 19200\r\n");
}
if(data==2)
{
#use rs232(baud=57600,xmit=TX_PIN,rcv=RX_PIN,errors,bits=8,parity=N,Restart_WDT)
printf("Setting baud rate to 56700\r\n");
}
but this always sets the baud rate to 57600, even though the print statement in the data==1 statement is the only one that prints. I even put the #use statement in its own function and called the correct function based on data, but it has the same effect.
Any ideas How to do this? I want to allow the user to set up a baud rate, store it in eeprom, then from then on use that baud rate only.
Thanks
Ringo _________________ Ringo Davis |
|