Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ Output Timing Control

Hello. I am trying to control a solenoid with a relay (the USB 6008 output is being used to activate the relay). The problem I am having is that I only want to output 5V for a few milliseconds. What is the best way to approach this? I have very little experience with timing as you can see. Thanks.

0 Kudos
Message 1 of 10
(3,297 Views)
With the 6008, you don't have many options. You can simply use a DAQmx set to output a true followed by a Time Delay function followed by a DAQmx Write set to output a false. Your timing is going to experience some significant amout of jitter because a windows os is not deterministic and the pc's millisecond timer is imprecise.
0 Kudos
Message 2 of 10
(3,290 Views)
Yeah that makes sense. I just have one problem attempting to wire that. I cannot use the false output for the DAQ Assistant because that is multiple channels and a single task. How would you approach that? Thanks.
0 Kudos
Message 3 of 10
(3,275 Views)
For one, I would never use the DAQ Assistant. A single DAQmx Read set for Digital Boolean 1Line 1Point is all you need. If you reallywant to use a DAQ Assistant and have configured it for a single line, take your Boolean and wire it to a Build Array function and the output of that goes into the DAQ Assistant or just place an array constant on the block diagram. The same is true if you have multiple channels.
0 Kudos
Message 4 of 10
(3,272 Views)

When I attempt to wire it that way I get a connection error saying that there is an array element conflict and that I've connected a 1D array of Dynamic Data to a sink of Dynamic Data. Could you take a quick look at a short code I've written? Above 0.4 V is the voltage I am looking for, and it takes 5V to activate the relay. It is in LabVIEW 8.6. Thanks.

0 Kudos
Message 5 of 10
(3,250 Views)

That VI makes absolutely no sense and is not at all what I suggested. What are you trying to do with the analog read? Is the voltage supposed to correlate somehow to the delay time? Why are you using the analog out of the 6008 instead of the digital?

 

The logic that you are applying to the data from the analog output does not make any sense either. You are comparing the voltage to  .4, This will return a True or False. You then subtract 1 from theTrue or False. This is why I detest dynamic data. It makes possible the wiring of completely non-sensical logic.

 

If you use a single digital output like I originally assumed, then your code would look something like the image below. Even if you stuck with the analog output, there is just no reason to wire anything from the analog in to the analog out. The analog outputs would be constants of either 5 or 0 and those constants would be wired to the data in.

 

 

Message Edited by Dennis Knutson on 04-13-2009 09:13 PM
0 Kudos
Message 6 of 10
(3,241 Views)

I used DAQ assistants because that's how I was educated (very limited). I re-did the application with DAQmx single reads. The 6008 seems capable of outputting 5V, but I cannot tell which port is which based on the spec sheet. Also, would I similarly wire the DAQmx digital output to the timing structure like you showed above? I've read through forums and see you've helped a ton of people so thank you for your patience with someone relatively new to the system.

0 Kudos
Message 7 of 10
(3,210 Views)
I meant 5VDC from any of the Digital I/O.
0 Kudos
Message 8 of 10
(3,209 Views)
Nevermind about the pin locations. I found a better spec sheet online. The major issue that I am now having is that I cannot figure out how to actually wire the DAQmx output (I was hoping you could look at a program I have written). I have wired it, but wiring does not necessarily impy correctness. Also, how would I implement the time delay in there? I need there to be 5 VDC one second and moments later there to be 0. The other numbers chosen are arbitrary for the moment. Besides using the true/false logic for applying the correct voltage, could I use DAQmx Timing? Thanks again for any help you could offer. 
0 Kudos
Message 9 of 10
(3,203 Views)

First, you still haven't explained the purpose of the analog inputs? It appears that if sensor1 is less than .35 volts and if sensor2 is less than 2.5, you want to drive a digital output high. Is that correct? If so, do not wire a '5' to the DAQmx Write. That would try to write the pattern of '1001' to the output. You should wire a Boolean or a 1/0.You will also get an error from the analog inputs and the DAQmx Read. You simply cannot have two separate tasks for the same resource. You need to have a single task that reads both sensors.

 

If, after driving it high, you want to wait a second and then drive it low, just place the Time Delay after the first DAQmx Write, then place another DAQmx Write after the delay. Just like I showed with the two DAQ Assistants. The second DAQmx Write would have a constant of 0 wired as the input data.

 

There is no DAQmx timing available with the digital outputs. It is software timed only.

 

Try the code below.

0 Kudos
Message 10 of 10
(3,186 Views)