From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating 180 degree conduction pulses with variable frequency in myRIO FPGA. (Inaccurate time delays).

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.

 

0 Kudos
Message 1 of 3
(5,095 Views)

Hi moizW,

 

When you do change the frequency at run time, what are the time delays? What are you expecting them to be? 

 

I found a note in the Help documentation for the Square Wave Generator Documentation. It might hint at something:

SquareWaveGen.JPG

 

Perhaps try converting the Express VI to a standard subVI (right click the ExpressVI icon -> Open Front Panel).

 

Regards

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
0 Kudos
Message 2 of 3
(4,981 Views)

Thanks Andrew for your reply. But I have done my project and the delays are accurate with respect to their frequency.

0 Kudos
Message 3 of 3
(4,957 Views)