07-04-2011 12:33 PM - edited 07-04-2011 12:34 PM
I'm trying to use VISA Flush I/O Buffer Function to flush serial port receive/transmit buffers without I/O operation.
As per the help, mask value (0x40 | 0x80) flushes both transmit and receive buffers without I/O operation.
But it seems the flush doesn't work. Did I use this function correctly?
07-04-2011 07:02 PM - edited 07-04-2011 07:03 PM
@MileP wrote:
I'm trying to use VISA Flush I/O Buffer Function to flush serial port receive/transmit buffers without I/O operation.
As per the help, mask value (0x40 | 0x80) flushes both transmit and receive buffers without I/O operation.
But it seems the flush doesn't work. Did I use this function correctly?
Probably YES!
Usually I get to say words to the effect of "Yes, you may have done that wrong" In this case I susupect that you are dealing with a "chatty Cathy" UART or terminal emulator that just keeps shoveling data onto the port.
SO, what's on the other end?
07-05-2011 09:04 AM
I'm using RS232 for the serial port communication between the LabVIEW application and target.
It has handshake state and data transmit/receive state. If handshake state is complete, it transits to data transmit/receive state.
I want to clean up everything in the serial port transmit/receive buffer after handshake state is complete, so the next state won't have any overhead.
As per help, I thought VISA Flush I/O Buffer Function with mask value 0xC0 would do the clean up without I/O operation.
07-06-2011 04:13 PM
Hi MileP,
Can you explain what you mean by it doesn't seem to be working correctly?
Regards,
Kyle S
07-06-2011 04:20 PM
I expect the flush would discard all the data in the serial port transmit/receive buffers and no I/O operation,
but I saw the data were still transmitted on NI Spy. So I think it did the flush but also did the I/O operation.
07-07-2011 01:40 PM
Hi MileP,
If possible could you try the Windows Flush Com Buffers.vi? It can be found in ...\LabVIEW...\vi.lib\instr\_sersup.llb. This vi is a Windows based vi and I'm curious if it will work for you.
Regards,
Kyle S
07-08-2011 08:07 AM
@KyleTTU wrote:
Hi MileP,
If possible could you try the Windows Flush Com Buffers.vi? It can be found in ...\LabVIEW...\vi.lib\instr\_sersup.llb. This vi is a Windows based vi and I'm curious if it will work for you.
Regards,
Kyle S
Do you mean a VI called "Windows Flush Com Buffers"? I can't find it. But I saw "VISA Flush I/O Buffer" at many places. They are all same, right?
07-08-2011 11:33 AM
This one actually acts just a little bit differently which is why I want to try it. Otherwise can we attempt to not do a full transmit to the device and instead just query it with a *IDN? command, then flush the buffer. I am curious about this handshaking and if you are continously getting data from the other end when attempting to flush the buffer.
Regards,
Kyle S