Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Non-regenerative analog output using DAQmx with digital input control

Solved!
Go to solution

I want to perform a relatively straightforward task.  I have a TTL signal at ~8kHz that I want to use to control an analog output channel.  Specifically, each time the trigger arrives, I want to increment the AO voltage by a given amount (say, in increments of 0.01 V).  It is critical that the TTL signal is synchronized with the AO output.  I tried various methods but none have worked.  The latest idea I had was to use a counter task synchronized with the AO task.  The counter value is multipled by some increment value and added to an offset, which is then fed into the Write VI of the AO channel.  However, I get error -201025 (Non-buffered hardware-times operations are not supported …) when I run it.  The only thing I was able to do was remove the timing vi, but then the tasks are not properly synchronized.  My feeling is that I need to use the non-regenerative mode, create the entire waveform of a stepped, ramp function, and then read out parts of that waveform according to the counter value.  I've included screen shots of the code I wrote (the one that gave the buffered error and the one without error but no synchronization).  Note, I realize that using the TTL signal as the clock doesn't make much sense but I get errors if I use the onboard clock...  I'm relatively new to daqmx so I'm sure I'm missing something simple here.  Any suggestions would be greatly appreciated!

 

 
Download All
0 Kudos
Message 1 of 4
(2,478 Views)

Yeah, there is a *much* simpler way to do this.

 

- define an array of values that increment by 0.01 V each sample

- use the 8 kHz signal as an external sample clock for your AO task.

 

Below is a snippet of code that will ramp from 0 to 5 V, with a 0.01 V increment for each pulse of the external 8 kHz signal.

 

 

-Kevin P

 

ao ramp.png

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 4
(2,449 Views)
Solution
Accepted by topic author speclabAI

Thanks Kevin.  That certainly is a good way of doing it and works. I am a bit confused on what the external clock rate means in this context.  It seems like it shouldn't matter what rate I choose.  For instance, if my external clock source is an 8 kHz TTL signal, then putting 8000 for the rate doesn't produce a different output than say 1000.   

 

 

0 Kudos
Message 3 of 4
(2,445 Views)
Solution
Accepted by topic author speclabAI

I used to think it shouldn't matter as well, and used to have the habit of declaring the sample rate as 1, thinking of it as "1 sample per pulse".

 

But once I learned that DAQmx does buffer auto-sizing based on the sample rate, I realized that I should estimate more accurately or give a max expected rate.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 4 of 4
(2,435 Views)