LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case Structure Problem

Amal,

I don't have time now to put together an example for you. As soon as you start changing what the program needs to do, this is a sign that you need a flexible program architecture. What I recommend for this is a state machine. Look at the design pattern or template called Producer/Consumer Design Pattern (Events). In LV 8.20 this is located at File >> New.. >>Create New >> VI >> From Template >> Design Patterns >>

The user interface would go in the Producer Event structure. The commands (generated by pressing buttons) are passed to the Consumer loop via a Queue. The stuff which is in the Case structure in the Mark Bad? Value Changed case and in the time out case would go into various states of the Consumer loop state machine along with any cases you need to add.

The are examples with LV and posted to this Forum. Search for "state machine."

Lynn
Message 11 of 13
(604 Views)

I have another question, but totally un-related to what I've been asking.  I am re-attaching my VI, but it's modified.  I am unable to toggle, or interupt my "countdown" after I press the boolean.

For example, I click my Boolean, "Mark Bad" and a countdown of 10 Seconds begins.  However, if I wanted to interupt this countdown by pressing the Boolean Switch "Mark Bad," I am unable to.  Why is this happening?

Thank you!

Amal Patel
0 Kudos
Message 12 of 13
(565 Views)
Amal,

It works that way because of dataflow. When a program reaches the point that you need to redesign it every time you need to make a small change in the way it works, then it is time to consider another program architecture. Your program is one where a Consumer/Producer pattern state machine with events is appropriate. An template ships with recent versions of LV. Here is a version which puts all the buttons into an event structure and the timing and data displays in a separate state machine linked by a queue.

The States control is a type def so that any changes will automatically update constants derived from it.

Lynn
Download All
0 Kudos
Message 13 of 13
(548 Views)