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
(3,481 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
(3,438 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
(3,428 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
(3,415 Views)