Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

sequential output to DAQ

Hello,
       i'm trying to send an array of numerical values to a USB 6008, to output through a analog channel.  Basically, I want to send the value 3, and then immediately, 0.  When I tried this, and ran the system, I got an error saying that I only have one channel, not two (i.e. the two element array made the program think I was trying to send 1 value to each of the channels).

Are they any simple solutions to this?

veritas
note:  I'm additionally trying to use a TRUE/FALSE structure, where when true, output 3,0.  when false, output 0,0, or nothing at all.


0 Kudos
Message 1 of 4
(3,247 Views)
Put your DAQmx Write inside a for loop and put the array outside the loop. When you wire the array through a for loop, it will auto-index the array.
0 Kudos
Message 2 of 4
(3,240 Views)
ok..that really helped!

However, I'm still a little stuck.  what i've bbeen trying to do is have a motor turn on and then immediately turn off, when a sensor is activated (note, I cannot use the digital outputs..have to use the analog in this case).  Basically, we can say that the sensor goes from 0 to 1, and I want to output a value of 3, and then immediately output 0.  The motor is in a larger while-loop, and thus when the sensor activated, the output of 3,0 is continuously generated, thus making the motor turn off and on again over and over.

I'm thinking there is probably a simple solution to this problem of "single-instance"  IF-then command?


Hope this is clear.
thank you.

0 Kudos
Message 3 of 4
(3,217 Views)

veritas,

Inside of your while loop you can perform multiple DAQmx writes to achieve your desired outcome.  If you want to control the amount of time between the motor turning on and off you can use a flat sequence structure with a wait timer to achieve this effect.  In the example below there is a 1 ms delay between writing a 3 to the motor and then a 0.



Message Edited by Signal Slinger on 03-31-2008 04:50 PM

Message Edited by Signal Slinger on 03-31-2008 04:51 PM
0 Kudos
Message 4 of 4
(3,181 Views)