02-01-2026 10:04 PM
Hello. I am currently using a PXI-6221 and writing a LabVIEW program to generate pulses on two output channels (ao0 and ao1). However, in the code I created, the output on ao0 (pulse amplitude) is lower than the value I set, and the pulse width and the time interval between pulses are also different from the values I specified. I would like to ask how I can solve these issues. Thank you.
code is in here
https://drive.google.com/drive/folders/1t-8ZX0k8Gic-YN2fWtdcfRRhfSbpGsyy?usp=sharing
02-01-2026 10:08 PM
Please attach the code directly as VIs or ZIP, no hosting sites for safety.
What is connected to the AO? have you calculated if the AO can drive the load sufficiently to attain the amplitude?
02-01-2026 10:23 PM
I have checked all the output amplitudes, and while ao1 outputs correctly when I input the same value, ao0 outputs a lower amplitude than that.
and to check the amplitude, I just connected ao nodes to oscilloscope.
02-01-2026 10:25 PM
please check this ppt that contains the problem
02-02-2026 03:37 PM
You are using a sequence structure out side of the While loop. It looks like you are counting on the timing of that sequence structure to set the pulse amplitude, but that's is not the correct way to do it. That violates the dataflow principle.
A better approach would be to use two loops, an outer For loop to setup the pulse amplitude and the inner loop to do pulsing and measurements. I don't understand what the time is for, but if it's a delay you could add it to the For loop.
Hope that helps.
Craig
02-02-2026 09:47 PM
Thank you for your solution.
But I have one more question about this.
Is it means that the sequence structure should be removed ?
And the output voltages outside the loop should be arrange constant? If so, I can't change the output voltages in the front panel
The delay I told you is pulse width and interval between pulses.
If I input the pulse width to 30ms and the interval to 30ms, the value output is often 20ms, 40ms or 10ms, 40ms etc...
So I can't determine the the value exactly.
02-04-2026 09:50 AM
>> Is it means that the sequence structure should be removed ?
Yes, the sequence structure is not needed because its not running the way you think. It is running in parrallel with the loop, so its changing the value of the pulse amplitude at random times compared to your while loop.
>> And the output voltages outside the loop should be arrange constant? If so, I can't change the output voltages in the front panel
You can replace the array constants with front panel controls to input your pulse details.
>> The delay I told you is pulse width and interval between pulses.
If I input the pulse width to 30ms and the interval to 30ms, the value output is often 20ms, 40ms or 10ms, 40ms etc...
So I can't determine the the value exactly.
Now this is a bigger problem. You can't rely on the time delay to give you accurate ms timing, Windows doesn't work like that. Can you get the hardware to do the pulsing? That would be the ideal way to do it.