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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MyRio PWM Phase Shift

Hi,

Im trying to create two PWM waves with the myRio, both outputting 40 kHz and a 80% duty cycle. I know how to do this when neither of the waves are phase shifted but Im wondering if its possible to have a 60 degree phase shift between the two PWM waves?

 

Thanks,

Tyler

0 Kudos
Message 1 of 4
(2,820 Views)

Hi E.Greene,

 

using the FPGA in your myRIO you should be able to output about anything on DIO pins!

 

60° phase shift at 40kHz means a delay of 4.167µs between both waveforms. This translates to ~167 ticks of a (default) 40MHz loop, running on your FPGA…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,777 Views)

Do you have an example of this? Im new to LabView and am having some trouble figuring out how to set up a loop that will accomplish this.

 

Thanks you!

0 Kudos
Message 3 of 4
(2,767 Views)

Hi E.Greene,

 

on FPGA I use a simple counter to generate PWM output signals:

count++
out := (count >= duty)
IF count >= fullperiod THEN
  count := 0
ENDIF

All values (count, duty, fullperiod) are in ticks (or iteration time of the loop).

To have a second output with a given phase shift you just need to use the very same "count" with an offset. With my example calculation above that offset would be 167 for a loop running at 40MHz…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 4
(2,754 Views)