LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Relay Loop

In the attached picture inside the red circle is where I need help.  I'm trying to turn on 4 relays, it currently works but all the relays come on at the same time I need a 500ms pause between each relay and I can't seem to figure it out.  I would assume some kind of for loop would work I'm just not sure how to index the "Fan 1 switch", Fan 2 switch","Fan 3 switch", Fan 4 switch" into an array.

Any help would be much appreciated
Thanks,

Download All
0 Kudos
Message 1 of 16
(4,719 Views)
Incorporate the Elapsed Time function into your loop, and set it to 0.5 seconds.
Use a numeric indicator to keep count, and use the count with Case Statements and the Elapsed Time to control your relays.
(You could also check out the example for the State Machine wich would also work.)

You don't say if you want only one on at a time, or all four on at once after the 2 seconds.

I'll try to whip up a quickie example...

Robot wink
0 Kudos
Message 2 of 16
(4,703 Views)

Hi rocksolid,

try to use a state machine for that. One Case is the 500ms wait time and the other 4 are to switch on the relays.

Mike

0 Kudos
Message 3 of 16
(4,702 Views)

I'm running version 8.2 so I can't edit your program but I think this might be a good application for a sequence structure.

See Below

 

 

Tom



Message Edited by Tom Haggerty on 01-28-2008 01:18 PM
0 Kudos
Message 4 of 16
(4,699 Views)
Here's one example, using just a numeric indicator as the state control. The State Machine is only slightly more involved.

This example also shows one way to use an array to set your booleans to True/False.





Good luck!




Message Edited by LabViewGuruWannabe on 01-28-2008 12:36 PM
Download All
0 Kudos
Message 5 of 16
(4,685 Views)
Tom,

I tried what you suggested, but it is weird because the swiches on the front panel work correctly but the actual relays don't turn on until all the ones on the front panel are done and the the relays all turn on at the same time...any ideas?


LabViewGuru I will give your example a try
0 Kudos
Message 6 of 16
(4,681 Views)

That's because execution won't leave the thread until the sequence is done. So that is not a good method in this case....SORRY!!  LabView Guru's solution should work.

 

Tom

0 Kudos
Message 7 of 16
(4,679 Views)
LabViewGuru,

Is there a way to leave the relays on until the user specifies to turn them off

Thanks
0 Kudos
Message 8 of 16
(4,677 Views)
Sure. In Case 4, set the Next Count to 5, Add a Case for 5, and in there, just pass the count thru.

You may also want to tweak it so that the current array is also passed from one loop interation to the next using a shift register (just like the Next Count numeric).

You don't say how you want the relay controls to actually behave, so you may have to modify things to get it to work right.

Robot wink
0 Kudos
Message 9 of 16
(4,665 Views)
The way I want the relays to behave is when the user click the button "all fans on" it turns on fan 1 then 500ms later turns on fan 2 then 500ms later turns on fan 3 and then 500ms later turn on fan 4 where the relays are the fans

and then either when the user clicks turn off all fans or when the timer reaches zero the program will turn off all fans at the same time

does that make sense!?


0 Kudos
Message 10 of 16
(4,659 Views)