LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement boolean comparison and event structure?

Thanks for all the help. I spent the last 4.5 hours changing up the VI into one while loop (and what I think is a sort of state machine minus the enum). It now works with both positive and negative unknown values. Unfortunately I cannot enter negative voltages because the DAQ Assistant cannot have a minimum below 0 for the USB-6008 that I have. I realize the SET ZERO button can be pressed/unpressed (which is undesirable) and the "Unknown Value" can be changed throughout the run (also undesirable). Let me know what you think of the new VI.

 

Regards

0 Kudos
Message 11 of 16
(431 Views)

Much nicer.

 

Here are a few comments.

 

1. Avoid the use of Value property nodes, especially where a wire will work. Unknown Value can be wired directly and Average DAQ Input can be wired with the help of a shift register. Property nodes are slow and force the code to execute in the User Interface thread.

2. The Read DAQ Assistant appears to be set to read 100 samples at a rate of 1000 samples per second. This will take 100 ms. The event structure timeout is set to 50 ms. Give some thought to what controls the timing.

3. While probably OK here, it is generally not good practice to include inside an event case any code which might take significant time to execute. If the DAQ Assistant were set to acquire 10000 samples, the program would not respond to any of the value change events for 10 seconds. The user would get very frustrated! The fix is a two loop structure using parallel loops called the Producer/Consumer Design Pattern. I think it might have been available in LV8.0. You can certainly make one, even if the template is not included.

 

Lynn

Message 12 of 16
(419 Views)

@gBlaskov wrote:

I realize the SET ZERO button can be pressed/unpressed (which is undesirable) and the "Unknown Value" can be changed throughout the run (also undesirable).

 



You probably want your button's  mechanical action to be Latch when Released as opposed to its current Switch when Pressed.

Message 13 of 16
(414 Views)

Thanks so much! I couldn't find a Producer/Consumer example on LV 8, but I've found some tutorials via google.

0 Kudos
Message 14 of 16
(407 Views)

So, I've been trying to learn how to use queues over the last couple days, but I don't fully understand them. I tried to use the Producer/Consumer (Events) template that was included in LabVIEW 8.0. I'm wondering though, should I be trying to use a

type def enum (like in standard state machine) or using my DAQ numeric values as my queue elements? I guess a better question would be, is this even the direction I should be going in?

0 Kudos
Message 15 of 16
(375 Views)

Definitely continue working in this direction.

 

Definitely typedef your enum.

 

If you make the datatype for your queue a cluster, you can have a lot of flexibility as to the data you send.  It could be a cluster of the enum and a numeric so you can send a command and data simultaneously.

Message 16 of 16
(365 Views)