12-30-2021 03:35 AM
Hi, I'm trying to generate a 3V 1.25kHz analog arbitrary waveform using PXIe-6738 analog output port and reading data from a CSV file. But the frequency obtained is only 800-900Hz.
Using Digital output port, i can set the Rate in MAX to 10Khz and obtain the frequency of 1.25V but the amplitude is 5V.
Other than using a clamping diode on the digital output or buy another PXIe card with output level control function, what other ways can i generate the signal that i want?
12-30-2021 05:11 AM
The main immediate problem is that you're trying to deliver data to your task 1 sample at a time. Based on the scope pic, it also appears that the timing between "pulses" can vary, suggesting that the task (which is defined outside the code in MAX and is thus unavailable for inspection) may not be configured to use a hardware sample clock.
A first step would be to make sure you configure the task for a 1.25 kHz sample clock. After that, simply write the entire file contents to the task all at once, and *then* start the task.
Additionally, you're setting yourself up for trouble with your habit of using local variables unnecessarily. LabVIEW execution is based on dataflow. Best practices for dataflow programming are different than for sequential scripts and text languages. A lot of good LabVIEW code will use no local variables at all -- it's the wires themselves that define the flow of data and their connections help define and enforce the sequence of execution. Local variables typically create ambiguity and race conditions, leading to sometimes-subtle bugs and inconsistent behavior.
-Kevin P