Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Single cycle of Analog output

Solved!
Go to solution

Hi all,

 

I want to generate a single cycle (as shown in the waveform graph) of analog output using PCI-6711 and then stop/pause the program.  I added a condition in the while loop that when i equal the waveform length, the program will break the while loop.  However, it doesn't work.  Reading by an oscilloscope, I always find that the analog output contains more pulses than what I define (or what shows on the waveform graph).  Does anyone have any suggestions that I should try?  

 

Thank you!

 

 

Capture2.PNG

Capture.PNG

Download All
0 Kudos
Message 1 of 2
(208 Views)
Solution
Accepted by topic author tsechang

This is exactly what Finite Sampling (instead of Continuous) is for!

 

In the call to DAQmx Timing, choose Finite and *also* wire the adjacent "# samples per channel" input with the right # samples to represent one cycle of your waveform.  After you start the task, you can call DAQmx Read to request that same # of samples.  When it returns all your data to you, you'll know the task is done so stop it and then your software can react however you choose.

 

Have a look at the shipping examples for AI to see one of the ways to structure a Finite Sampling task.

 

 

-Kevin P

 

P.S.  Comparing your loop iterator to your # samples was never the right idea anyway.  The loop will iterate as fast as it can, subject to the time it takes to execute the code within it.  This has no particular relationship to the hardware sample rate you set up in your AI task.  It's pretty typical for sample rates to be at least an order of magnitude faster than software loop iteration rates.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW?

(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).



Message 2 of 2
(198 Views)