09-01-2015 05:00 PM
Hello
I was unable to find an answer for my question and hope someone can help here. I am putting together a test station for a "unit" and for one of the sub tests I want to verify each button on the unit functions and is read by software. The unit is running test code with rs-232 input/output enabled. So, when I press the first button on the unit, the rs-232 serial port will output "button 1: pressed", and similarly for each additional button. Once I understand how to use labview to check this I wont have a problem setting up a loop to check each button, but for a single button case how would one create a VI? All of the prompt user/dialog functions require "OK" buttons or similar. I want my code to prompt the user to "press button 1" then wait until it sees the string "button 1: pressed" at the RS-232 serial port and when it does, auto-close the dialog and continue on to the next.
Thank you!
09-01-2015 05:05 PM
Are you just asking how to get user input...? That's what the front panel is for. Alternatively, you can make your own dialog box that functions however you want by creating a subVI that shows its front panel when called. This requires a bit of know-how and trial/error to get it to function right. A lot of new developers will get their code caught up within the subVI popup and the top level application will never end.
If you're just trying to get some good programming practices in, it sounds like you want a State Machine.
The Simple State Machine template that ships with LabVIEW is really the best way for new developers to get familiar with LabVIEW while utilizing a semi-scalable architecture.
Here's a broad example of how a state machine works:
Lastly,
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe." - Abraham Lincoln
Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.
-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)
Learn NI Training Resource Videos
6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-02-2015 06:13 AM
You could do this with just a simple loop in a subVI. Have a string that you pass into the subVI to tell the user which button to press. Have a cancel button just in case something does not work. In your loop, you just keep reading the serial port. You will want a somewhat small timeout so that the cancel button can be read to abort the loop. Make the subVI display when called and close when done.