If I have a fast interrupt timer, I examine the bit width and compare it to a known table. You don't need a special character sent if you keep measuring until you find the SMALLEST width, that will be a single bit width. You MIGHT be able to measure high speeds accurately with tight looping; you will have to decide by testing which baud rate causes what result. Note that because the protocol is tolerant of minor speed differences, the measurement will never be exact all the time, just close. Tymnet and others did it because the input message was identical in spots; those spots were examined, and dependent on the results, the baud rate was decided on. It would therefore always respond with the correct baud rate. --Bob William Chops Westfield wrote: >>> Does anyone know how to implement auto baudrate detection >>> >>> > There are three common algorithms that I know of for doing autobaud: > > 1) As you describe, step through appropriate bit rates till you don't > get errors. > 2) As above, except use the results in the shift register to glean > "hints" of the likely bit rate; just as output at the wrong speed > looks like garbage, specific input can also look like specific > character(s), and you can usually detect a fairly large range in > two keypresses or so. Subject to lossage if there are unusual > parity/stopbit configurations, or particularly large ranges of > possible speed. > 3) time the initial bit(s), either using the uart input as a gp input, > or with dedicated hardware of some kind. If you use any odd char > as your speed select character, you'll be timing the single start > bit of the character... > > (Does anyone remember tymnet? When you dialed in, they had a magic > prompt that showed up without garbage characters regardless of your > serial speed. I always figured that this was clearly possible, and > somewhat interesting, but always wondered what the exact algorithm > was... (of course, in those days, the variety of likely speeds was > pretty limited.)) > > BillW > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist