Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the difference between viFlush and viClear?

i have some GPIB replies that are "off" by one message when I get an gpib read error ...

 

list of events:

GPIB query #1

GPIB reply #1

GPIB query #2

read error

viFlush

GPIB query #3

GPIB reply #2  //should be reply #3

GPIB query #4

GPIB reply #3 // should be reply #4

 

 

Should I be using viClear instead of viFlush?

Thanks.

0 Kudos
Message 1 of 2
(4,872 Views)

viFlush ensures that commands that are still in a write queue are written out. So it makes only sense if you use it before trying to read the response.  If your read error is a timeout error it would also make sense trying to increase that timeout. viClear clears the devices GPIB controler. That probably also achieves that you are "in sync" again because it deletes the outstanding response for query #2.

0 Kudos
Message 2 of 2
(4,854 Views)