LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop problem

Hello,

I have put a daq assistant in a while loop the measure a votlage. The iteration of the loop is set to be every 500 mS. The numeric indicator functions fine inside the loop. However, I can't get that value outside the loop. I thought every time the loop had done an iteration, you could get that value outside that loop? Could anybody help me? I need that value to wright it to a file at a different frequency than the while loop contraining the daq assistant. And also make an average of the value with the last 2 values.I have attached my very simple VI file.

Any help would be really great.

Thanks,

marc
0 Kudos
Message 1 of 8
(3,442 Views)
Hello Marc,

I think yo forgot to attach your file...
Anyway, data id only accessible from outside the loop (on the tunnel) after it is over.
You have to build another loop in parallel to this one and send the data there - to do this you have a lot of possible ways (variables, queues, user event structures, ...)

I attach a simple example with queues.
Hope it helps,
Paulo
0 Kudos
Message 2 of 8
(3,438 Views)
Hi Marc,

I'm not sure, but try using property node set to 'value'

My records show an answer from someone called Thomas (handle 'becktho') in which use of Notifiers was suggested. This also allows you to exchange a value between your two loops.

I am attaching the image that accompanied that discussion.

Hope this helps.

- Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 3 of 8
(3,425 Views)
Hi Gurdas,

Thanks a lot for your help, I'll try that too.

Marc.
0 Kudos
Message 4 of 8
(3,404 Views)
In my opinion, the simplest way to do this is to use a local variable. Here is an example that also calculates the average of the last two values.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 8
(3,393 Views)
Oops, forgot the attachment.
- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 8
(3,392 Views)
oops #2, try again sleepy head...
- tbob

Inventor of the WORM Global
0 Kudos
Message 7 of 8
(3,387 Views)
Hello Paulo,

You have really helped me, thanks. I've attached, I hope, the VI I created with your solution. If you have the time to look at it, don't hesitate to give anykind of advice. Out of my loop that gives an average of the voltage every 100 ms, I want to wright only one voltage average every 500 mS, and it must be the most recent one (not the one that was queued up at t=200 mS). I am not actually sure of what I am writing.

Thanks again for your help,

regards, Marc
0 Kudos
Message 8 of 8
(3,384 Views)