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

Code and Documents

Attachment

Description

This example shows you how to work with a Real-Time (RT) target, where the target has an IP address that changes periodically, but you need to keep networking as is (cannot set IP to static). Since the IP address of the device changes periodically, you will need to change the IP address of the target within your project using the RT target Properties dialog box.


The example covers how you can change the IP Address Property of your RT target programmatically.

How to Use

You 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.

Contributors