LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start For-loop at defined tme

I want to use the elements of one cluster of a cluster array for a certain amount of time. As soon as the time has elapsed, I want to use the next cluster. The length of time for each cluster is defined in the cluster itself.
I thought of a solution, in which I let the for-loop, which reads the array, wait for the defined time before it starts all over again. Is there any possibility to do so? Would you recommend a totally different solution? Thanks for help.
0 Kudos
Message 1 of 9
(2,659 Views)

Franzi,

Could you post the VI that you have built?

That way, we can have a look and suggest better

Regards

Dev

0 Kudos
Message 2 of 9
(2,654 Views)
Hello,

I am not sure I understood what you need, but have a look at this VI and tell me if it helps

😉


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 9
(2,650 Views)
Thank you TiTou, your solution is pretty much the same as mine, but how can I make sure, that reading out the time is the first occurance in the loop? I want to be sure, that the loop lasts exactly as long as I want it to last...
0 Kudos
Message 4 of 9
(2,649 Views)

Hello!

 

I am not entirely sure what you are trying to achieve here but if you have an array of clusters you can use the indexing feature of the for-loop, and in that way control how many times the for-loop iterates. Inside the for-loop you can then use either a unbundled by name or unbundled function in order to get the time information that was part of the cluster itself and then depending on if you represent the time in seconds or milliseconds eventually scale it before sending this parameter to a Wait function. This would result in that the iteration will wait the amount specified. Another alternative is that if you want something to run continuously with the specified time you can do as in the attached example.

Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

Message 5 of 9
(2,646 Views)
I don't think it is important that the timing executes first. If the code inside the loop takes less time to execute than what you link to the timing it will work anyway.
I think the timing is just a target, and if that target can't be reached because the code takes too long to execute then there is nothing to do.
Make sure your code will execute faster than the rate you want to set that will be ok 😉

Hope this helps

PS : Jimmie, I can't open your VI neither with LV 7.1 nor with LV 8 Smiley Surprised

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 6 of 9
(2,641 Views)
Ok, thank you all. I think, I'll be fine now. Smiley Wink
0 Kudos
Message 7 of 9
(2,636 Views)
TiTou,
 
That was odd, I have LabVIEW 8.0.1 installed and I opened the VI that I attached without any issues.
Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

0 Kudos
Message 8 of 9
(2,630 Views)
Indeed, that' weird... I reloaded it and now it works !

Your solution is quite nice ! I was now wondering if if wouldn't be better with a timed loop that runs just once for each cluster, that would permit to set a high importance and to have an indicator for "finish late".

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 9 of 9
(2,623 Views)