Connect an Ethernet RIO Expansion Chassis to a Secondary Ethernet Port on a Real-Time Controller

Updated Dec 19, 2023

Environment

Hardware

  • CompactRIO Chassis
  • CompactRIO Controller

Software

  • LabVIEW
  • LabVIEW Real-Time Module

The Ethernet RIO expansion chassis is intended to be connected to a switch, router, or existing Ethernet network; however, you can connect it to the secondary port of a real-time controller. When using real-time controllers with two Ethernet ports, Ethernet port 1 is used for communication between the real-time controller and the host PC. This includes communicating with the controller via NI LabVIEW system design software and Measurement & Automation Explorer (MAX). Ethernet port 2 is used to communicate with a private network, which is not visible to the host PC. In this tutorial, learn how to communicate with an Ethernet RIO expansion chassis when you connect it to the secondary port of a dual Ethernet port LabVIEW real-time controller.

Note that connecting an Ethernet RIO expansion chassis to the secondary Ethernet port of a real-time controller is not the intended use case for the Ethernet RIO expansion chassis as a connection to the primary Ethernet port can be achieved by using a network switch. If you wish to use this configuration, you should consider using the NI EtherCAT RIO slave chassis. See more information on EtherCAT RIO.

This example uses NI cRIO-9074 for the dual-port LabVIEW real-time controller; however, you can use this process for any dual-port LabVIEW real-time controller. The NI 9149 was used for the Ethernet RIO expansion chassis, but the process is the same for all Ethernet RIO expansion chassis.
 

Requirements

  1.   Any dual Ethernet port LabVIEW Real-Time controller
  2.   LabVIEW 2014 or later1
  3.   LabVIEW 2014 Real-Time Module or later (only required for the real-time controller)
  4.   LabVIEW 2014 FPGA Module or later2
  5.   NI-RIO 14.0 or later1
  6.   Ethernet crossover cable

Note: Software should be installed in the order listed.
 

  1. LabVIEW 2014 and NI-RIO 14.0 are the minimum software versions that you can use with the NI 9149 Ethernet RIO. If you’re using a different Ethernet RIO expansion chassis, you will need to consult your documentation for the minimum software requirements.
  2. The LabVIEW FPGA Module is necessary only if you plan to write your own FPGA program for the FPGA target on the Ethernet RIO expansion chassis. It is possible to use the Scan Mode Interface without the FPGA module.

Configure the Ethernet RIO Expansion Chassis and Deploy the Application

First you need to configure both targets, the NI 9149 and cRIO-9074 (one at a time), and the host PC with a static IP. Once communication has been established, you deploy a VI and a Shared Variable Library to the NI 9149.

  1. Figure 1 shows the final configuration of the host PC, real-time controller, and NI 9149. Notice that the host PC and port 1 of the real-time controller are on the same subnet while port 2 and the Ethernet RIO expansion chassis are on the same subnet (yet different from port 1 and the host PC).

Figure 1. Final Configuration
 
  1. Connect the NI 9149 to a DHCP switch, router, or your enterprise network via a generic Ethernet cable. Open MAX on your host PC. The NI 9149 should be visible in MAX under Remote Systems. If a remote system target does not appear in MAX, hold down the reset button until the status light turns on to boot the target into safe mode. Hold down the reset button again until the status light turns on to reset the IP address on the target. Finally, briefly press the reset button to reboot the target and select Refresh in MAX.
  2. Select the NI 9149 under Remote Systems. Ensure that Static is selected under the Network Settings tab. Once you have set the static IP, click Save and reboot the controller. Refer to Figure 2.

Figure 2. NI 9148 With Static IP (192.168.0.2)
 
  1. Set your host PC to a static IP. If you are using Windows 7, navigate to Control Panel » Network and Sharing Center » Change Adapter Settings. Set the PC to a static IP address. This example uses 192.168.0.1.
  2. Open LabVIEW and create a new project. In the project, add the NI 9149 (Figure 3) and create a new VI (Test VI.vi) under My Computer to begin acquiring data as seen in Figure 4. You must deploy the NI 9149 before connecting it to the secondary port of the real-time controller. Deploy the NI 9149 from the project by right-clicking the NI 9149 and selecting Deploy All. If you do not deploy the NI 9149 before connecting to the secondary port, the host PC will not recognize the NI 9149.

Figure 3. LabVIEW Project With NI 9149 and NI 9211
 

Figure 4. Block Diagram and Front Panel of Data Acquisition


Configure the Real-Time Controller With the Ethernet RIO Expansion Chassis

  1. Select the NI 9149 under Remote Systems in MAX. Under the Network Settings tab, change the IP address from the current IP address (192.168.0.2) to a new IP address on a different subnet. This example changes the NI 9149 IP address to 10.0.18.3. By doing this, the host PC will no longer be able to see the NI 9149.
  2. After setting the new IP address of the NI 9149, you need to configure the real-time controller. Connect the cRIO-9074 directly to the host PC via a generic Ethernet cable or an Ethernet crossover cable. Check under Remote Systems in MAX for the cRIO-9074. If a remote system target does not appear in MAX, enable the IP RESET DIP switch on the controller, reboot the controller, and then disable the IP RESET DIP switch.
  3. Select the cRIO-9074 under Remote Systems. Ensure that Static is selected for Ethernet Adapter eth0 (Primary) under the Network Settings tab. The Primary Ethernet Adapter refers to the primary Network Interface Controller (NIC) on the cRIO-9074. Set the primary NIC to a static IP (192.168.0.2) as seen in Figure 5.
  4. Set the secondary NIC of cRIO-9074 to a static IP address. To change the IP address of the secondary NIC on the cRIO-9074, go to the Network Settings tab in MAX (also seen in Figure 5). This example uses 10.0.18.1 for the IP address of the secondary NIC.

Figure 5. Configure Secondary NIC
 
  1. Connect the NI 9149 via a crossover cable to the secondary NIC on cRIO-9074.
  2. In the project explorer, drag the VI you created in earlier (Test VI.vi) from My Computer to underneath the cRIO-9074 target as illustrated in Figure 6. You will need to update the IP address of the NI 9149 in the LabVIEW project to the new IP address you gave it. Do this by right-clicking the NI 9149 in the project and selecting to Properties. In the configuration window, you can change the IP address under General » IP Address/DNS name.

Figure 6. Project With cRIO-9074
 
  1. When you run Test VI.vi under its new target—the cRIO-9074—you will receive the error shown in Figure 7. This error states that you do not have Scan Mode installed on the NI 9149, but you already installed Scan Mode. This error occurs because the IP address of the NI 9149 was changed to a different IP address and subnet. The static node used in Figure 4 maintains the original IP assigned to the NI 9149. Because you changed the IP to a different subnet, you must change your code to use the Programmatic Shared Variable API. Using the code shown in Figure 9, you can communicate with your Ethernet RIO expansion chassis.

Figure 7. Requires Scan Mode
 
  1. To set up the VI in Figure 9 correctly, you need to use the correct Shared Variable API VI. This example uses the Read Variable with Timeout function, which can be found in the Functions Palette under Data Communication » Shared Variable » PSP Variable » Read Variable with Timeout.

Figure 8. Block Diagram for Shared Variable API

Congratulations! You have now successfully connected your Ethernet RIO expansion chassis to the secondary port on your real-time controller.