08-31-2015 10:45 AM
Hello,
I am new to LabView Programming. So, first of all apologies if I seem to be ignorant. We are trying to carry out data acquisition for a bench top reactor at our facility using Cdaq and LabView Platform. However, we have just purchased the hardware and do not have it set up in our plant yet. Meanwhile, we are trying to solve our coding part. As we donot have hardware part functional yet, we are writing a dummy code that follows the same loops and sequence.
Right now, we would want this process to start once the start button is clicked; goes into a case structure and executes the true condition which has a flat sequence. If the start condition is not pressed it stops the program as shown below in the figure. My question is, how can we stop the program in between during the run. If I hit the start/stop button when the program is in progress it doesnt stop and we are wondering if there is a way to do so.
Also, is there a way to add a reset button which when pressed resets all the value.
Thanks for the help in advance.
08-31-2015 10:47 AM - edited 08-31-2015 10:49 AM
Use an event based state machine instead.
(are you aware that none of your controls will ever get read again once the program has started? Seems limiting)
08-31-2015 10:52 AM - edited 08-31-2015 10:52 AM
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe." - Abraham Lincoln
You should do a little legwork initially to get a better understanding of LabVIEW. Like Altenbach said, you want to a state machine. There is a Simple State Machine architecture template that ships with LabVIEW 2013+.
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> ---'
08-31-2015 01:46 PM
Agreeing with the above 2 posts. Also, there is an invoke node you can call to reset values to default, I believe.
08-31-2015 02:49 PM
We changed the code to a event based structure. Given below is the picture. However, we are still having few issues. The start button does not move the T/F value to the event structure until pressed again. For example: Once the program starts, the start function reads the condition (say its F), it doesnot pass on the False condition to the event structure until the button is pressed again. Is there a way to pass on the value to the event structure without pressing the button several times?
Also, earlier we had a flat sequence to operate series of events sequentially. Now, we have moved to use event structures instead and we are not sure how to carry out operations sequentially. We have a second event coded in this but we are not sure how to start that event once the first one ends.
Thanks in advance for your time and help.
08-31-2015 02:52 PM - edited 08-31-2015 02:53 PM
Once again, you should do a little legwork initially to get a better understanding of LabVIEW. You need to have the button terminal inside the event structure because of dataflow. In your case, you are reading the boolean value before the event structure so then once the event structure triggers, it still has the old value used.
LabVIEW programming is based entirely on dataflow and parallelism. This is incredibly powerful and has lead to its success over the years (coupled with the graphical programming), but is usually one of the first things that new developers stumble over. Here's a simple resource to become more familiar with how it works. The Highlight Execution feature is a great way to watch how your application utilizes dataflow.
Please include a Snippet of your code, or attach your VIs, so that we can better assist you. We are here to help, but won't spend all day recreating your code from scratch.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-31-2015 02:53 PM
The start button belongs inside the Start Button VAlue change event case.
Right now you read it as false, then when you press it, the false value continues into the event case.
You don't want to read it until after it has entered the event case.
08-31-2015 02:53 PM - edited 08-31-2015 02:57 PM
Please attach actual code (vi). We cannot see the other cases and we cannot run or debug pictures.
08-31-2015 02:55 PM
Haha, I love when these quick-replies happen.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-31-2015 03:18 PM
Attached is our program modified as per these suggestions. Can you guide us how to sequence these operations ? We want event 2 to start executing once event 1 ends.
Thanks.