LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie needs help with timer control

I need to write a program that is supposed to control 8 different lamps, working as a programmable timer. I wan't to be able to, for each lamp, to set an on time (in minutes) and an off time (also in minutes) and then I wan't the program to switch between on and off with the specified intervals.

I have a DAQ with DAQmx and 8 digital I/O:s and I've figured out how to send the correct signal. It's the timing function that I really can't figure out.

I've tried a few models with FOR-loops or Sequences with Wait-functions, but the problem is that I seem to loose control of the program while it waits for the Wait-function to finish. I can't end the programs main While-loop etc. So far I've only worked with one channel and I can only imagine the trouble of getting 8 different Wait-functions to collaborate, so it seems to me there must be a better way.

So what I need is perhaps a few pointers telling me where to start, I seem to be stuck with the wrong thinking. Perhaps a flowchart or som pseudocode would help, or even better, a Labview-example.

Summary of the program function:

* 8 channels, to be controlled either manually or by timer
* Each channel to be controlled individually, with different timer settings
* Different settings for on and off times.
0 Kudos
Message 1 of 4
(3,092 Views)
It is all in the dataflow. If you only have a single loop and a long wait, the iteration cannot finish and the UI becomes unresponsive. You would need to place the UI operations and the light logic in different loops.
 
There are many ways to do this. Let's assume that the timing does not change during the run of the experiment. Here's a simple example (LabVIEW 8.2) with 3 lamps (simulated as LEDs). Since all is done with arrays, it can easily be expanded to N lamps without any real change in code.
 
 
 

Message Edited by altenbach on 10-28-2007 09:56 AM

Download All
Message 2 of 4
(3,068 Views)

Hi gronfelt,

Attached is my solution - I'll leave you to figure out how it works.

It's in LabVIEW version 7.0.

Regards.

Mark H.

P.S. As you are a "newbie" - don't forget to give feedback & rate replys. (5* will be fine - thanks Smiley Wink).

Message 3 of 4
(3,062 Views)
Many thanks to both of you, I'll look in to your examples and make sure that I understand them and then I will hopefully be able to create a proper solution of my own.
0 Kudos
Message 4 of 4
(3,027 Views)