Serial Port Break

For issues with communication ports, protocols, etc.
SeaVipe
Posts: 26
Joined: Dec 22, 2015 19:13

Serial Port Break

Postby SeaVipe » Mar 23, 2016 1:57

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: 2022
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Serial Port Break

Postby MrSwiss » Mar 23, 2016 13:42

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: 1036
Joined: Feb 26, 2007 5:32

Re: Serial Port Break

Postby caseih » Mar 23, 2016 14:33

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: 2022
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Serial Port Break

Postby MrSwiss » Mar 23, 2016 15:39

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: 26
Joined: Dec 22, 2015 19:13

Re: Serial Port Break

Postby SeaVipe » Mar 23, 2016 15:42

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: 1036
Joined: Feb 26, 2007 5:32

Re: Serial Port Break

Postby caseih » Mar 23, 2016 18:41

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: 2375
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Serial Port Break

Postby marcov » Mar 23, 2016 20:09

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.

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 1 guest