Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Why VISA READ works only after VI Properties Execution is set to Instrument I/O?

I am trying to VISA read/write bet' 2 VIs. One of the Support report suggested to change the system execution thread to User-Interface-thread in File>>VI Properties >>Execution.
I did it, but I was not able to VISA_read after sending some bytes from my VISA_wr.vi.
But it works if set to InsturmentI/O. Why ?
Where are the documents describing preferred execution system in detail?
0 Kudos
Message 1 of 5
(3,561 Views)
Bobbie:

The execution thread should not make a difference. NI-VISA should do an I/O transfer from any thread. If you could capture the results (both good and bad) in NI Spy log files, that would be helpful.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 2 of 5
(3,561 Views)
First I start SPY, then visa_read.vi, then visa_wr.vi.
I change the Execution setup in visa_read.vi.
4 separate NI-SPY log files with 4 setups -
user-IF ( 0 bytes read). attached.
stadard ( 0 bytes read). attached.
Instrument I/O ( 6 bytes read). attached.
Other 2 ( 6 bytes read). not attached.
The thread seems to make the difference.
Are the log files helpful ?
Download All
0 Kudos
Message 3 of 5
(3,561 Views)
Well, the log files show that you are doing different things each time. So it's not as helpful as it could be. For example, in Standard, the session is already open, so I don't know what happened before you got there. The best log files would be taken from scratch - exit LabVIEW and turn off your instrument between each capture.

Also, the fact that you open a session and immediately read *first* is weird. Most communication requires you to write something to an instrument, then get back a response. I'm not saying that reading first would cause VISA to fail, I'm just not sure your instrument is sending something (or for that matter, that it didn't send it *before* you opened the session).

I don't think this has anything to do with
which thread the VISA code is running in. I just can't prove it yet.

Dan Mondrik
0 Kudos
Message 4 of 5
(3,561 Views)
I did according to your steps - (I have labview 6.01)
1)Exit Labview. Start SPY & start capture.
Open visa_read_std.vi, visa_wr.vi.
2)Run visa_read_std, visa_wr. Stop Capture. Save Cap_std.spy. See attached file.
(After I run visa_wr.vi & then visa_read_std.vi, again read gets timeout and read_bytes=0.)

3)Repeat 1).
4)Run visa_read, visa_wr. read_bytes=6. Stop capture. Save Cap_InstIO.spy. See attached file.

Are the new spy log files helpful ?
I have problem attaching my vi. How to do it ?
Download All
0 Kudos
Message 5 of 5
(3,561 Views)