RT Target Does Not Read Text File on First Run

Updated Aug 20, 2021

Reported In

Hardware

  • cRIO-9049

Software

  • NI Linux RT System Image
  • LabVIEW Real-Time Module

Operating System

  • VxWorks
  • LabVIEW Real-Time (NI Linux Real-Time)

Issue Details

I transferred a simple text file to my real-time target, and I need to read it programmatically when I run my real-time VI. If I run the real-time program from the LabVIEW development environment, the file contents are read and displayed correctly in my Front Panel. Nevertheless, when I run the program as a deployed application under my RT target, the file is never read during the first program execution, it's only read after subsequent executions.

How do I solve this issue?

Solution

If your file is not read during the first run of the application, and it's only read correctly in subsequent executions, it's possible that you are reading the file outside your RT main loop, and that this is behavior related to a known issue that occurs both on NI Linux RT and VxWorks targets.

The current workaround to this known issue is to put the Read from text.vi within a While loop
and give the program a set of number of iterations to attempt to read the file successfully.

An example of this approach is shown in the LabVIEW snippet below. Adjust the range of iterations as necessary until your file is read in your RT application's first run.


ReadFileWorkAroundRT.png


To use this LabVIEW snippet, simply download the above image, and drag and drop it into your LabVIEW Block Diagram.