In SX Microcontrollers, SX/B Compiler and SX-Key Tool, mgreen wrote: All of the methods for automatic Baud detection rely on some knowledge of the incoming character stream, usually that there are characters coming in with a little time between them so that the start bit can be detected. Usually the characters are odd in value so that the start bit (0) is always followed by a one bit and the width of the start bit is used to set the Baud. Your suggestion to measure the width of pulses received and assume that these represent received bits, finding the shortest one and using that for determining the Baud, is reasonable, but don't expect any reliability with arbitrary data streams. I don't think you'll find any better algorithm though. The problem is that the first character that comes along may have no single isolated bits and you'll end up with a Baud that's half or a third of the correct Baud. If there's any noise in the datastream, your Baud detection will be thrown off by that. Basically, you've got a bad situation. There is no good solution, but what you suggest will work some of the time. If you can put in a timeout where the whole system resets if synchronization fails and it starts over from the beginning, you at least will have some chance of achieving communications. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=310136#m310144 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)