LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parrallel Loops

Solved!
Go to solution

Hi

 

 

Recently, I made a software for 4 different items: A1,A2,A3,A4. Each item is having their own logging buttons and generating their own file names based on time. Similarly each item is also having 4 different formulas and timers. All of these tasks are supposed to be run in parallel. I created about 8 parallel loops and my software was working fine. Today I had to add serial read loop and I found out that serial read loop is not executing.

This serial read code works fine if I delete my rest of loops. So can anybody tell me me how should I handle multiple loops. I know serial read code is right,its some synchronization issue. Or tell me how I can avoid parallel loops.

 

Thanks

0 Kudos
Message 1 of 7
(3,491 Views)
You'll have to post your VI so we can see what you are doing.  There is no reason I know of why your serial loop shouldn't be running assuming it is truly in parallel and not blocked by some other code.
0 Kudos
Message 2 of 7
(3,483 Views)

You might also have the problem of the other 8 loops consuming all of the processor resources too. 

 

However, like he said with out the code it's hard to assist.

 

Jason

Wire Warrior

Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!
0 Kudos
Message 3 of 7
(3,469 Views)

Hi

 

 

I have managed to find the loops which are effecting my serial communication. These are 5 loops marked in green. At the moment, you wont be able to run the code but still you will be able to point me in right direction.

 

 

 

Download All
0 Kudos
Message 4 of 7
(3,420 Views)
Solution
Accepted by topic author mimran

You have a lot of loops running at full speed, with each one trying to hog all the CPU time.  Put a delay in each loop.  Use 10 mS as the delay value.  If you must run as fast as possible, use 0 mS, but still put the delay even if it is 0 mS.  This will give CPU time to all loops.  The serial loop should execute normally if it gets some CPU time.

Actually, some of the loops (the ones waiting for user to press a button) can use a 100 mS delay without any noticible difference.  This gives even more time for the serial loop to run.

 

- tbob

Inventor of the WORM Global
Message 5 of 7
(3,411 Views)

In the serial loop, you need to move the setup routine outside of the loop, because it is loop invariant code.

 

You really need to learn about using Queues or Notifiers to pass data between loops if you're going to tackle these multiple loop projects. Your local variables are out of hand - you're reading stale data, likely have race conditions. There's over 500 billion threads about this.

Message Edited by Broken Arrow on 06-15-2010 02:20 PM
Richard






Message 6 of 7
(3,387 Views)

Thanks for your quick reply. I will try putting some delay of 10ms in each loop and will see whether it works or not.

 

 

0 Kudos
Message 7 of 7
(3,363 Views)