LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel loops

Ok so this is what I tried. On a separate vi with just creating a 2D array and displaying it, it works. But, when the outpput is fed into the daqmx write, it shows up as an error. I tried initializing an array 1x200 (because the loop just runs for 7 seconds.).

 

btw, arrays are not so easy to use on LabVIEW i feel 😞

I may not be perfect, but I'm all I got!
Download All
0 Kudos
Message 41 of 50
(938 Views)

On your DAQ Write, change the N Chan 1 Sample to N Chan N Samples.  Do this by right clicking on the polymorphic selector and select Multiple Channels Multiple Samples.  It should now take a 2D array.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 42 of 50
(933 Views)

Hi tbob, got the daqmx multi channel write fixed. Also, the 2D array example was great to understand what actually happens 🙂 As I move forward, I am encountering more issues. In the attached example I am facing this problem. Maybe I am doing something wrong. What I see is that although each subvi has a different time delay, the main vi runs both at the highest value time delay. What I am looking to do is to have two subvi's to run in the same main vi loop, but at different rates. Is this possible to do? Thanks!

 

V 🙂

I may not be perfect, but I'm all I got!
0 Kudos
Message 43 of 50
(896 Views)

Because you have one loop.  The loop can only run as fast as the longest code in your loop.  In this case a subVI which has a 500 msec wait.

 

If you want one subVI to run faster than the other, you need to have them in separate loops.

0 Kudos
Message 44 of 50
(889 Views)

Thanks ravensfan! When using State machines, I will have a "run test" case in which there will be two separate subvi's; one monitors the speed and one elevation. Now, I can monitor elevation at a faster rate and speed at a considerably slower rate. Will this work? The main vi is like the master loop in the state machine. subvi's have their own loops. and they will run parallely (if this is a word 🙂 ) within the main loop thus updating main vi at their corresponding rate.

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 45 of 50
(882 Views)

Yes this will work.  As you long as you don't make mistakes in coding.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 46 of 50
(873 Views)

Hi Tbob,

 

I have come a long way since the last time I posted on this thread. Reading back some of my questions, I feel silly. 🙂

 

Anyway, I have a working program using parallel loops and references being passed around between parallel loops and between main vi and subvi's . Is passing references the best way to program an application? Because I am passing all the controls from main vi into subvis , so effectively I have control over the program from the main vi.

 

Jay

I may not be perfect, but I'm all I got!
0 Kudos
Message 47 of 50
(681 Views)

Could you elaborate on what you mean by passing references?  What are you passing references of?

 

Brandon Treece

Applications Engineer

National Instruments

0 Kudos
Message 48 of 50
(658 Views)

@VeeJay wrote:

Hi Tbob,

 

I have come a long way since the last time I posted on this thread. Reading back some of my questions, I feel silly. 🙂

 

Anyway, I have a working program using parallel loops and references being passed around between parallel loops and between main vi and subvi's . Is passing references the best way to program an application? Because I am passing all the controls from main vi into subvis , so effectively I have control over the program from the main vi.

 

Jay


If you must control main vi controls from subvi code, or if you want to see subvi indicators updated in the main front panel in real time, then passing references is the only way to go.  You say you are passing all the controls.  Is this necessary?  Is every one of the controls being manipulated by the subvi and do you have to see the results in main before the subvi is done?  If so then you have a valid reason to pass references for all controls.  If any control does not fit this bill, don't pass a reference, just pass the value.

- tbob

Inventor of the WORM Global
0 Kudos
Message 49 of 50
(651 Views)

 



Could you elaborate on what you mean by passing references?  What are you passing references of?

 


I am passing controls on main vi as references to subvi. Also, indicators on main vi are updated on from subvi by passing main vi indicators as references and using property nodes to update values.

 

I may not be perfect, but I'm all I got!
0 Kudos
Message 50 of 50
(625 Views)