User123 Posted March 20, 2015 Share Posted March 20, 2015 Hi I am a beginner, and my question might have a very simple answer. I am trying to set up a sequence such that a part of an instrument (controlled by LabJack U12) would turn on, and then after a set period (e.g. 30 minutes), turn off, and then repeat this for a prespecified interval of time (e.g. 48 hours). In short, over a 48 hour interval, I want the instrument to turn on after every 30 minutes, stay on for 2-3 minutes, and then turn off again. Is it possible to do with DAQfactory? How do I begin? Should I just use the while (1)> set> delay> endwhile steps? Thanks! Link to comment Share on other sites More sharing options...
AzeoTech Posted March 21, 2015 Share Posted March 21, 2015 Sure, just use some basic script. Something like: private onTime = 30 * 60 // 30 minutes * 60 seconds per minute private offTime = 3 * 60 private totalTime = 48*60*60 private startTime = systime() // get currentTime while (systime() < startTime + totalTime) output = 1 // turn on wait(onTime) output = 0 wait(offTime) endwhile Note that I use wait(). You could use delay() too, but you'll get some propagation (i.e. the actual loop time will be, in my case 3 minutes + 30 minutes + a few milliseconds for the LabJack calls and script execution). Using wait() eliminates this, though can cause problems in some instances, thus the warning you get. Not an issue here. Link to comment Share on other sites More sharing options...
User123 Posted March 21, 2015 Author Share Posted March 21, 2015 Thank you very much. I am using two LabJacks and they typically run at the same time. I have two different sets of outputs (for both sets of instruments). How can I include channel information (i.e. specify which channel this sequence should work on)? Link to comment Share on other sites More sharing options...
AzeoTech Posted March 22, 2015 Share Posted March 22, 2015 It'd probably be easier in the long run to just create two sequences. Its not the best programming technique, but is easier to understand. It would also allow you to run both loops at the same time. Link to comment Share on other sites More sharing options...
User123 Posted March 30, 2015 Author Share Posted March 30, 2015 Thanks, I was able to program the sequence. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.