Example Code

Console Output on Front Panel to Update User

Code and Documents

Attachment

Download All

Overview
This example VI uses the FGV architecture to append individual lines of text.


Description

Common applications like Command Prompt, Linux Terminal, and Installers provide a Console Output to continuously update the user with the status of the application.  This can normally be done in LabVIEW using a String Indicator.  However, in larger applications, multi-loop architectures are used for simultaneous functionality.  To preserve the data being sent from various loops and avoid over-writing through race conditions, a single Functional Global Variable(FGV) is used.

This example uses the FGV architecture to append individual lines of text into a shift register which can eventually output a live dump of text onto a String Indicator screen.  The attached LabVIEW project demonstrates how the FGV "Queue Console (SubVI)" VI can be used in a multi-loop architecture.  The architecture all takes the individual lines of text and stores into a Queue System.  This allows data to be added from any location and from any VI on the same PC, as long as it has a reference to the same Queue, or have been given the same Queue name.

The main VI in the project is the standard Template for Producer/Consumer with Events found in LabVIEW.  Only a third loop has been added and the Queue Console SubVI to demonstrate how to append text and how to display it to the user.


Requirements

  • LabVIEW 2012(or compatible)


Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer
  2. Open the project of "Console 2012 NIVerified.lvproj"
  3. Open the VI "Console Example MainVI Producer Consumer Events.vi"
  4. Run the program
  5. Input any text in 'Enter any text' textbox.
  6. Click the 'Enqueue Element' button.

 

Additional Information or References
VI Block Diagram of "Console Example MainVI Producer Consumer Events.vi"

 Block Diagram.PNG

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

George T.
Senior Applications Engineer
National Instruments UK and Ireland

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