LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Starting a Program

My program records numbers and puts them into a table. It finds the maximum temperature of these.  I want to be able to pick which run any combination of 0-3.  The program starts before I can pick.  Not everything is working at the moment but I need to fix that before I can move on.
0 Kudos
Message 1 of 15
(3,784 Views)
What you need is a while loop before the rest of your code that has a small wait statement in it. Have a "Go" or "Start" button that is tied to the stop terminal of that first loop. That way the program is running, but is waiting in that loop until you press the Go or Start button. That loop ends then the rest of your code can begin.
Message 2 of 15
(3,776 Views)
The small "starter" while loop goes inside the main while loop?
Message Edited by nicholas03 on 10-13-2009 11:09 PM
0 Kudos
Message 3 of 15
(3,757 Views)

Hi Nicholas,

 

I think he means that the "GO"-while loop is on the outside of everything else, so it starts right away as the very first thing and runs until you hit the button.

There are several ways of solving your problem, but I think Ravens solution is by far the easiest one 😉

 

Kudos!!

Pattos

LabVIEW Gretchin
0 Kudos
Message 4 of 15
(3,744 Views)

Yes, before the main while loop.  One other thing you'll need is some data dependency such as the boolean wire running out of the Start while loop and running to the Main while loop, even though you won't use that value in the main while loop.  That guarantees the main while loop won't start until the starter loop ends.

 

There are other ways of doing this as well such as a state machine, or using event structures.  But this method will be quick to add and get you going sooner.  If your program becomes more complicated, then you may want to think about a more sophisticated design.

Message Edited by Ravens Fan on 10-14-2009 10:40 AM
Message 5 of 15
(3,714 Views)
There is a problem because the event structure contains the buttons I want to be able to press before the program starts. The solution I tried is deleting the buttons case. This allowed me to select which buttons I wanted to have on before starting the program. It also did not freeze up once I switched one button because it did not stay in the buttons case. Now I need to find an easier way of changing all my numbers into a text to put into my table. The way I have it looks too complicated. Is there an more organized method to my madness?
Message Edited by nicholas03 on 10-14-2009 10:30 AM
0 Kudos
Message 6 of 15
(3,704 Views)

I've had a chance to look more closely at your code.

 

I think the problem is that you have a 10msec timeout wired to your event structure.  And all of your main code is in that timeout case. (What are you actually trying to do with that code?)  So of course it looks like the program is starting right away.

 

You should add a "Go" button.  Create a value change event for that.  Wire a -1 into a shift register which goes into the timeout node.  In the Go Value Change event, have a 10 (or whatever msec timeout you want) go into the right hand shift register.  Wire from left hand to right hand shift register in all the other cases.

 

Now your main code won't run (because of the infinite timeout) until you have hit the Go button which effective changes the timeout to 10 msec.

0 Kudos
Message 7 of 15
(3,692 Views)

I have done a lot of work on the program. It starts like I want it to. I just have to figure out how to calculate the unfilled collumns (X degrees to gel, gel to peak, start to peak). The peak is just the maximum number. I do not know how to find the time at which it reaches that number. Also the gel temperature, unlike the "X Control", must be separate between each test (0,1,2,3). Ill keep working and attached my in progress Vi. Thank you for all your help.

The program is very rough around the edges right now. I am just trying to grasp the whole Labview programming. I am a freshman in college right now and trying to learn Labview while studying. 

0 Kudos
Message 8 of 15
(3,687 Views)
Take a look at this example architecture I posted in another thread. It may give you some ideas how to put together a fairly robust application architecture.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 9 of 15
(3,664 Views)
I looked at your achitecture vi but do not know how to simplify my program into that architecture.
0 Kudos
Message 10 of 15
(3,651 Views)