Example Code

Programmatically Change IP Address of Real-Time Target in LabVIEW Project

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 Controller

    Software

  • LabVIEW

Code and Documents

Attachment

Description

This example covers a scenario where you have a project with a Real-Time (RT) target, and the target has an IP address that changes periodically, but you need to keep networking as is (cannot set IP to static). The example explains how you can change the IP Address Property of your RT Target programmatically.

How to Use

We can access this property by editing the LabVIEW project's XML file. To change an XML tag, we can use the Set XML Tag method. The tag that we need to call out for IP address is alias.value.

See the attached project for an example of how to use the Set XML Tag method in this manner.

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