Example Code

Set cRIO Programming Mode With a Python Script

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.

    Operating System

  • NI Linux Real-Time

    Programming Language

  • Python

Code and Documents

Attachment

Download All

Description

This example shows how to use the NI System Configuration Python API (nisyscfg) package to read or set the programming mode of modules in a cRIO device with the NI Linux Real-Time OS. This can be useful if LabVIEW is not the main programming language being used in an automated test scenario.

scripts_result.png

How to Use

  • Running nisyscfg requires the NI System Configuration software to be installed in the cRIO. Refer to Adding or Removing Software on Linux RT Targets for information on how to add/remove software. 
  • The nisyscfg package supports CPython 3.5+ and PyPy3.
  • To install the nisyscfg package you can install python-pip first from the cRIO command line and then use it to install nisyscfg:
    1. opkg install python-pip

    2. python -m pip install nisyscfg

    3. If the previous line errors out, you can try using "sudo easy_install pip==9.0.3" instead.

  • The attached files are named get/set property, as not only the Programming Mode can be changed with this method. The API files, like properties.py, shows other available properties.

Additional Information

You could also leverage a similar script and execute it remotely using SystemLink salt states. If included in a SystemLink custom salt state, the state can be defined as:

mycommand:
  cmd.run:
  - name: python <script_location>
  - runas: admin

Related Links

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

Contributors