LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog output: Waveform time period is not correct when tested with oscilloscope

Solved!
Go to solution

Hello everyone!

I want to make a waveform generator that reads some column in Excel and generates an analog output signal using a scaled version of the data from that Excel column.

The data is read from Excel and the waveform is built and scaled in LabView. Thus far, no problem. When I run the VI and probe the thick red/brown wire, the "dt" is also set correctly. But when I check the analog output signal on an oscilloscope, the total time of the signal is not equal to the given dt * number of datapoints. Therefore, the total output time of the signal is not what I wanted/expected.

 

In included a screenshot of the part of my code where the created waveform has to be outputted in a correct way.

 

Can someone please help me? Thank you very much in advance!

CornéVellekoop_1-1618731456035.png

 

0 Kudos
Message 1 of 5
(996 Views)

In your code you stop the generation task immediately after starting it.

 

If this is a finite generation task, a simple fix is to insert "DAQmx Wait Until Done" between the start and the stop.  If it's continuous, you'll need to wait some other way, perhaps a loop.  Have a look at the shipping examples

 

 

-Kevin P

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 5
(942 Views)

Indeed, it almost looks like you're running the task once and then a fraction of a second time. How does what you measure on the scope compare with what you are expecting? Is the duration shorter? Longer? My guess is longer because that DAQmx write should start and stop itself, and then it gets started and stopped again after.

0 Kudos
Message 3 of 5
(916 Views)
Solution
Accepted by topic author CornéVellekoop

MrMattPayne made a good point -- it appears you have auto-start set to True during your call to DAQmx Write.  I didn't notice because your True boolean wire doesn't enter the icon where its terminal is located.  Set that to False instead, and come up with a way to put some time delay between the explicit call to DAQmx Start and the one to DAQmx Stop.

 

But that's not all.  You *also* need to make a call to DAQmx Timing to configure a sample clock and buffer *before* making the call to DAQmx Write.

 

Have a look at the shipping examples for both finite and continuous voltage acquisition, which will show you a good place to start.  (You may not need the stuff related to triggering and TDMS logging, so feel free to remove those parts when you save a copy of the example in one of your own working folders.)

 

 

-Kevin P

 

 

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).
0 Kudos
Message 4 of 5
(891 Views)

Thank you all for the responses. It helped me a lot and the software works as expected now!

0 Kudos
Message 5 of 5
(859 Views)