Learned something new: serial controls and the break command

| | Comments (0)

Special thanks goes out to Bob Rau for teaching me this tidbit of information.

Not all serial devices behave properly with the SetBreak and ClearBreak commands. For instance, the FTDI driver (at least for OS X) will only send out a short break for a little less than .1 seconds and ignores the ClearBreak command. Other drivers aren't so assuming, and will continue the break until you call ClearBreak. And I believe that still others won't do a break at all.

So how do you overcome this driver-specific behavior? Why, by generating your own break, of course.

Set your serial control's baud rate to half of the expected rate, and send out a null byte. To the faster (receiving) control, this comes across as a start bit, 0x00 byte, and no stop bit -- a break. So if you normally communicate at 19200 baud, then drop the baud rate down to 9600 and send a null byte. That's a break!

Neato, eh?

Leave a comment

Disclaimer

I'm currently an employee of REAL Software. My blog is mine. The opinions represented in this blog are mine as well and may not represent my employer's opinions. All original material is copyrighted and property of the author.

REALbasic® is a registered trademark of REAL Software, Inc. REAL SQL Server™ and Lingua™ are pending trademarks of REAL Software, Inc. All rights reserved.