LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I input data to a table on the front panel and stop the program immediately as button is pressed?

What should I do if I want to display on the front panel in real time the values from Polarizer #, P1, P2 and the last calculated value (P2/P1 * 100) called T% in a table or some graphical representation like that?  What would I have to do?  It could just be Polarizer # and T% if that would be simpler.  I just want to let the user know the values in a list, spreadsheet or table as they go.  One last thing is that I would like to be able to stop the program at any point in time as soon as the stop button is pressed.  As of now, when the button is pressed it goes through the iteration currently in progress and then one afterwards.  I want the program to end as soon as the stop button is pressed no matter what sequence it is.  What can I do to achieve this?  Could you give me an example or modify my program to show me this.
 
Thanks,
Steve
Stephen Coward
Northrop Grumman
stephen.coward@ngc.com
0 Kudos
Message 1 of 8
(3,663 Views)
Put a single frame sequence structure around your stop button and then wire from the error cluster going into the error handler to the edge of the sequence structure. Now your code will stop at the end of the current iteration. To see why this works, watch you code execute with execution highlighting turned on and review the section of the manual talking about "Dataflow".

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 8
(3,645 Views)
That is an improvment but it still doesn't stop the program immediately.  The stop button at the top left of the tool bar (2 buttons to the left of the run button) stops the program immediately; is there a way I could wire that in, or is there a button like that?  Also, I am still trying to put in a table or some sort of graphical representation shown on the front panel, the values received from Polarizer #, P1 Reading, P2 Reading and T% just so that the user may see the results real time as they are stored and calculated.  Thanks for the help!
 
Thanks,
Steve
Stephen Coward
Northrop Grumman
stephen.coward@ngc.com
0 Kudos
Message 3 of 8
(3,628 Views)
Hi Steve,

there's a stop function that mimics the red button from the menu!

BUT:
This is not a good programming style. You should close all handles/references/devices - even when LabView will do this mostly for you.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,625 Views)
Do you have any ideas for either the stop function or the table?
Thanks for the advise.
Steve
Stephen Coward
Northrop Grumman
stephen.coward@ngc.com
0 Kudos
Message 5 of 8
(3,620 Views)

In order to stop sooner, you should really redesign your program and get rid of the sequence structure. A sequence structure always runs through all of the frames in the sequence. Using a sequence is not a very good way to program with LabVIEW anyway and there is seldom any reason to use one. Instead, use a state machine (look in the shipping examples). In each state, you can check to see if the stop button has been pressed and either go to the next state or go to a cleanup state and quit. 

A table is a 2D string array. With a shift register, you can update the table after each state completes.

0 Kudos
Message 6 of 8
(3,617 Views)

Where is the shipping state machine example located or can you reply with it attached?  Thanks for your response.

Steve

Stephen Coward
Northrop Grumman
stephen.coward@ngc.com
0 Kudos
Message 7 of 8
(3,588 Views)
Open the example finder and from the search tab, enter You'll find Queued Message Handler and Old Event Handler, and State Machine Test Sequencer. If you select File>New..., look under From Template>Frameworks>Design Patterns.
0 Kudos
Message 8 of 8
(3,585 Views)