Hello
Ive been struggling with this problem for a while. If someone could help me I would greatly appreciate it. The code is attached
Application: I need to drive two different loads with the same current that is out of phase with each other. Im working in AC regime and the loads will change impedance with frequency. So i need to set a constant current setpoint and based on the output the PID controller should try and change the amplitude of the AC signal
Problems: Im using the DAQ acquisition tools and have set it to read one sample from the output. But to generate the sine wave I use the signal generator function with a default sampling rate and 1000 samples. How do I get the device to read all 1000 samples find the peak and feed that information to the PID control so that it can tweak it. If I set the DAQ read to acquire N samples, it takes a long time to display on the chart. I would ideally like to see the waveform displayed on the chart. If I set the signal generator to generate one sample at a sample frequency of 1Hz I keep getting the same value as expected.
Please help.
Thanks
S