01-10-2017 05:06 AM
Hi all,
I'm developing an application where I would like to update the duty cycle of a Counter Output channel dynamically. This change of property should happen at 1kHz. I used the method given in Case 3 (Figure 3) of this link to achieve the same, it's successful in updating the duty cycle of the counter, however, the while loop with the DAQmx write sub VI takes almost 15-16ms to run. Hence, I am assuming that the update takes 15-16ms, which is slow and almost 60-70Hz.
Can you guys suggest a faster way to do this? Any help would be appreciated.
Solved! Go to Solution.
01-10-2017 07:07 AM
Why don't you post your code so we can see exactly what you are trying to do? You might also tell us what hardware you are using.
Bob Schor
01-10-2017 08:36 PM - edited 01-10-2017 08:39 PM
Hi Bob,
Thanks for your reply. I have attached my code here. As you'll see, I'm trying to generate a PWM signal (CO pulse train). There are four triggers, for four types of scenarios. My current problem is with the Dynamic PWM generation, wherein I realized that I can't update the PWM parameters in a time lesser than 15-16ms. I want to fix this and I am also curious to find out why the DAQmx write loop is taking so long to update it's parameters.
The device I am using is a NI USB-6289 DAQ.
Cheers.
01-11-2017 05:16 AM
Hi Bob,
It took me a day, but I finally solved it. There were a lot of things done in a poor way in that previous code, and I spent a lot of time to figure out a better way to update and send the pwm duty cycle values at a fast enough speed.
Also, an error in my judgement, I can't update the frequency of the PWM at 1kHz since my PWM frequency is only 400Hz. My bad. I can do it 400Hz precisely, using local variables, property nodes, write functions and some basic functions like 'is done' and 'wait time' in the loop.
I shall mark this post as solved, but in case anyone comes across a similar problem, please feel free to ask for detailed help.