LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple? programming?

I have just gotten Labview and would like to just have a simple switch on the
control panel activate a counter on a digital display. I know I must be making
this harder than it is but I am confused. Help please
Jim
0 Kudos
Message 1 of 3
(2,653 Views)
JIMBO NIC wrote:

> I have just gotten Labview and would like to just have a simple switch on the
> control panel activate a counter on a digital display. I know I must be making
> this harder than it is but I am confused. Help please
> Jim

I will interpret this in a certain way. If this is not correct it will at least
give you some pointers.

Assume:
I want a VI that runs constantly, it waits for me to hit a switch, it starts to
count, at some point I wish
to stop the count and / or stop the VI.

Process:
Make a New VI
On the front panel drop a Boolean named Start Count, a Boolean named Done, a
digital indicator named Count.
On the diagram, make a while loop (fairly large area), wire the Done to the test
control (looks like a loop in lower right)
Wire a NOT betw
een the DONE and the test control.

Inside this loop drop a case statement (almost as big as the while).
In the true case (or false) drop another while loop. Leave the other case empty.
On the edge of the while right click and select add shift, right click the shift
and create a constant
inside the while drop a +1 wire it between the left and right shift. Wire the
Count to the
output of the +1.
Wire the Start Count to the input of the case (looks like a question mark "?").

When the vi is run is will loop wiating for the Start Count to be pressed (make
the mechanical action latch...)
When pressed the digital display will count up by 1 for every loop. It goes
REAL fast so you may need to
add a "Wait MS). When the Start Count is pressed again the counting will stop, the
VI will continue to
run until the DONE is pressed.

This is really much easier than it sounds.
I can send you a small sample (in version 5.1) if you like.,
Kevin Kent
0 Kudos
Message 2 of 3
(2,653 Views)
JIMBO NIC wrote in message
news:20000927195618.09028.00000688@ng-fh1.aol.com...
> I have just gotten Labview and would like to just have a simple switch on
the
> control panel activate a counter on a digital display. I know I must be
making
> this harder than it is but I am confused. Help please

Not clear what you mean by "activate". Do you want a counter to increment
each time you press the button, or do you want something like a stopwatch?

Either way, you make a while loop with the terminals for the indicator and
the button inside it, wire a "true" constant or control to the loop
conditional and use the button to control a case structure. The number in
the terminal is held in a shift register- when the button is true the value
in the shi
ft register is changed in whatever way you want, when it's false
there is no change. Put a delay inside the loop appropriate to the response
time you want- a shorter delay results in a faster response or count rate
but at the expense of increased CPU overhead.
0 Kudos
Message 3 of 3
(2,653 Views)