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: 

connecting wire through for loop

Hi,

 

I am trying to write a code to control a function generator.

Main purpose of the code is to turn on and off the output in preset timing.

(eg. 1 minute on and 5 minute off, repeating for 10 times)

 

To do so, I used flat sequence loop(on, wait, off, wait) inside of a for loop (repetition) and used multiple visa write to send on and off code to the instrument. However, as you can see from the picture, the wire connecting end of the for loop to outer sub-vi became broken and showing an error massage.

 

"you have connected two terminals of different types.."

 

Can anyone tell me how to fix this problem? or better way to execute this?

 

 

 

    

 

0 Kudos
Message 1 of 3
(2,260 Views)

First of all, remove the flat sequence. the data flow made by the error wire will ensure the priority of execution.

Second right click on the right end of the error wire and replace with a shift register.

the visa resource, right click on it and change to index keep last value.

 

Benoit

 

0 Kudos
Message 2 of 3
(2,244 Views)

You see that little hollow tunnel squares on the right edge of the For loop?  That means the tunnel mode is set to indexing.  Indexing mode means that as the loop iterates it stores the data from each iteration into an array. In your case the next VI that the wire connects to does not accept accept an array as input.

 

You can click on the tunnel and change the tunnel mode to "Last value, Indexing or Concatenating" modes.   Here you want "Last Value".

 

To better understand loops in LabVIEW, try a few LabVIEW tutorials.  Here's a good one on loops - https://www.labviewmakerhub.com/doku.php?id=learn:tutorials:labview:basics:loops_passing_data

0 Kudos
Message 3 of 3
(2,242 Views)