Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Analog write on USB 6009

Hi all,


I am not an expert at Labview and DAQ but learning with time. I am writing a program to trigger a stimulator with the USB 6009 DAQ. We first acquire the max Torque of 3 trails (MVIC). Then the subject it asked to reach the max MVIC by giving a visual feedaback. When the subject reached maximum torque and then drops by 1% of the maximum value then we trigger the stimulator to provide additional torque. The trigger is sent by writing a 5V signal on the analog ouput channel of USB 6009. That is connected to the trigger channel of the stimulator.


The issue is that the electric stimulus is felt with a delay of 1sec which is very high for our application.


I am using the DAQAssistant.


Does anyone have suggestions for making this faster. Is the USB 6009 an issue. Is the analog write speed slower for USB 6009? I have attached my program.




0 Kudos
Message 1 of 6
I would suggest you drop the DAQ Assistants and use the lower level DAQmx functions instead. You can right click an select 'Generate DAQmx Code'. When that is done move all of the initialization/close functions (DAQmx Create Channel, DAQmx Start Task, DAQmx Stop Task, etc.) outside the loop so that your are not done with each iteration of the loop. All that you want inside the loop is a DAQmx Write and a DAQmx Read.
0 Kudos
Message 2 of 6
Thanks. I haven't gotten to it yet. Will do so this week or early next week. I will let u know how it goes. Thanks for the suggestion.
0 Kudos
Message 3 of 6



My code is still running slow and I don't know if its because of the DAQ. Also I read somewhere that using the A:D board's counter to trigger a pulse sequence in LabVIEW could be faster. However, I do not understand what they mean. I have never used counters before and so if someone can explain to me how to proceed with using a counter to trigger a pulse sequence it would be great!


Inorder to trigger the stimulator I ahve to send a TTL pulse.



0 Kudos
Message 4 of 6

You don't have a counter output for pulse generation. Read the specs and the manual. The max update rate for analog out is 150S/s. For 0-5V signals, you could try a digital output but that is software timed as well and may not make any difference


Looking closer at you code. I don't quite understand some things. You set the analog out to be 0 (the Simulate Signal is not at all necessary) and if the trigger condition is detected, you write out +5V. It then never returns to 0.



0 Kudos
Message 5 of 6

Hi Dennis,


Thanks. Yes I know that the USB I have doesn't have the counter. I could borrow a DAQ card with counter from another lab for testing purposes. If it worked then we thought we could purchase one for our lab. But u say that it might not make a difference.


Yes I don't turn it to 0.I reset it only when I run the prog. I need the program to trigger only once when it reaches a particular value below the peak- is this bad programming?


Also I did try the DAQmx code for write and it seemed a bit faster but it still has a delay. I can post that code tomorrow when I get to work. I was having trouble with the DAQmx code for the input though.


Any way I can give the stimulus without a delay? I am willing to try different options.


Thanks for taking the time. 

0 Kudos
Message 6 of 6