LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a single boolean on/off continuously on time bases?

Solved!
Go to solution

Hi all,

 

I am new to labview. I request guidance for creating, one boolean remains in off condition for 15 min, switches ON for 5 seconds.. then again the same cycle should be repeated continuosly. I want to start my logic using system time..

 

Please guide me.

 

Thanx, 

Vaibhav Gandhi
,
B.E. Instrumentation & Control,
INDIA
0 Kudos
Message 1 of 15
(10,050 Views)

Hi,

 

You could use a logic like this:

 

logic.jpg

 

Also, do have a look at ni.com/gettingstarted to understand more about LabVIEW basics and the use of graphical tools for programming your application.

0 Kudos
Message 2 of 15
(10,006 Views)

Vaibhav Vashisht,

 

Using your example for the 15 minute (not seconds) that the op asked for would be a bad idea.

 

Vaibhav G,

 

What have you tried? Have you considered a simple state machine? One state to check elapsed time and ine to set the logic?

 

 

0 Kudos
Message 3 of 15
(9,996 Views)
15 minutes; never noticed that. Then yes, a state machine would be the way to go.
0 Kudos
Message 4 of 15
(9,988 Views)

Hey,

 

I just made a small VI using state machine.. It should be considered as one of solution but not best.. I did documentation inside loop to explain wat that intend to do..

 

In VI i took two case named first and second then used state machine to switch over one another.. inside case i took while loop having time consideration check and finish as achieved.. as while loop finish it enters in another case there also same logic with different time consideration..

 

U can use same logic for as many case u want..

 

Hope it helps

 

HS

 

Time Control.JPG

Message 5 of 15
(9,960 Views)
Solution
Accepted by Vaibhav G
here is yet another example:
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Download All
0 Kudos
Message 6 of 15
(9,953 Views)

Hi herold,

 

Thank you so much...

Vaibhav Gandhi
,
B.E. Instrumentation & Control,
INDIA
0 Kudos
Message 7 of 15
(9,846 Views)

Hi HS,

 

 

Thank you so much.....

Vaibhav Gandhi
,
B.E. Instrumentation & Control,
INDIA
0 Kudos
Message 8 of 15
(9,842 Views)

We only need two states, so a boolean is sufficient. Here's a very simple implementation using the event timeout. (There is only one event case, nothing else).

 

 

Message Edited by altenbach on 06-10-2010 12:20 AM
Download All
Message 9 of 15
(9,828 Views)

H Sh wrote: 

.. as while loop finish it enters in another case there also same logic with different time consideration..


 

 
 Hmmm...
 
Why would you duplicate essentially the same code in multiple cases of the case structure if the only difference is two diagram constants (a time and a boolean). All that needs to be inside the case are the elements that differ. Shared code belongs outside the case so you only have one instance. Imagine you modify the code a little bit. Now you need to do the same changes in all other cases and if you forget, things become buggy, unpredictable and difficult to debug and maintain.
 
Currently, you VI cannot be stopped if it executes in an inner loop.
 
So: eliminate the case structure and inner loops and use the outer loop for the everything. Add a small case structure for the state, containing the two diagram constants.
 
Your loop needs a small wait. There is no need to check the time every nanosecond (or as fast as the CPU allows), consuming all CPU in the process. If you would check every millisecond (still way too often!), the cpu use would be a million times less!
 
I don't understand the auto reset logic. "And"-ing a boolean with a true diagram constant just returns the state of the boolean. You can delete all this without change in function. 
0 Kudos
Message 10 of 15
(9,801 Views)