Serial Port Break

For issues with communication ports, protocols, etc.
Post Reply
SeaVipe
Posts: 28
Joined: Dec 22, 2015 19:13
Location: Western Canada
Contact:

Serial Port Break

Post by SeaVipe »

Hello,
Is there a way to achieve a serial port Break? I have tried Close followed by Open Com with various Sleep settings, also tried Out, neither had the desired effect.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Serial Port Break

Post by MrSwiss »

SeaVipe wrote:Is there a way to achieve a serial port Break? I have tried Close followed by Open Com with various Sleep settings, also tried Out, neither had the desired effect.
Could you please ask your question in a way, that others can understand it's meaning?

The Term "Break" I've never heard in Connection with any Hardware Device.
There are Start/Stop for send/receive on real RS232 (DTR/DSR Lines).
This poses another question "Serial over USB" or real "RS232 Hardware"?
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Serial Port Break

Post by caseih »

A little googling would help you understand what the OP is talking about:
http://ltxfaq.custhelp.com/app/answers/ ... l-break%3F

So the OP did post the question in an understandable way. This is a common thing in the serial world. Though it's doubtful anyone knows the answer. I certainly don't.

In Linux, there's a glibc call for this. tcsendbreak(). It uses data structures that FB does not expose, though, so I have no idea how to use it in the context of FB. You could go through the source code for Linux serial I/O and see how you might call it.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Serial Port Break

Post by MrSwiss »

caseih wrote:A little googling would ...
You must be joking ... (I'll most certainly won't do that, ever.).
People nowadays are even to lazy to formulate their questions in a understandable way.

Your reference to OP = ???
SeaVipe
Posts: 28
Joined: Dec 22, 2015 19:13
Location: Western Canada
Contact:

Re: Serial Port Break

Post by SeaVipe »

Thanks caseih, very informative; I'll look into the Linux serial I/O as you suggested.
The obsolete VB6 code employs a National Instruments Serial Activex control that supports Break as in

Code: Select all

Serial1.SerialPortBreak(18)
inputBuffer = Serial1.Read(numberOfBytes)

Where 18 is the number of Ms to break.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Serial Port Break

Post by caseih »

MrSwiss wrote:People nowadays are even to lazy to formulate their questions in a understandable way.
Your reference to OP = ???
OP means "original poster." An abbreviation more commonly used on some forums than others (apparently not used here very often).

I don't think the OP was lazy at all. He should have posted the VB6 code fragment right up front of course.
marcov
Posts: 3455
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Serial Port Break

Post by marcov »

If you have an uart with FIFO, be careful, since setcommbreak() messes with the FIFO (iirc you can't be sure of its state anymore, this includes the last bytes you send before the break, and incoming bytes before, during and just after the break).

In very slow communication (like 9600 baud), you can simply discard bytes for a few ms after the break.

Note that funky hardware, like custom NS serial dlls might do that flushing for you, but if you work with generic serial hardware it might be dangerous.

For a time I considered sending breaks when the PC detected corruption (out of sync protocol), but I gave that up eventually.
Post Reply