Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is asynchronous reading from rs232 executed synchronous in VISA 3.0.1 under Windows XP?

When i use viReadAsync to read asynchronous from the serial port the function isn't executed
asynchronous, but synchronous and returns (after timeout) with VI_SUCCESS_SYNC.
I have enabled events (IO_COMPLETION) and installed a handler for IO_COMPLETION.
I use VISA (3.0.1) for Visual C++ under Windows XP.
Does anybody know why the viReadAsync() function isn't executed asynchronous?
0 Kudos
Message 1 of 2
(3,183 Views)
You can never force VISA to do something asynchronously, you can only request it. You are making the correct calls, but NI-VISA Serial code just isn't set up to do callbacks for I/O unless your requested byte count is above some threshold.

You can set that threshold in MAX. Go to "Tools>>NI-VISA>>VISA Options..." and change the field "Minimum Async Transfer" to a lower value.

This threshold is used for all hardware interface types when the lower-level driver does not intrinsically support the VISA asynchronous requirements for the desired event mechanism (queueing or callback). In other words, this threshold does *not* apply to GPIB because NI-488 implements asynchronous I/O for both queueing and callbacks.

Dan Mondrik
National Instruments
Message 2 of 2
(3,183 Views)