From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Much like a wall timer, how do I program labview to simply flip a switch at a certain time? Simple to you but HELP asap!

I've got a case structure going here...  I can control it with boolean (on/off) and I'm controlling an 1160 switch module successfully.
 
The question is, and this is dauntingly difficult to me, how do I set it so that boolean changes at a specific time?
 
I need to activate that 1160 switch to shut off an extrernal relay at 8:00PM tonight.  How can I use the date/time strings and whatnot to get me where I need to be?
 
I've looked at Scheduler.vi and can't make heads or tails of it...  HELP...
 
Dirt simple VI attached.
 
___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 1 of 14
(3,705 Views)
Hello:

This is a quick simple VI that may help you, I made it ASAP.

Compares a target hour versus the output of the Format Date Time String, which receives the current time.

If they're the same, it means it's time to shutdown, and stops the While Loop.

Pretty simple, hope this helps you, or if I misunderstood your problem, please let me know.

Robst.


Robst - CLD

Using LabVIEW since version 7.0


0 Kudos
Message 2 of 14
(3,692 Views)

I ended up playing with this a little more and used two loops with some local variables...  Hopefully I didn't go too far 'round the lake for water here, but I have a hard time getting loops to work unless I use local variables 😞  I've got no formal Labview training and have been beating myself senseless on this stuff since day one.

My updated VI which does what I need it to; any suggestions?

 

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 3 of 14
(3,687 Views)
Hello:

You don't need the two loops. With only one loop you can have your job done. I've attached the modified VI.



Robst - CLD

Using LabVIEW since version 7.0


0 Kudos
Message 4 of 14
(3,681 Views)

I'm not sure why but that never worked for me before.  Kept cycling and clicking the switches.

Maybe I didn't have the stop wired right.

 

Thanks though, that's working perfectly!

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 5 of 14
(3,670 Views)

Here's another solution. It just gets the current hours in 24 hour format and sees if it's greater than 20.

Message Edited by Dennis Knutson on 05-04-2007 02:06 PM

0 Kudos
Message 6 of 14
(3,668 Views)
That's kinda what I started with, Dennis, for some reason I couldn't end up with everything working with the Boolean values.  I'm not sure what I had wrong but it all seems to work now.
 
'Insert Confused Smiley Here'.
 
Either way I've got a pretty good shot at doing what I need to now.  My last VI was very, very complicated (to me) and took a couple months to develop...  I was confident that when my boss asked me to develop this quick VI to shut off a test tonight 'because nobody wanted to come in and do it manually', that it would take me moments.
 
Of course, murphy's law applied and I'm just connecting the wires as I'm headed out the door.  Such is life, and thanks guys!
___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 7 of 14
(3,658 Views)
And if you don't want to use loops. Subtract the current time from the target time and sleep that many seconds.


Message Edited by Matt W on 05-04-2007 03:17 PM

0 Kudos
Message 8 of 14
(3,654 Views)

That's another cool idea...  I'll have to try that one out!

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 9 of 14
(3,649 Views)

Hi Dennis,

 

I know this is a very old post,  but the info applies to my current task...

 

I tried to use your example in a little test vi, but for the life of me, I cannot find this icon anyplace on any of the pallettes?

It is the one circled in RED.  What is it called and where is it located???

 

I have 2010-2012 and cannot find it at all.  Is it some old function block that doesn't exist anymore?

 

Thanks!

The Dude 

 

 

**************************************************************************

 

Icon.PNG

 

 

0 Kudos
Message 10 of 14
(2,996 Views)