Labjack U3-LV question


frost

Recommended Posts

Hi,

I am new to DAQfactory and to the Labjack, I would like to ask for some help/advice on how to implement a sub-part of my project using both. I am working on a project in which I wish to use a Labjack U3-LV to control 9 switches (I actually have multiple U3s available if needed). What I would like is to have one of the nine switches be high at a time, and for the Labjack to have that pin go low after an interval (say, two minutes), and simply have the next one go high, and to restart at the first one after all have turned on and off.

From what I understand, the Labjack has 8 pins that can be configured as the outputs. Would this mean I would have to use two U3s? And what would I need to initialize for the Labjack(s)? Thanks.

Link to comment
Share on other sites

I can't really address the hardware specific stuff (though remember, you could use the DAC as a digital output). You should contact labjack.com for that. However, if you had 9 channels named switch1 through switch9, to turn each on for 2 minutes and cycle through continuously, you'd create a sequence like this:

// init to all off:
for (private count = 1, count < 10, count++)
   execute("switch" + doubletostr(count) + " = 0")
endfor
count = 1
while(1)
   execute("switch" + doubletostr(count) + " = 1")
   delay(120) // wait 2 minutes
   execute("switch" + doubletostr(count) + " = 0")
   count++
   if (count == 10)
	  count = 1
   endif
endwhile

I used the execute statement so I can use the variable to set each channel. You could, of course, just hand write it out, but that's cumbersome, especially if you decide to change the timing:

while(1)
   switch1 = 1
   delay(120)
   switch1 = 0
   switch2 = 1
   delay(120)
   switch2 = 0
   etc.....
endwhile

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.