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.