LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating PWM Output NI 9403 Using LabView FPGA

Hello,

 

I am trying to output a PWM wave from the NI 9403 using FPGA to control a motor. I have attached the FPGA file below however I am still not getting any motor movement. I need to generate a wave between 3.0ms and 100 ms so I set the period to a fixed value of 50ms in the host vi. Does anyone know what my problem may be or how to generate this wave using LabView FPGA on a cRio using the NI 9403?

 

Thanks

Download All
0 Kudos
Message 1 of 7
(4,278 Views)

Hi bets,

 

THINK DATAFLOW!

Right now your FPGA will never recognize a change in "duty cycle" due to DATAFLOW!

 

Hint: You can check the PWM output with an oszilloscope.

 

I would do the math in the RT host, it's easier to calculate wait times here…

Best regards,
GerdW


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

Hi GerdW,

 

Thank you for your response. I am still new to LabView so I don't quite understand what you mean by DataFlow... I changed around the output i/o nodes as well. I don't know if this was effective or detrimental either

0 Kudos
Message 3 of 7
(4,257 Views)

I also attached an oscilliscope to measure my results! 🙂 So far only a bunch of noise but I at least can get some accurate measurements. Thanks for the tip!

0 Kudos
Message 4 of 7
(4,254 Views)

Gerd's point was that your code on the host will not have any effect on the pulse generated because the controls are outside the while loop on the FPGA.

 

Consider the following: what happens to the results during execution of this VI if you change Outside Loop and Inside Loop?

 

dataflow.png

---
CLA
0 Kudos
Message 5 of 7
(4,238 Views)

Ahhh, yes that makes more sense. Does this mean that you cannot pass the output data from the calculation into the sequnce structure to control the timing as well?

0 Kudos
Message 6 of 7
(4,224 Views)
If it's outside the loop and wired in, the loop will use the value on first iteration and won't see any new values.
---
CLA
0 Kudos
Message 7 of 7
(4,199 Views)