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.
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.
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.
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.
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.