LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I flush the serial port buffer?

To initialise a piece of hardware I need to flush the serial port buffer.

Any advice please?

Many thanks.
0 Kudos
Message 1 of 5
(10,669 Views)
There is a "windows Flush com buffers.vi", hidden away in the _sersup.llb. Usefull?
0 Kudos
Message 2 of 5
(10,669 Views)
Do you need to flush the serial buffers on the PC or in the device you're talking to? If you are wanting to flush the serial buffer on your end, the buffers are automatically flushed when the port is initialized. In addition, you can flush the receive buffer at anytime by reading the number of bytes at the port and (if not zero) reading that number of bytes.

If the serial buffer on the other machine needs flushing, that's a pretty device-specific issue. What are you trying to talk to?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 5
(10,669 Views)
Do you need to flush the serial buffers on the PC or in the device you're talking to? If you are wanting to flush the serial buffer on your end, the buffers are automatically flushed when the port is initialized. In addition, you can flush the receive buffer at anytime by reading the number of bytes at the port and (if not zero) reading that number of bytes.

If the serial buffer on the other machine needs flushing, that's a pretty device-specific issue. What are you trying to talk to?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 5
(10,669 Views)
mikeporter wrote in message news:<5065000000050000002C700000-1017707437000@exchange.ni.com>...
> Do you need to flush the serial buffers on the PC or in the device
> you're talking to? If you are wanting to flush the serial buffer on
> your end, the buffers are automatically flushed when the port is
> initialized. In addition, you can flush the receive buffer at anytime
> by reading the number of bytes at the port and (if not zero) reading
> that number of bytes.
>
> If the serial buffer on the other machine needs flushing, that's a
> pretty device-specific issue. What are you trying to talk to?
>
> Mike...

Hi, I am using the parallel port to communicate. And I don't know if
it is the same with the serial port, but you can always try I
thought....
.
If I use a VISA vi (e.g. write)in Labview in need to flush the buffe
of the PC afterwards, because otherwise the old data stays in the
buffer, even if I write new data to the port. To flush the buffer can
be done with the vi: VISA flush serial buffer. (though it is for the
serial buffer, it also flushes the parallel buffer). But when I am
using the Out Port vi, I don't need to flush the buffer, because it
writes directly to the port, and every time you write new data it
overwrites the old data.
And very important! When I flush the buffer all the pins (all data,
control, status pins) are set to there "normal" state. And with the
Out Port they don't.

I hope you can use this information

Greetz,
JJ
0 Kudos
Message 5 of 5
(10,669 Views)