From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-23-2016 08:34 AM
Hello,
I have two frame, and i want to transmit them with a visa serial one after other but i try to find a function that can do this work but i d'ont find it.
thanks.
12-23-2016 09:19 AM - edited 12-23-2016 09:30 AM
Use Build Array and a For-Loop like this to send VISA commands sequentially:
Remember to put a time delay in your loop to allow your instrument time to process each command before sending the next one.
12-23-2016 10:01 AM - edited 12-23-2016 10:02 AM
hi;
thanks for help, but i trying with this solution but it doesn't working
12-23-2016 10:03 AM
@mouhamedgmail wrote:
hi;
thanks for help, but i trying with this solution but it doesn't working
What's not working? Show me your code.
12-23-2016 10:13 AM - edited 12-23-2016 10:18 AM
Well you are trying to send commands and receive a response at exactly the same time.
EDIT: Actually you are trying to receive a responce then sending the command 500mS later because of the time delay in the four-loop.
Try something like this:
12-23-2016 11:13 AM
@RTSLVU wrote:
Well you are trying to send commands and receive a response at exactly the same time.
EDIT: Actually you are trying to receive a responce then sending the command 500mS later because of the time delay in the four-loop.
Try something like this:
Don't forget shift registers on the error and ref wires in case the loop executes 0 times.
12-23-2016 11:50 AM - edited 12-23-2016 12:01 PM
I have been using this method for years and never seen a need for shift registers on the error or reference line. As the both the reference and error will remain at the input side of the loop through all iterations and passed out after the last iteration. The loop will never execute zero times in this instance as the array is filled with commands that are "hard coded".
My rule on the use of shift registers is you only need them if the contents of the wire will change during loop iterations.
What I DID forget is to put a Conditional Stop terminal in the For Loop and wire the error cluster to it.
So since the VISA reference is not going to change and the loop will exit on error there is no need for shift registers.
12-23-2016 02:19 PM
@RTSLVU wrote:
I have been using this method for years and never seen a need for shift registers on the error or reference line. As the both the reference and error will remain at the input side of the loop through all iterations and passed out after the last iteration. The loop will never execute zero times in this instance as the array is filled with commands that are "hard coded".
My rule on the use of shift registers is you only need them if the contents of the wire will change during loop iterations.
What I DID forget is to put a Conditional Stop terminal in the For Loop and wire the error cluster to it.
So since the VISA reference is not going to change and the loop will exit on error there is no need for shift registers.
But if the VISA reference doesn't get passed on, VISA Write will throw an error as it will be empty. And it is bad form to assume that the array is always going to be fixed. What happens if someday the array originates from a subVI and it returns an empty array? Then you wonder why your VI is returning an invalid VISA reference error.
12-23-2016 02:26 PM
Also, with no shift register, if the FOR loop exdcutes zero times, it will also swallow an error that happened before the loop because it will never propagate to the other side of the loop.
12-24-2016 06:09 AM
@RTSLVU wrote:
I have been using this method for years and never seen a need for shift registers on the error or reference line. As the both the reference and error will remain at the input side of the loop through all iterations and passed out after the last iteration. The loop will never execute zero times in this instance as the array is filled with commands that are "hard coded".
My rule on the use of shift registers is you only need them if the contents of the wire will change during loop iterations.
What I DID forget is to put a Conditional Stop terminal in the For Loop and wire the error cluster to it.
So since the VISA reference is not going to change and the loop will exit on error there is no need for shift registers.
Let me tell you some of my experience here...
I started out with a FOR loop and a hardcoded array. Then that array became an input to the VI (for what reasons I do not remember). It took less than a week for somebody to pass in an empty array and then my VISA reference was GONE. I also lost track of an error as well, which would have really helped diagnosing the real problem. So I use a shift register for anything that is passed through a FOR loop as well. It uses the same memory space for both the input and the output, so you have no good excuse not to use a shift register.