JPrevost Posted January 25, 2006 Report Share Posted January 25, 2006 I made a simple vi that used 2 identical parallel while loops with shift registers doing an increment. Both loops were attached to local variables of a stop button. Did you know that there is no priority and the loops don't run even close to each other! One will run away fron the other . The difference ranged from .5 to 1.4 of that of the other loop. Really weird. This is with no wait ms and with a wait ms of 0ms. Quote Link to comment
Michael Aivaliotis Posted January 25, 2006 Report Share Posted January 25, 2006 I made a simple vi that used 2 identical parallel while loops with shift registers doing an increment. Both loops were attached to local variables of a stop button. Did you know that there is no priority and the loops don't run even close to each other! One will run away fron the other . The difference ranged from .5 to 1.4 of that of the other loop. Really weird. This is with no wait ms and with a wait ms of 0ms.If you add a larger delay like 10ms, you will see they are much closer. Are you running this on LV RTOS? Quote Link to comment
JPrevost Posted January 25, 2006 Author Report Share Posted January 25, 2006 If you add a larger delay like 10ms, you will see they are much closer. Are you running this on LV RTOS? Actually with a delay of 1ms it was synced perfectly. What is LV RTOS? Real-time Operating System? If so, I don't know. Maybe this doesn't belong in the Real-Time forum. If that's the case, sorry for the mix up although it's still weird that parallel loops run away from each other with different priority of the same operation... yes/no? Quote Link to comment
Yair Posted January 25, 2006 Report Share Posted January 25, 2006 You should never have loops inside your program which don't have some sort of delay mechanism (usually a wait primitive or a timeout). Even an empty loop with no wait can cause LV to get your CPU usage very high and there is definitely no telling what LV will do with 2 loops without a wait statement. If you wire 0 into the wait (tells the loop to iterate if no other process needs the CPU), you will probably see more or less identical times as well. Real time systems are systems which run on RTOSs (you got that one right) and the special thing about such systems (if built correctly) is that they are always supposed to respond within a given a time period. Unlike OSs like windows which don't give you control, An RTOS will allow you to set your own priorities and be much more precise. Quote Link to comment
Thang Nguyen Posted April 21, 2009 Report Share Posted April 21, 2009 Hi, Currently, I am having the same problem with 2 parallel loops. One loop I got data from CAN and put data into the queue. The second loop will process data from the queue. One weird thing is if I put the breakpoint in the second loop, it runs. If I don't use the breakpoint, I will not run. Could you tell me what should I do? Thang Nguyen Quote Link to comment
Mellroth Posted April 21, 2009 Report Share Posted April 21, 2009 QUOTE (Thang Nguyen @ Apr 20 2009, 04:55 PM) ...Could you tell me what should I do?... You should probably initialize the "EXIT?" boolean to FALSE before you enter the loops. /J Quote Link to comment
Aristos Queue Posted April 21, 2009 Report Share Posted April 21, 2009 QUOTE (JFM @ Apr 20 2009, 02:05 PM) You should probably initialize the "EXIT?" boolean to FALSE before you enter the loops. I concur. That's probably the problem. Quote Link to comment
Thang Nguyen Posted April 22, 2009 Report Share Posted April 22, 2009 I think you are right. Sometime the problem is not too complicated as we thought LOL. If there are something new, I will let you guys know. Thank a bunch. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.