Example Code

Using the PXIe-4339 in Hardware-Timed Single Point Mode

Code and Documents

Attachment

Overview

This code demonstrates how to perform Hardware-Timed Single Point acquisition for a control loop with the PXIe-4339.  It also addresses how to configure the special low pass filter that is activated in HWTSP mode for this device.

Description

The code configures a channel for strain, though the channel can also be configured for other bridge or voltage measurement types.  It then specifies a low pass filter cutoff frequency and configures the timing for the card.  It uses a while loop that executes with each tick of the hardware clock on the PXIe-4339 such that each loop execution begins after a single sample has been taken.  That sample is then processed with a PID algorithm or control matrix to generate any required outputs.  After the loop is exited, the program stops and clears the task before reporting any errors.

Steps to Implement or Execute Code

Because control loops typically require deterministic, reliable execution timing, it is recommended that this VI be used in the context of a Real-Time PXI target, though it will still execute if the controller is running a general purpose OS.  Add the VI to a LabVIEW project, select the physical channel of interest on the PXIe-4339, and run the code.

Requirements

Software

  • LabVIEW 2011 SP1 or later with NI-DAQmx 14.5 or later
  • If running in a Real-Time context, you will need the LabVIEW Real-Time Module 2011 SP1 or later

Hardware

  • NI PXIe-4339
David R
Systems Engineer
National Instruments

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

Contributors