Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple visa write on the same block diagram?

Hello,

Can I have 2 Visa Write (or multiple) on the same block diagram? I am writing a VI that allows the user to input a certain value into the hardware and print out the result using Visa Read.

I have tried using Concatenate Strings to combine multiple strings into one and feed it into the Visa Write, Visa Read always gave the result from the previous input, ie. the corresponding answer from the previous input, not the result from current input.

When I tried to place 2 Visa Write on the same block diagram, I ran into some timing issues. The Visa Read did not print out the result (probe showed no value), unless I turned on the Highlight Execution where everything runs slower for inspection purposes. What is the timing issue that I have to be aware of?

Thanks.


0 Kudos
Message 1 of 9
(4,566 Views)

You can have multiple VISA Writes and Multiple VISA Reads but you should be connecting them with the VISA Resource Name input/output and withe the error in/error out clusters. This will enforce data flow. You didn't post any code or even an image of your block diagram but usually when someone says that it works in highlight execution, that's a red flag that dataflow is the problem.

As far as the concantanate string function, it all depends on the instrument. For example, with most GPIB instruments, you can separate commands with the ; character. For serial instruments, you will often have to separate the commands with a termination character such as a CR or LF. Yuo've not provided any information on the instrument or how it's connected so it's impossible to say what is the problem.

0 Kudos
Message 2 of 9
(4,561 Views)
Hi,

I am using serial connection and I have both Visa Write linked to the same Visa Resource Name/Visa Resource Name out and error in/error out.

When I turn off the Hightlight Execution, the Read String section (Visa Read) of the front panel does not display any value. However, the Visa Read does show the corresponding value when I turn on the Highlight Execution (the result appears 1-2 sec after the hardware moves). On both cases, the hardware will move according to the value entered by the user.


Message Edited by jalo on 09-11-2007 03:47 PM

0 Kudos
Message 3 of 9
(4,559 Views)
Try increasing the delay between write and read up to 1000 or 2000 milliseconds. It may take time for the hardware to issue a response.
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 4 of 9
(4,553 Views)

I was going to say the same thing. I was also going to say that the use of the Format Value function is a little weird. Why not use the concantanate string function like you mentioned?

0 Kudos
Message 5 of 9
(4,545 Views)
Increasing the delay time does not help. I still have to turn on the Highlight Execution to get the value read and displayed on front panel. Do you know what else might be causing the problem?
0 Kudos
Message 6 of 9
(4,533 Views)
Did you try putting a delay between the two writes? It might not accept the pos command before the move is complete.
0 Kudos
Message 7 of 9
(4,530 Views)
Putting another delay between the two Visa Writes helps! Apparently the delay also has to be set to around 1000-2000 ms for the Visa Read to display the pos. Thanks!
0 Kudos
Message 8 of 9
(4,520 Views)
It's surely a limitation of the instrument. If the move is not complete, it probably doesn't return a position when the command is issued. See if there is a query to see if a move is in progress or if move is complete. You might be able to continuously send and receive that command and when you get an indication that the move is complete, a pos query would then be sent. That would save you from putting some random delay statements in the program.
0 Kudos
Message 9 of 9
(4,513 Views)