LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate and acquire square wave signal

I tired to generated a square wave signal and acquire them in the same time. I use cDAQ 9263 and 9209 modules and turn out the acquired signal is kind of distorted. I belive it is my code issuse siince I use NI MAX test panel the acquired waveform is good. Any helps are appreciated.

Download All
0 Kudos
Message 1 of 4
(864 Views)

Only a tiny fraction of the forum users are using LV2021, please attach the code in LV2019 format for better accessibility.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 4
(857 Views)
0 Kudos
Message 3 of 4
(850 Views)

Hi Lev,

 


@Lev1athan wrote:

turn out the acquired signal is kind of distorted. I belive it is my code issuse siince I use NI MAX test panel the acquired waveform is good.


Well, the assumption is correct 🙂

Did you notice that coercion dot at DAQmxWrite? It has a meaning!

 

You create a waveform, but DAQmxWrite is set to expect a 1D array of samples. Additionally you don't set any sample rate for your AO channel!

Solution: Either set a samplerate - or switch to "Waveform" mode of DAQmxWrite. Then set to use "Waveform timing information"…

 

You also should write the AO data before you start the AO task (as is shown in the DAQmx example VIs). You may use the "autostart" input of DAQmxWrite for this purpose…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(809 Views)