Home
Quickstart Guide
Introduction RIO Academic RIO Application examples Your first RT app Your first FPGA app
Real-Time
Basic procedures System admin File system I/O monitor System controller architecture Timed loops Inter-process communication RT/Host communication RT/FPGA communication FPGA personalities Interrupts Datalogger (file I/O)
FPGA
Design flow Simulation Inter-process communication RT/host communication Derived clock domain IP blocks FPGA personality
Networking
Get connected Email Web services UDP TCP IP addresses
Site Map
Guides Code examples Procedures Tags LabVIEW block diagram elements Targets Communications All pages
Glossary How to use About
RIO Developer Essentials Guide for Academia
RT code example

Queued state machine

State machines perform system control, data processing, and any task that involves executing a sequence of activities in response to inputs from the surrounding physical system, the user interface, and other processes within the system. The queued state machine is a particular implementation style that is flexible and versatile, easy to maintain, and computationally efficient.

LabVIEW RT block diagram snippet: While-loop structure containing guard clause, "Command Parser" kernel subVI, and queue

Use cases

Features

See the complete Home Security System project to see a variety of QSMs that work independently in parallel and communicate with each other by passing messages to each other through queues.

Keep in mind

LabVIEW block diagram elements

Locate these elements with "Quick Drop" (press Ctrl+Space and start typing the name); click on an icon to see more sample code that uses that element:

Obtain Queue
Enqueue Element
Dequeue Element
Release Queue
Feedback Node
Error Ring

Example code

Expected results

https://youtu.be/SMxywBqq45I (2:54)

Developer walk-through

https://youtu.be/6Pn_WqtfNNU (12:38)

Outline

For more information

  1. Effective LabVIEW Programming (http://www.ntspress.com/publications/effective-labview-programming/)
    An excellent textbook by Dr. Thomas J. Bress covering all aspects of system design; Chapter 20 describes the "Queued State Machine with Arguments" in detail. Download all of the code examples from this textbook: follow the link above, select "User Resources", and then "All VIs".
  2. The LabVIEW Style Book (https://www.pearson.com/us/higher-education/program/Blume-Lab-VIEW-Style-Book-The/PGM219404.html)
    This comprehensive textbook by Peter A. Blume lays out everything you need to know about best practices for LabVIEW system design. Chapter 8 describes the "Queued State Machine" in detail.