LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

start button in a flat sequence

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. 

start-stop.png

 

 

0 Kudos
Message 1 of 17
(8,717 Views)

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) 

0 Kudos
Message 2 of 17
(8,713 Views)

"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.

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

Learn NI Training Resource Videos

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

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 3 of 17
(8,703 Views)

Agreeing with the above 2 posts. Also, there is an invoke node you can call to reset values to default, I believe.

0 Kudos
Message 4 of 17
(8,658 Views)

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. event-1.png

0 Kudos
Message 5 of 17
(8,640 Views)

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>   ---'


0 Kudos
Message 6 of 17
(8,635 Views)

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.

0 Kudos
Message 7 of 17
(8,632 Views)
  • The start button needs to be inside the event, else you get the stale value.
  • You don't neeed the case structure
  • Don't gum up the gears by using a loop inside an event case. You can use a seperate loop (queues) or potentially recruit the timeout event (old example).
  • Number 1 terminal probably also needs to be inside the loop.

Please attach actual code (vi). We cannot see the other cases and we cannot run or debug pictures.

0 Kudos
Message 8 of 17
(8,630 Views)

Haha, I love when these quick-replies happen. Smiley LOL

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 17
(8,625 Views)

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. 

0 Kudos
Message 10 of 17
(8,604 Views)