Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port buffer flush question

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?

 

0 Kudos
Message 1 of 8
(6,420 Views)

@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! Smiley Surprised

 

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?


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 8
(6,413 Views)

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.

0 Kudos
Message 3 of 8
(6,400 Views)

Hi MileP, 

 

Can you explain what you mean by it doesn't seem to be working correctly?

 

Regards, 

 

Kyle S

Regional Account Manager
NI
0 Kudos
Message 4 of 8
(6,379 Views)

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.

0 Kudos
Message 5 of 8
(6,374 Views)

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

 

 

Regional Account Manager
NI
0 Kudos
Message 6 of 8
(6,359 Views)

@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?

0 Kudos
Message 7 of 8
(6,346 Views)

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  

Regional Account Manager
NI
0 Kudos
Message 8 of 8
(6,341 Views)