From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Real Time External USB Drive Error Checker Using RealTime for LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • CompactRIO|SingleBoardRIO

    Software

  • LabVIEW Real-Time Module
  • LabVIEW

    Driver

  • NI RIO

Code and Documents

Attachment

Download All

Overview

When creating a headless data logger, it can be preferable to have swappable data storage devices, leading to the use of an external USB Hard Drive etc. It is also preferable to be able to check the state of this drive especially when connecting new drives in a headles environment.    

 

Description

This VI uses some of the advanced file functions to very simple effect - by pointing it at the USB port of the Real Time Controller, they will report Error 7 if the USB Storage is not available (this could lead to further custom error handling if needed).

 

As a visual cue, for a headless system, this then causes the RT LED to flash a warning to the user (that can be customised per error)

 

Requirements

Software

LabVIEW 2013 (or compatible), LabVIEW Real-TIme Module

Hardware

NI cRIO 9025 in this case but any NI RTOS Target is fair game

  

Steps to Implement or Execute Code

  1. Create Real Time project
  2. Add the the VI under the RT Target
  3. Disable/Delete any of the error handlers you don't want
  4. Press Run!!

Additional Information or Reference

1-372 BD.jpg

 

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

 

Liam A.
National Instruments
Applications Engineer

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