LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run and stop LabView code without using start and stop buttons

Solved!
Go to solution

Hey

 

I've attached my code that I'm going to use with thermocouples. What I'm trying to do is: when I hit start button the code should run for a minute then stop for 5 minutes and then start again, this process should be repeated twice . Could you please suggest the appropriate way to do it.

 

Regards 

 

Rajab

0 Kudos
Message 1 of 7
(4,533 Views)
Solution
Accepted by topic author Rajab84

A simple state machine is all you need. The program itself should always be running.

Message 2 of 7
(4,525 Views)

elapsed timer can be a help....

Message 3 of 7
(4,514 Views)

Hi 

 

Thanks a lot for your help, I've tried the state machine, I’ve created 5 case structures as following: start for 1 min, stop 5 min, start again for 1 min, stop 5 min, restart again 1 min and finally stop. I’ve tried the code and it didn’t work. Could you please have a look at the attached code and let me if I need to change something. I think I’ve not used the elapsed time function properly. 

 

Best Regards 

 

Rajab

0 Kudos
Message 4 of 7
(4,427 Views)

@Rajab84 wrote:

Hi @altenbach

 

Thanks a lot for your help, I've tried the state machine, I’ve created 5 case structures as following: start for 1 min, stop 5 min, start again for 1 min, stop 5 min, restart again 1 min and finally stop. I’ve tried the code and it didn’t work. Could you please have a look at the attached code and let me if I need to change something. I think I’ve not used the elapsed time function properly. 

 

Best Regards 

 

Rajab


you really dont need to repeat cases (2x)...using a shift register will reset your timer function once the timer has reached it's set limit. the "bool crossing" is used to tell me when the "5 min" case is done and increments the cycle count....ofcoarse, change the "seconds" constant to your desired time on the elapsed timer of this example  Smiley Wink

and you could "or" the stop to the "compare = 2" or change the select "wait" to "exit" with a constant connected to the stop

start stop.png

Message 5 of 7
(4,411 Views)

Hey apok

 

I really appreciate your help, please forgive my ignoranceSmiley Embarassed I just want to ask how can I connect my code with the one you've attached??  Is it going to be within my main while loop or the other way around?.

Sorry I've not done any programming before 

 

thanks a lot 

 

Rajab 

0 Kudos
Message 6 of 7
(4,394 Views)

@Rajab84 wrote:

Hey @apok

 

I really appreciate your help, please forgive my ignoranceSmiley Embarassed I just want to ask how can I connect my code with the one you've attached??  Is it going to be within my main while loop or the other way around?.

Sorry I've not done any programming before 

 

thanks a lot 

 

Rajab 


the example code given should be your main code, place the data acquisitions within the case statements... Smiley Wink 

0 Kudos
Message 7 of 7
(4,383 Views)