I am running a PID loop to control temperature in a box. The counter closes a solid state relay and thus powers my heater. I use a PCI 6221 card.
I keep getting the following error:
Error - 200301 occurred at DAQmx Write (Counter Frequency 1Chan 1Samp).vi:1 Possible reason(s): Measurements: Cannot update the Pulse Generation property. The pulse generation with previous property settings must complete a full cycle before the property can be updated.
The code consists of a loop running every 100 msec which adjusts the duty cycle via a property node and then performs a DaqmxWrite on the same channel to force the new property settings to take effect. I have used a Daqmx Clear Task at the end of the vi, but the error occurs randomly every now and then. The pulsing is at 10Hz.
I believe it might have something to do with my computer, since any time I open another program (Firefox for example, or Origin) while the program is running, it gives the error. I think maybe the computer cant handle all the tasks at once?
Any ideas what could be wrong here? I've attached my vi below... it could be the PCI card...
It looks like your VI is based on an example from the example finder (help => find examples => browse => Hardware in and output => DAQmx => control => General => PWM counter output.vi ). With the example from the example finder they are synchronizing the counter to the AI sample clock. The while loop is waiting until the next sample from the sample clock, so also your loop runs at the specified rate.
The PWM will only be updated (so counter task is hardware timed single point) when the value of the PWM signal needs to be changed. With continuous you need to write fats enough values to the counter.