LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI which commands action only when button is pressed

Solved!
Go to solution

I have two stepper motors which control a cart on each axis.  My goal is to make a program which allows others in my lab to easily assign a direction and distance they want the cart to move and then issue the command.  I want them to be able to update the direction and distance and then push a GO button which will sent the signal to the cart.  This is done using a VISA resource.  I have most the program done.  The issue I am running into is that my button does not work the way I want.  Either it doesn't always register the push or it sends the signal multiple times to the drive.  I have attached 2 VIs which implement my button mechanics in two ways.  Any help as to what I can to one or the other VI to get it to issue the command only once while letting the operator make additional input changes w/o stopping and starting the VI.  Thanks.

Download All
0 Kudos
Message 1 of 3
(4,436 Views)
Solution
Accepted by topic author Cseaman

You should be using the event structure so good for you on one of those examples attempting to use it.  Attached is the implementation that will actually work.  You press the button once and it acts on it once.  Also pressing stop, or closing the window does work as well.

 

EDIT:  If you get some free time you should take some training and try to find examples on the event structure.

 

NI Learning Center

NI Getting Started

-Hardware Basics

-LabVEW Basics

-DAQ Application Tutorials

 

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

Message 2 of 3
(4,423 Views)

In your Drive Control.vi, change the Mechanical Action of your Go button to be Latch When Released.  This will allow the command to be send once every time the button is clicked.

 

I also recommend moving the rest of your code into your event structure so ensure the command has the latest values when you press the button.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 3
(4,421 Views)