LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

updating boolean indicators in timed loops

Hi friends,
 
I'm new to LabVIEW and I've got to cope with a quite complex project...Smiley Sad
At a certain point in this project I have to update the state of 3 boolean indicators (something like a semaphore).
I' using time loops because at least one of the indicators has to blink with different colours
at a predetermined frequency. The problem is that neither the timed loop can update
the indicators corectly. Actually I see they're not  blinking right (the frequency is not mantained)!
 
Moreover often some of the iterations of the timed loop return "finished late" although a single iteration
is lasting 700 ms and in it I just write on (up to 3 local variables)!
 
Can anyone help me!!!
 
Thank you
 
 
 
 
0 Kudos
Message 1 of 16
(3,227 Views)
We need to find out why this loop is slow and even sometimes finishes late. Writing to three local variables is peanuts and should not take 700ms.
 
You say it is a complex project. What else is running in parallel to that loop? How many timed loops do you have? Is it possible that other parts of the code also write to local variables of these booleans? Why don't you place the indicator terminals in that loop? Try to find all other local variables of these booleans.
 
Could you attach a simplified code fragment that still shows the problem?
0 Kudos
Message 2 of 16
(3,209 Views)

You say you're using timed loops, so are you running this VI on a real-time target? If so, are the boolean indicators on the front panel of the RT target? Front panel updates have low priority on the RT and you might not be seeing all the boolean changes. If you're not on a RT target, you might as well be using a regular while loop.

Also, how fast do you want to run the loop to run? 700ms? Try to use counters for when they change state rather than relying on sight.

 

0 Kudos
Message 3 of 16
(3,203 Views)

Hi

my software follows a producer-consumer design pattern. I post a (very) gross block diagram to make you understand how many loops there are and what they do.

Thank you  

0 Kudos
Message 4 of 16
(3,185 Views)
So the timed loops are inside the bottom while loop??? That does not seem quite right....
0 Kudos
Message 5 of 16
(3,167 Views)
yes, the timed loops used to update the LEDs are there.
How can I change the code to make it mroe efficient?
I post an image of the forth loop. This loop contains a case structure where all the cases are similar to the one illustrated.
0 Kudos
Message 6 of 16
(3,164 Views)
Try to attach the latest image once more, it did not make it. 😉
0 Kudos
Message 7 of 16
(3,158 Views)

sorry, forgot to postSmiley Wink

what do you think about substituiting the 4th loop with a case structure in which I can put the different updating procedures

(flat sequences in the figure posted) ?

0 Kudos
Message 8 of 16
(3,159 Views)
Writing to your queue in one place and reading it in three different places is not going to work. When you dequeue an element it is no longer in the queue and will not be available to the other loops. You may need to think about your program structure.

Lynn
0 Kudos
Message 9 of 16
(3,155 Views)
The image "program structure.jpg" is just a gross modeling of the actual program. I have different queues and each of them is read in just one loop.  
0 Kudos
Message 10 of 16
(3,151 Views)