LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wierd behavier using notifiers

Hi!

I cant understand why my program (loop) stops when boolean notifier gets a true value!
In my program there are two parallell loops. The left loop reads byte via visa serial if there are
any incoming bytes to read. This loop also writes to visa port at special boolean command and emptys a queuebuffer when told so from right loop.

The right loop only consumes values from left loop (using "cueue-function") when three bottoms are pushed. When these bottoms
are not pushed the queuebuffer is growing and empties every 10 seconds. When the three bottoms are pushed and the consuming starts, notifier sends a true value to left loop and queuebuffer shall not emptie. When all bottoms are not pushed notifier sends false value.

Now, the program doesnt move further when these bottoms are pushed!!

please take a look at it.

There are 2 subvi:s in it but the first only configures serial port, and the other writes to serialport(this vi has a casestructure)


thanks Fred
0 Kudos
Message 1 of 3
(2,830 Views)
I took a look at the code and to be honest I am not sure what all you are trying to do.

First the "s k" control is hidden, and as far as I can see there is no way to change its value, so you can not get into the while loop to chart the data.

However once I changed that I did see the VI getting stuck.

The reason is beacuse you are flushing the Queue, and I am not sure why. When you do that you remove all the data in it so you are no longer sending data from one loop to the other you deleted it all. Then right after you flush the Queue you try to deque and element, but it is empty. So it is simply waiting for you to give it data. However there is no gaurantee that when you send the notification to the Left loop it will but data in the queue. So you are stuck with both loops waiting.

Because I am not exactly sure what you end goal is I am not sure what to suggest, however I have a feeling you don't want to flush the Queue in the right loop/

If I am wrong we can see if there is a different way to reach your end goal.
0 Kudos
Message 2 of 3
(2,805 Views)
Hi!

I made it work. I programmed differently! I now dont have to flush.

The goal is:

Its only when all three buttoms are pushed that the consuming will start with putting values in queue and right loop deals with it.
Otherwise left loop will not put values in queue.

I solve this with notifiers sent from right loop to left that indicates true or false if all buttoms are pushed or not.

The funny thing know is left loop cant run faster than right because waiting on notifiers! I dont
think that is a bad thing? Queuebuffer never grows!

comments are welcomed!

/Fred
0 Kudos
Message 3 of 3
(2,797 Views)