Example Code

FPGA-Based quadrature encoder simulation

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW FPGA Module
  • LabVIEW

Code and Documents

Attachment

Description

Overview

This example demonstrates how to simulate a quadrature encoder with LabVIEW FPGA.

 

Description

This VI Simulates the output of a 512 pulses / rev quadrature encoder with 40 MHz FPGA Top Level Clock.

To simulate encoder with different pulses per revolution change the "encoder constant" (see Block Diagram) that is calculated by:

Encoder Constant.PNG


Requirements

 Software

  • LabVIEW Full or Professional Development System 2012 (or compatible)
  • LabVIEW FPGA Module 2012 (or compatible)

 Hardware

  • FPGA target (e.g. cRIO 9118 or compatible)

 

Steps to Implement or Execute Code

  1. Download and open the attached file "Simulate Quadrature Encoder LV2012 NIVerified.vi"
  2. Follow the instructions in Front Panel and Block Diagram and run the program

 

Additional Information or References

Simulate Quadrature Encoder LV2012 NIVerified.vi - Front Panel.png

 

 Simulate Quadrature Encoder LV2012 NIVerified.vi - Block Diagram.png

 

Note: Find more detailed information about Sine Wave Generator in LabVIEW help or here.

Starting with LabVIEW FPGA 2013 you can also use the Desktop Execution Node to simulate this VI.

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**

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

Comments
Yane
Member
Member
on

I am interested in viewing the "Simulate Encoder.vi" that you have attached, as I am doing something similar for a school assignment.

But everytime I try to open the vi in labview version 2010. It keeps on asking to find another vi called "nirviSimLinearInterp.vi".

Is this a vi that comes normally within the labview library, or is it another file that needs to be created or downloaded.

Any help will be much appreciated.

thank you

Yane