07-29-2015 11:28 PM
HI
I am rather new to LabVIEW and I have several questions.
I am trying to program my pumps and other devices to run an experiment. The program works fine until I try to add in several new features on the user interface which would be elaborated below:
I thought of adding these three buttons on the user interface to create a user-friendly environment, especially for a user who is not used to the LabVIEW interface. These three buttons are not the typical 'Run', 'Pause' and 'Abort' buttons on LabVIEW. The Start button in my programme works fine.
How do I add in a pause button to pause the execution of commands, which works just like the standard pause/continue button by LabVIEW? Is the only way to do it is by adding a true/false control in between every single command?
As for the stop button, I think it works fine in stopping the entire sequence of commands by not the timer which tells the elapsed time.
I have created a timer to tell the total elapsed time. There are two problems:
2.1 Whenever I click 'stop', the timer continues running. Is there something wrong with my loops?
2.2 I have created two indicators to display the total time elapsed. I hope the the user could read the total time elapsed in terms of minutes and seconds, not just in seconds. Do you have any advice on this?
There are four main steps in my experiment: initialisation, filtration, lysis and rinsing. I thought of using strings to display text on the user interface (as seen in the 'filtration' strings). This functions works perfectly when I copied and used it on a blank new VI but not with the current VI which contains so many other steps. Do you have any recommendations that I should go about this?
At my Lysis step, there is a ten minutes delay/wait for the user. I am currently using a 'time elapsed' control to display the time elapsed but it doesn't work. I think I have done this wrongly?
Thank you for the help in advance!
07-30-2015 01:19 AM
Hi hqwoon,
all your questions have only one answer: use a proper state machine!
Once you implemented the state machine all things like Start/Pause/Stop and time measurement fall nicely into place!
And btw: you're not the first asking for a start/pause/stop feature. Have you searched for this in the forum?
07-30-2015 05:51 AM
And in case you didn't know what we were talking about: State Machine
07-31-2015 08:43 AM
@hqwoon wrote:
I am rather new to LabVIEW and I have several questions.
Well you've better than others, you can actually spell it right.
As others have said having a state machine will help a lot. Once it clicks it will be obvious why this design pattern is so common. As for buttons, in the idle case of your state machine you can have an event structure. This is a multi case structure (like a case structure) that executes a state based on an action of the user on a control on the front panel. So if the user clicks a button you go to the case for a Value Change on that button, assuming there is a case to handle that action. There are all kinds of other events too like mouse enter, mouse leave, trying to close the window, right clicking, scrolling, key down, etc.
New people are usually overwhelmed and taking all this new information, and knew way of programming can take time for it to click. Here is some online training, but the best training (in my opinion) is talking with someone who has experience doing it right, sitting in front of a computer explaining the reasoning for their design decisions.
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
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord