Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serial Port Auto Baud Rate Possible?

Status
Not open for further replies.

sparkfun

Technical User
Jun 30, 2004
1
US
Hello all.

I am having problems finding out if there is a way for VB to auto detect the incoming baud rate.

If you guys know anything about Microcontrollers, this page might give you a better background as to what I'm doing:
I developed a boot loader for PIC processors. The problem is that the PIC can operate at different speeds (20MHz all the way down to 32kHz). So the serial communication can change from 200kbps down to 400bps.

What I'd like to do is have the PIC send out the character 'x' to the computer. The VB application, knowing that it has received the character x at some unknown speed, extrapolates the comm speed based on the timing between the 1s and 0s. This is not hard with a microcontroller but it is a tall order for my limited VB/Windows programming. Can anyone at least tell me "No, VB can only handle 9600bps*N comm speeds"?

I am much obliged to any/all who can offer advice.
-Nathan
 
Hi
Most autobaud methods rely on measuring the width of the start bit. To do this on a PC you would need to be able to directly sample the RX data line from the RS232 connector, but I don't think this is possible. RX data connects directly into the UART.

The second problem would be to accurately measure the width of the start bit. At 200k bps a bit is only 5us wide, I don't think the PC has a timer that you can use that runs fast enough to time it.

How about this for a solution?

Start up your PC to PIC comms at a low baud rate that any PIC can handle. The first command from the PC could ask the PIC what baud rate it can use, both ends then change baud rate on the fly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top