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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write in the serial two frame one after other

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.  

0 Kudos
Message 1 of 10
(3,263 Views)

Use Build Array and a For-Loop like this to send VISA commands sequentially:

mmulti visa.PNG

Remember to put a time delay in your loop to allow your instrument time to process each command before sending the next one.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 10
(3,243 Views)

hi;

thanks for help, but i trying with this solution but it doesn't working 

0 Kudos
Message 3 of 10
(3,224 Views)

@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.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 10
(3,221 Views)

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.

Notthis.png

 

Try something like this:

Likethis.png

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 10
(3,217 Views)

@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.

Notthis.png

 

Try something like this:

Likethis.png


Don't forget shift registers on the error and ref wires in case the loop executes 0 times.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 10
(3,200 Views)

 

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. 

Likethis.png

 

So since the VISA reference is not going to change and the loop will exit on error there is no need for shift registers.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 10
(3,191 Views)

@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. 

Likethis.png

 

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 10
(3,173 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 10
(3,170 Views)

@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. 

Likethis.png

 

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 10
(3,133 Views)