08-28-2022 08:32 PM - edited 08-28-2022 08:33 PM
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.
08-28-2022 08:38 PM
Only a tiny fraction of the forum users are using LV2021, please attach the code in LV2019 format for better accessibility.
08-28-2022 09:07 PM
Here is the 2019 version
08-29-2022 12:59 AM
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…