LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I control the Digital outputs of the usb 6009

I am using the USB 6009 DAQ module to read 8 analog voltages, and based on the level, control a digital output to turn on a relay.  I have a accomplished reading the voltages but I am stuck as to how to control the outputs.  Here is how I would like it to work.

 

- measure incoming voltage

- if it's below lower setpoint then turn on appropriate digital output (pulse output, x ms on and y ms off then repeat if still below lower setpoint)

- the digital output activates a relay that turns on a valve that fills a cylinder with water (cylinder sitting on load cell)

- once the weight (voltage) reaches the upper setpoint the output should turn off

- after the ouput turns off the weight will gradually drop again due to evaporation

 

I need to measure 8 voltages and control 8 digital outputs per module and there will be 3 modules (24 scales to weigh and 24 valves to control)

 

It will take approx 12-24 hours for the weight to go from the upper setpoint to gradually drop down to the lower setpoint so I only need to sample the input every minute or so.  Once the lower setpoint is reached, the output will be turned on and off until reaching the upper (we don't want to fill the cylinder to quickly to allow for water to absorb into the soil)

 

I have attached the VI I have so far so any help would be appreciated.  If there is a way to accomplish this easier or better than this I am all ears.  We will be using Labview 2009 (this VI was done on 8.5) Thanks

0 Kudos
Message 1 of 14
(4,260 Views)

Hi,

 

Did you allready had a look at the digital I/O examples from DAQmx (LabVIEW>Help>Find Examples).

 

 

Christian

0 Kudos
Message 2 of 14
(4,248 Views)
Yes I did and I tried a few things but I couldn't get the examples to work with how I have my VI setup.  All my outputs are currently the valve leds on the user interface and I couldn't figure out how to combine all the outputs into a signal to send to the 6009.
0 Kudos
Message 3 of 14
(4,232 Views)

You don't have to combine anything. A single DAQmx Write is enough. You would want the Create Channel, Start Task, and Clear Task outside your loop. You could also use the DAQ Assistant (ugh) by creating one for each channel. I believe that if you use the DAQ Assistant, you will have to convert the Boolean to an array.

 

Digital Write.PNG

0 Kudos
Message 4 of 14
(4,221 Views)
So I would just place the DAQmx Write in the frame of my sequence where I turn on or off the LED?  If so, would I wire it with the wires passing through all frames or just in and out of the ones that are the outputs?  Thanks for the help.
0 Kudos
Message 5 of 14
(4,207 Views)
That's up to you. I would consider making a subVI out of all that duplicate code. If you want to use property nodes, then you would pass a reference to the Booleans to the subVI as well as the task. If you don't, you should know that property nodes are significantly slower than a local variable. The Value(Sgnl) property makes no sense at all.
0 Kudos
Message 6 of 14
(4,194 Views)
I was told by NI people a while back that property nodes were better to use because apparently Labview has trouble keeping track of too many Local variables and that only a few should be used in any application.  Like I said, if there is a better way to do this I am all for it.  Thanks again.
0 Kudos
Message 7 of 14
(4,187 Views)

You should be minimizing your use of both locals and Value property nodes since the potential for race conditions is there. I'm not aware of any upper limit on the number of locals.

0 Kudos
Message 8 of 14
(4,183 Views)
I was able to get it working using DAQmx Write, and I changed the Value(Sgnl) property nodes.  I wired a couple LED's to the digital output pins on the 6009 and was able to control them.  Now I am just seeking some advice or examples on how to optimize it and make it better.  Thanks.
0 Kudos
Message 9 of 14
(4,156 Views)

Dennis wrote: ..You should be minimizing your use of both locals and Value property nodes...

 

This could be the first step. And you could create SubVIs

 

 

Christian

0 Kudos
Message 10 of 14
(4,149 Views)