Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Async Write in MAX "VISA Test Panel"

Solved!
Go to solution

 

I have a VXI-11 instrument and I'm able to use the "VISA Test Panel" in MAX to write SCPI commands and read responses. My instrument supports the abort channel and the VISA test panel in MAX does allow me to abort a read (async) but not a write. The aborted read operation returns immediately after I press the "Abort" button with 0xBFFF0030 (user abort) which is the expected behavior and error status. However, if I write a SCPI command that causes the instrument to not acknowledge the device_write RPC (simulated fault), I'm not able to press the "Abort" button in the VISA test panel. The operation eventually completes with 0xBFFF0015 (timeout). The "Async" checkbox in the VISA test panel is checked and the "Execute" button text changes to "Abort" (just like when reading) but nothing happens when I click it. If I look at the NI-SPY entry for the async write it says, "Operation completed successfully, but the operation was actually synchronous rather than asynchronous." This is obviously not correct since the VISA Test Panel reports 0xBFFF0015 (timeout) but this may be a clue.

 

What is going on? Has anyone been able to abort a async write using the VISA test panel in MAX?

 

0 Kudos
Message 1 of 5
(3,400 Views)

 


@ppDev wrote:

 

I have a VXI-11 instrument and I'm able to use the "VISA Test Panel" in MAX to write SCPI commands and read responses. My instrument supports the abort channel and the VISA test panel in MAX does allow me to abort a read (async) but not a write. The aborted read operation returns immediately after I press the "Abort" button with 0xBFFF0030 (user abort) which is the expected behavior and error status. However, if I write a SCPI command that causes the instrument to not acknowledge the device_write RPC (simulated fault), I'm not able to press the "Abort" button in the VISA test panel. The operation eventually completes with 0xBFFF0015 (timeout). The "Async" checkbox in the VISA test panel is checked and the "Execute" button text changes to "Abort" (just like when reading) but nothing happens when I click it. If I look at the NI-SPY entry for the async write it says, "Operation completed successfully, but the operation was actually synchronous rather than asynchronous." This is obviously not correct since the VISA Test Panel reports 0xBFFF0015 (timeout) but this may be a clue.

 

What is going on? Has anyone been able to abort a async write using the VISA test panel in MAX?

 

 

 


 

In This Thread.  Dan "lifted the hood" a bit on the VISA async behavior.  In short the async call only requests async behavior and calls may actually return synchronously.  This is one such case.

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 5
(3,372 Views)

I read that thread but I don't think it explains what I'm seeing. In my case, there are no other VISA operations queued, scheduled or in progress nor are any other threads outside of MAX active for my instrument. Also, async reads work exactly as expected and can be aborted. For some reason, MAX or VISA is forcing the async write operation (line 1 in the attached NI-Spy capture log) in the MAX VISA Test Panel to sync. You'll notice the first viReadAsync (items 2-8 in the log) clearly shows the async behavior but if you look at the "Output" panel for viWriteAsync, it shows it executed synchronously. The capture log also shows an aborted viReadAsync (lines 9-16).

 

My instrument is vxi-11 and includes the abort channel.

0 Kudos
Message 3 of 5
(3,347 Views)
Solution
Accepted by topic author ppDev

I think I stumbled on the answer. If the write length is short (I don't know the threshold or if it's documented anywhere), either MAX or VISA (not sure which) forces it sync. I wrote a longer command and it executes async and allows me to abort.

 

I'm not sure this behavior is idea. Let's say you write a short command that takes a long time to complete or the instrument hangs. By forcing the write sync, you have to wait for a timeout. However, the advantage of the present approach is forcing short command to sync is probably faster. The good news is my vxi-11 instrument's async abort behavior works for both reads and writes!

Message 4 of 5
(3,341 Views)

the behavior is well documented in the minds of semi-sane balding software engineers who once-upon-a-time (back when they could still keep from twitching and drolling on their keyboards most days) worked on the VISA API.  Next revision it will all change again (one of the reasons the engineers start twitching and drooling.) Smiley Very Happy


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 5
(3,328 Views)