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 do you record the current index?

Hi everyone,

 

Im sorry if this problem seems basic, but I have a for loop that controls motor movement, and I have a separate while loop that is responsible for all data acquisition. I am wondering if there is a way to record the current index number from the for loop in my DAQ loop? I tried wiring the index down to the array in the while loop, but it seems to prevent the while loop from starting up.


I can throw up some pictures if necessary, but im hoping this can be done easily.

 

Thanks!

0 Kudos
Message 1 of 4
(2,804 Views)

Please do not "throw up pictures".  Instead, post code.  Attach a VI, or create a Snippet (which looks like a picture, but can be dragged onto a LabVIEW Block Diagram and, by NI Magic, becomes executable, editable, clickable LabVIEW code.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,783 Views)

Are you currently sending any information from this control loop to the data logging loop?  If so, just add the index into that information.  If not, it sounds like you just care about the latest value, so I would use a Notifier or a Global Variable.


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 3 of 4
(2,760 Views)

 

Hello Benny,

 

THe reason that your while loop won't start is because it needs for the for loop to stop iterating so it can provide the information on the number of iterations, and so the while loop while start then.

 

Now for an adequate communication between parallel loops, I would recommend using Queues or notifiers to transmit data, or in this case the iterations number.

 

Please refer to the following link to understand what is a queue and how to use it.

 

What Is a Queue?

http://digital.ni.com/public.nsf/allkb/DD7DBD9B10E3E537862565BC006CC2E4

 

Communicating between parallel loops

http://www.viewpointusa.com/resource/view/newsletters/communicating-between-parallel-loops/

 

 

Regards,

 

David M.  

National Instruments 

 

 

0 Kudos
Message 4 of 4
(2,686 Views)