Hi, I am working on a project on myRIO FPGA in which I want to generate multiple PWM pulses with fixed duty cycle (50%). I want to generate 3 PWM pulses with variable frequency, the second PWM pulse is delayed by 60 degrees with respect to first pulse and the third PWM pulses is delayed by 120 degress with respect to first pulse. We can convert the phase shift to time by
delay in sec = (shift in degress /360 ) * time period of pulse.
I have succesfully created the 3 PWM at any constant frequency, I have to stop and re run the FPGA VI if I want to change the frequency of the PWM pulse. But I want to change the frequency continuously at run time let say by a potentiometer interfaced to analog input. I have attached a screenshot of the VI I am currently working on.
In the VI, loop 1 is used to generate a square wave with frequency corresponding to Analog input 0. Frequency (Hz) / 40000000 is used to calculate Frequency in periods/tick, as the square wave express VI uses the input frequency in periods/tick. Loop 2 is used to generate the 60 degrees delayed waveform with frequency equal to frequency (periods/tick) from loop 1. Frequency is passed from loop to loop by using local variables. And loop 3 is used to generate the 120 degrees delayed pulses.
The problem is that when I change the frequency at runtime the time delay in pulses is not according to the above mentioned formula.
I am looking forward for your help in this project.