Showing results for 
Search instead for 
Did you mean: 

fpga PWM Generation




I am new in labview. I would like to generate a pwm signal for dc motor control. I have a PCI 7833R board and I am using L293D chip for dc motor control. This chip has being tested by arduino uno rev3 with ATmega328. I would like to control the dc motor generating pwm signal with PCI 7833R board instead of arduino uno. I have compiled and used the exaple for Pwm out, simple - R series.lvproj but without success. Could you please tell me where I am wrong.


Best regards

Download All
0 Kudos
Message 1 of 7

Can you be more specific about what is not working?  Were you able to compile the FPGA code for the 7833R?  Have you connected the output from the 7833R to an oscilloscope and checked if you're getting any output (with the motor disconnected)?  Where is the rest of your code?

0 Kudos
Message 2 of 7

Dear tiho!


I suggest you to search in LV example finder for this exmaple: "PWM Out, Simple - R Series.lvproj"


I did some modifications to make it clear how to use FPGA  IO Nodes properly.

The first step is to create a new FPGA I/O node: For this right click on the target in your project and choose New >> FPGA IO 

After you specify your IOs, you can drag and drop them into the block diagram.


Please try out the attached code, and post the results.


If you not mind, I suggest some tutorials, so you can get more familiar with LV FPGA programing:


Here is how you can move the prebuild NI examples to an other target:


If you have any questions feel free to post them too.


Best regards,

0 Kudos
Message 3 of 7



Thank you for your reply. I have tested your application with my cd motor. It is generating pwm signal but when I checked the signal with oscilloscope I saw that the frequency is not a constant. Is it normal or the application do not work properly. I would like to generate pwm signal with a frequency around 600 Hz.



0 Kudos
Message 4 of 7

Hi tiho!


What do you mean on not constant frequency? Could you post some screenshots? 

What values did you used for the high and low time? If you need 600 Hz, you can change the loop timer to use ms or us counter units.


Best Regards

0 Kudos
Message 5 of 7

hello friends,


I am new to crio,


I have a crio 9014 and a DO module 9474,


I need to generate a PWM of 140 Hz and variable duty cycle between 5% to 95%...


how to proceed ..?


If someone has any example vi or reference please share..

0 Kudos
Message 6 of 7

Hi chintamani,


which modules of your LabVIEW IDE can you use? Just RealTime (with ScanEngine) or LV-FPGA too? Which LabVIEW version do you use?


There are several ways to generate a PWM signal with 140Hz!

- The easiest is to program the FPGA with exactly this frequency and high resolution PWM (as your module supports 1MHz sample rate)

- Using just RT you could set your DO in a timed while loop to achieve atleast a low resolution PWM signal at 140Hz using direct access of the DO in the ScanEngine.

- Using the ScanEngine you could set the whole module to output PWM signals. As far as I remember the ScanEngine doesn't offer 140Hz speed, you can choose between 100Hz and 200Hz (or similar values)…


For all these suggestions you will find example VIs either in the LabVIEW example finder or here in the forum (like in this thread!)…

Best regards,

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 7 of 7