Example Code

R-Series Calculate Signal Phase

Code and Documents

Attachment

Overview

This VI takes an signal from an analog input channel on an R-Series card, takes the FFT of that signal, and calculates the phase from the FFT. It then outputs the phase on one of the analog output channels.

Description

The VI is configured to run at 1MHz, although that rate may decrease for R-Series cards with lower maximum sampling rates. The VI reads in the raw data from the R-Series card as a 16-bit signed integer and applies the appripriate conversion logic to convert the integer data into a usable decimal value (note: the conversion implmeneted in this VI is specific for a PCIe-7852R; the conversion logic may change for other R-Series cards based on the input resolution and analog voltage range for a give card).

The decimal value is the input into the FFT Express VI. Once the output of the FFT is valid, the phase is calculated by arctan(Im/Re). That value is then fed through the reverse of the conversion process and output from the card on an analog output channel.

R-Series Calculate Signal Phase Snippet.png

Steps to Implement or Execute Code

  1. Download the appropriate verion of the VI.
  2. Configure a LabVIEW FPGA project with the R-Series card of your choosing.
  3. Add the VI to the project; don't forget to modify the conversion logic if necessary.
  4. Run the VI; you can set the FPGA target to execute on the "Dev Computer with Simulated I/O" or you can compile the code and run it on an actual card.

Requirements

Software

LabVIEW 2013, 2012, 2011, 2010

LabVIEW FPGA Module

NI-RIO

Hardware

R-Series Card (optional)


Ryan K.
Product Manager, ATCA and BEEcube
National Instruments

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

Contributors