Example Code

Chart Functionality for Digital Waveform Graph

Code and Documents

Attachment

Overview

This Polymorphic VI accepts either a single Boolean input or an array of Boolean inputs and returns a Digital Waveform that can be wired to a Digital Waveform Graph.  As a functional global variable, this VI can receive new data each loop iteration such that its output causes a Digital Waveform Graph to act as a chart.

Description

This example uses a functional global variable architecture to store samples in a buffer as they are queued using the Enqueue command.  Using this buffer, some simple array manipulation is implemented to return a digital waveform with a specified window size (maximum number of samples).  Sample rate may be optionally specified as well.

Steps to Implement or Execute Code

  1. Put Digital Waveform Chart Buffer (Poly).vi on to your block diagram.
  2. Wire in your Boolean data (array or single element**) inside a loop.  Include sample rate and window size if desired.
  3. Wire Digital waveform output to a Digital Waveform Graph.
  4. Use the Reset command to clear the data buffer and start with an empty output again.

For an example of using this VI, please open Digital Waveform Chart Implementation.vi.

**Please note: You cannot interchange loading single elements and arrays into a polymorphic instance.  You must choose one or the other (array or element) for each instance of Digital Waveform Chart Buffer (Poly).vi and stay with the same input type throughout run-time.

Requirements

Software

LabVIEW 2012 or later

Hardware

None

VI Snippet

Digital Waveform Chart Buffer.png

Regards,
Chris Elliott
x36772

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

Contributors