Setting Up Dual Ethernet Port Real-Time Controllers

Updated Aug 20, 2021

Environment

Hardware

  • PXI Controller
  • CompactRIO Controller

Software

  • LabVIEW Real-Time Module
  • Measurement & Automation Explorer (MAX)

This tutorial discusses communication between a host PC, or HMI, and a private network target, which is connected to the secondary port of a dual Ethernet port LabVIEW Real-Time controller.

Ethernet port 1 is used for communication between the dual port controller and the host PC. This includes communicating with the controller via LabVIEW and Measurement & Automation Explorer (MAX). Ethernet port 2 is used to communicate with a private network, which is not visible to the host PC.

The LabVIEW project Dual Ethernet Ports on RT.lvproj provides a method for communicating between the host PC and the private network.

In this example a cRIO 9074 is used for the dual port LabVIEW Real-Time controller; however, this process can be used for any dual port LabVIEW Real-Time controller. A cRIO 9012 is used as the private network target in this example.
 

Requirements

  • Any dual Ethernet port LabVIEW Real-Time controller
  • LabVIEW 8.5 or later
  • LabVIEW Real-Time 8.5 or later
  • NI-RIO 2.3.1 or later
  • Ethernet crossover cable

    Configure the targets

    Initially, we will configure both targets to use DHCP and communicate with the host PC. Once communication is established, we will deploy a startup application and Shared Variable library to the private network target.

    1. Configure the host PC, dual port controller, and private network target as shown in Figure 1 below

    Figure 1. Set-up configuration
     
    1. Open Measurement & Automation Explorer (MAX) on the host PC. Both LabVIEW Real-Time targets should be visible in MAX under Remote Systems (see below). If a LabVIEW Real-Time 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. This will reset the IP address to 0.0.0.0.

     
    1. Select the dual port controller under Remote Systems. Ensure that Obtain IP address from DHCP server is selected in the IP Settings field. If Obtain IP address from DHCP server is not selected, select it and click Apply. Click Yes to reboot the controller. Wait for the controller to reboot.
     
    1. Repeat step 3 for the private network target.
    2. Select the dual port controller and click on Advanced Ethernet Settings to launch the configuration window.
    3. Select the MAC address of the secondary port. The IP Address field is the IP address of the secondary port on the dual port controller. This IP address is static and must not reside in the subnet of the primary port.

     
    1. Set the IP Address and click OK.

     

    Deploy the application

    1. Open Dual Ethernet Ports on RT.lvproj  in LabVIEW 8.5 or later, on the host PC.
    2. In the project, right-click on Dual Port Controller and select Properties. Select General from the left menu, enter the IP address of the dual port LabVIEW Real-Time controller. Click OK.

     
    1. Repeat step 2 for Private Network Target.
    2. Expand Private Network Target in the project and open Private Network Target VI.vi
    3. Select Window»Show Block Diagram. This VI reads the USER 1 DIP switch on the controller and writes the value to a locally hosted Shared Variable named Private Network Target USER1 Switch.
    4. In the project, right-click on Private Network Target SVs and ensure that Autodeply Variables is not checked as seen below.  

     
    1. In the project, right-click on Private Network Target SVs and select Deploy. This will deploy the library of Shared Variable to the controller.
    2. Expand Build Specifications under the Private Network Target.
    3. Right-click on My Real-Time Application and ensure that the application is set as startup (Unset as startup will be present as shown below).

     
    1. Right-click on My Real-Time Application and select Deploy. This will deploy the startup application to the controller.
    2. Reboot the controller by pressing the RESET button, and wait for it to reboot.
    3. Ensure that the USER1 LED toggles when the USER1 DIP switch is toggled.



    Configure the target for a private network

    The private network target is now ready for use, after deploying the Shared Variable library, and LabVIEW application as a startup executable. We will now configure this controller for use on a private network, allowing communication with Ethernet port 2 of the dual port controller.

    The following steps will configure the private network target with a static IP address, which resides in the same subnet as the secondary port of the dual port controller. (i.e. 192.168.1.4 for the secondary port and 192.168.1.5 for the private network target, with a subnet mask of 255.255.255.128).

    1. Open MAX and select the private network target under Remote Systems.
    2. Select Edit the IP settings in the IP Settings field. Enter an IP address that resides in the same subnet as the secondary port of the dual Ethernet port controller (i.e. 192.168.1.5).
     
    1. Click Apply. Click OK on all dialog boxes and Yes to reboot.  You have now configured the system as shown below. (Note: The host PC will most likely lose all ability to communicate with the private network target. This behavior is expected, since the private network target is on a different subnet. Useful Tip: To maintain communication with both targets, use a second NIC in your development machine, configured with a static IP that resides in the same subnet as the private network target.)   

     
    1. Disconnect the private network target from the switch or hub.
    2. Now connect the private network target directly to Ethernet port 2 of the dual port controller, using a crossover cable as seen below in Figure 2.

    Figure 2. Deployment Configuration
     
    1. Reboot the private network target to run the startup application.

     

    Establishing communication between the host PC and private network target

    The private network target is now running a LabVIEW startup application and publishing data via Shared Variables to its Ethernet port. Lastly, we will configure the Shared Variable nodes on the dual port controller to communicate with the private network controller.

    1. In the project, right-click on Private Network Target and select Properties. Select General from the left menu, enter the static IP address of the private network target from step 2 in the previous section. Click OK. This will cause the Shared Variable nodes to look at the correct IP address.
    2. In the project expand Dual Port Controller.
    3. Open Dual Port Controller RT VI.vi and open the Block Diagram. This VI reads the value of the Shared Variable, which is hosted on the private network target, and writes it to a different Shared Variable, which is hosted locally. Essentially, Ethernet port 2 of the dual port controller is acting as a client of the Shared Variable Engine on the private network target.
    4. Run Dual Port Controller RT VI.vi
    5. From the project, open Host PC VI.vi and view the Block Diagram. This VI simply reads the value of the Shared Variable hosted on the dual port controller.
    6. Now toggle the USER1 DIP switch on the private network target. The value change will propagate to the dual port controller, and then to the host PC.
     

    Congratulations! You are now successfully communicating between the host PC and the private network target.