10-23-2018 08:16 AM
I'm using 2 ordinary for loops 1 after the other to capture upper and lower voltage thresholds. The problem is the second loop won't continue past the number the first loop stopped at even when I hard code a larger number.
10-23-2018 08:25 AM - edited 10-23-2018 08:30 AM
Hi RHutchings,
you really should take the beginner courses to learn LabVIEW…
(Learn about FOR loop behaviour. Also learn about all those different loop tunnel options!)
The problem is the second loop won't continue past the number the first loop stopped at even when I hard code a larger number.
Where did you "hard code" that behaviour?
Infact LabVIEW works exactly as is described in the help: A FOR loop has more than just one condition to define the number of iterations!
It will stop when
- the max number of iterations is reached
- the stop condition in the loop is fulfilled
- an autoindexing input runs out of elements
The last item is killing you… 😄
On your VI:
- Learn about replacing stacked sequences by flat ones.
- Then replace all locals by wires.
- Then remove the sequences and use pure THINK DATAFLOW!
- Learn about the formatting codes for FormatIntoString to remove RubeGoldberg code here…
- Remove the Classic RubeGoldberg of "IF true THEN true ELSE false"… 😄
- Why do you need to round down an integer number???
- Learn about "race conditions" and how to avoid them…
10-23-2018 08:27 AM
Youre indexing the two arrays into the second for loop - the array of VISA Refs and the array of errors. If a for loop has an array that is indexed as the input and a loop count wired, the number of times it executes will be equal to the smaller of the two inputs.
Get rid of that VISA ref array anyways - right click on the output tunnel of the first loop and click replace with shift register. Then put a 'merge errors' node on the error output of the first loop.
10-23-2018 09:27 AM
Thanks all, I'll get back after I've digested all of this. I have another project to work on for the moment. I'll look into the training.
10-23-2018 10:21 AM
@RHutchings wrote:
Thanks all, I'll get back after I've digested all of this. I have another project to work on for the moment. I'll look into the training.
Reading GerdW's message, it would seem that you should probably "look into the training" before "another project to work on for the moment". You really don't want to continue coding the way you are doing right now. Best to nip those bad LabVIEW practices in the bud.
10-23-2018 10:28 AM - edited 10-23-2018 05:33 PM