Using Modbus with the 987x Modules in an Ethernet RIO Chassis

Updated Sep 26, 2018

Reported In

Hardware

  • NI-9870
  • NI-9871
  • NI-9146
  • NI-9147
  • NI-9148
  • NI-9149

Software

  • LabVIEW Real-Time Module
  • LabVIEW Datalogging and Supervisory Control Module

Issue Details

I have a Ethernet RIO chassis, such as the NI 9148 or NI 9149, and I would like to communicate with a Modbus device through a NI 987x in the chassis. Since Shared Variables are not supported on Ethernet RIOs and the serial ports are not a local resource, so I cannot create a Modbus I/O Server on the Ethernet RIO. How can I communicate with my Modbus device from a NI 987x in an Ethernet RIO chassis?

Solution

To use Modbus with a NI 987x on an Ethernet RIO, you will need to make the serial ports on the NI 987x available as NI-VISA Remote Resources. Once you have do this, it will be possible to use the Modbus API which ships with LabVIEW Data Supervisory and Control (DSC) Module or LabVIEW Real-Time Module. Since these APIs wrap VISA calls for the serial part of the API, it is possible to use these with any serial VISA resource. 

To configure the NI 987x Modules as a VISA Resource accessible on your Host computer for the Modbus API:
  1. Configure the NI 987x to be used in Scan Engine Mode, which will enumerate the serial ports as VISA resources. Instructions on how to do this can be found in Discover, Configure, and Communicate with NI 987x Modules in Scan Mode.
  2. Ensure that NI-VISA Server is installed on the Ethernet RIO. This item will show up in NI MAX under the remote target, and should be nested inside Software >> NI-VISA or under Software >> NI CompactRIO.
  1. With NI-VISA and NI-VISA Server installed and the NI 987x running in Scan Engine Mode, it is now possible to access the serial ports as Remote VISA Resources from the Host PC. To do this, simply use a VISA Resource string of the format visa://<IP Address of Ethernet RIO>/ASRLn::INSTR. It's recommended that you perform a loopback using normal NI-VISA calls before moving on to using the Modbus API.
  2. After confirming the serial port works in a loopback test, you can set up the Modbus API as normal but using the Remote VISA Resource string.

Additional Information

  • NI-VISA Server must be installed in the target because it allows remote access to VISA Resources from other systems, in this case, the host computer.
  • For the NI 9871, the Wire Mode property must be explicitly set via a property node. Additionally, 2Wire-EchoDTR mode is not supported for the NI 9871 on an Ethernet RIO chassis. 
  • For Modbus TCP: Since Shared Variables are not supported on Ethernet RIOs, it is not possible to create a Modbus I/O Server on the Ethernet RIO. Therefore, you can't use Modbus TCP with the Ethernet RIO Expansion chassis.

WAS THIS ARTICLE HELPFUL?

Not Helpful