LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating PWM From NI 9403 Using LabView FGPA

Hi, 

 

I have been working to try to generate a PWM wave using the Digital I/O card NI 9403 with no success. Does anyone have any ideas as to how to do this? 

 

Thanks!!! 

0 Kudos
Message 1 of 8
(4,774 Views)

Hi bets,

 

guru19 and mak9 had very similar problems, just read their threads here or here!

Best regards,
GerdW


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

Thank you! 

 

In regards to writing to the digital I/O, how would I write the value HIGH and LOW? Do I use a I/O Method node or just the I/O node? (This is in regards to FPGA with the cRio, not using the DAQx)

0 Kudos
Message 3 of 8
(4,733 Views)

Hi bets,

 

you should always mention your target in the first place!

 

On FPGA you would use IO nodes…

Best regards,
GerdW


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

Is there any way constantly be reading the value that the NI 9403 is outputting in order to see if the wave is turning off and on at the right points? For example, is there a way to read the value to make to sure that at a 50% duty cycle, the wave is off for 1/2 of the time and on for 1/2 the time?

 

 

I know that I can run it to the target hardware and check using an oscilloscope however I am using a sensitive motor controller and do not want to fry it. I have attached my code for reference. 

0 Kudos
Message 5 of 8
(4,721 Views)

Hi bets,

 

don't you rely on your FPGA to handle things correctly (and in time)?

 

I would attach a scope before the motor is connected to check the PWM function! No need to read back any values from the FPGA. (Ofcourse you can create indicators to hold your current LOW/HIGH tick counts - just to make sure the FPGA correctly does the math before your sequence structure…)

Best regards,
GerdW


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

Hi, 

 

Yes I did just that, I am getting this result from my O-scope with a 50% duty cycle. For some reason, it is not holding at 5v. Also, when the value is supposed to drop down to 0V, it spikes down to -5V. 

0 Kudos
Message 7 of 8
(4,710 Views)

Hi bets,

 

the 50% duty seems to be quite accurate… 🙂

 

The waveform looks like some capacitors are involved in your measurement. Did you check the cabling?

Best regards,
GerdW


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