Example Code

myRIO: 8-16 Chs Custom FPGA PWM Project

Code and Documents

Attachment

Overview

This is a sample project that shows how to customize and use myRIO’s FPGA to drive 8 or 16 PWM channel using onboard Digital I/O. Anyone can customize this example in order to have more PWM lines on a single myRIO device or to change how those lines are distributed on the myRIO connectors A,B and C.

Description

The project is made by a set of VIs and subVIs:

  • 2 Custom FPGA VIs (one for 8 channel PWMs and one for 16 channel PWMs);
  • 2 RT Main VIs (one for 8 channel PWMs and one for 16 channel PWMs);
  • 5 RT subVIs
  • 1 custom typedef .ctl


Steps to Implement or Execute Code

  1. Open the 'myRIO 8-16 PWMs Example.lvproj' LabVIEW Project
  2. Examine the FPGA and RT VIs
  3. Choose among the 8 Chs. and 16 Chs. VI to run
  4. Customize the VI in order to change the number of PWM signals wanted or to change the myRIO DIO channels used for PWM generation
  5. Deploy and run

See documentation inside for more details.

For feedbacks or requests write to luca.gallo@ni.com

Requirements

Software

LV 2013

myRIO Module

Hardware

myRIO device (FPGA VIs are already compiled for myRIO-1900 but can be compiled again for myRIO-1950)


Luca Gallo
Sales Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
xiaodan13
Member
Member
on

Good stuff. But the PWM signals are synchronized, with different phase. How to generate synchronized PWM signals with MyRIO? How many maximum number of PWMs (2k-20kHz) can be generated with MyRIO?

shucen
Member
Member
on

same question, phase difference between two channels are always changing after every activation. I've put two activation subVIs into the same while loop with different channel controls. I assume that there should be some kind of synchronization register onboard. Have you found any solutions yet?

rifi76
Member
Member
on

excellent

prajeshv
Member
Member
on

Can you please give a .zip or a regular file?? I'm not allowed to download a .rar extractor??

thanks

Luca_Gallo
NI Employee (retired)
on

You can find the zip file now. You're welcome. Bye

Luca Gallo
Sales Engineer
and_seb
Member
Member
on

Hey I've managed to implement your system with 24 pwm outputs, by using ports A0-A7 and ports B0-15. However currently I was was hoping to make use of the I2C connection pins on both ports A & B for external sensors. Therefore I was wondering if it would be possible to use only 12 pins on B, leaving 2 DIO pins and the two I2C pins free, and compensate for the lost PWM pins by making use of 4 DIO more pins on the A or C port.

Thus overall it would be, outputting PWM:

A0-11

B0-11    

OR

A0-7

B0-11

C11-15

 

Thanks in advance!

thomas.quinn93
Member
Member
on

Could somebody explain how to used the remaining Digital Out and Analogue in ports while using this please?

DoveAgent
Member
Member
on

excellent ! thanks

zyw2833869
Member
Member
on

 

Dear Luca
           
I am a student user of myRIO 2017, I've been trying to implement your example project 
myRIO: 8-16 Chs Custom FPGA PWM
 posted on the NI website.  I tried to following the steps in your instruction document but run into problems at Step 3 "Choose among the 8 Chs and 16 Chs VI to run".  I cannot run the vi, in particular, I encountered two problems. 
 
problem 1

There is always an error when I run the "8 Chs PWM - RT Main.vi".  A screenshot of the error image is as follows.  I wonder if I need to do some changes to the main VI.

Inline image 1
 
problem 2
I also tried to only compile the “myRIO 8 Chs.PWM - FPGA.vi” to myRIO.  But the compiling always get stuck around 95%.
 
I hope you can offer some advice.
 
Sincerely,
 
Yiwen Zhao
ECE
New Jersey Institute of Technology
DeepikaH
Member
Member
on

I am doing project on speed control of 1HP dc motor using myrio. For this purpose I am using boost converter.l have to give pulse to converter using myrio. As I am new to labview can anyone help me how to generate pulse in real time

Contributors