Distributed Control & Automation Framework (DCAF)

Showing results for 
Search instead for 
Did you mean: 

DCAF Modbus Module Documentation



Connect DCAF to Modbus systems that operate with the modbus protocol.



Writes and reads values from using the Modbus protocol as either slave or master.


The DCAF Modbus module uses the NI Modbus Library. That library's page has more background on the Modbus library used in this DCAF module.


This NI White Paper has more background information on the Modbus protocol.

Configuration of the Modbus Module

The modbus module you run in DCAF will be just one of multiple endpoints in your modbus system. You need to make sure you understand the topology of your system and the configuration of your devices to properly use the Modbus module.


The first step is to set up the 'Registers' tab of the configuration.




Use the '+' button to add new channels, the '-' button to remove them, and the gear button to edit them.


When adding or editing a channel, this screen will be presented:




Access Type: Whether this channel will be read from Modbus or written to Modbus

Channel Name: The name the DCAF will use to associate tags with this channel.

modbus bank: The set of registers this should channel should be accessing.

Address: The offset from the modbus bank that this channel will read from.

Type: The data type of the register.

Tag: The DCAF tag to map this channel to.

Alias: The exact address of the register on the modbus.


Once all of your channels and registers are configured, you should set up the interface.




Class: The protocol of the modbus endpoint.

Unit ID: Used for intra-system routing purposes for some serial devices. This is not fully supported in the current version of the DCAF Modbus Module. See this Github Issue for the most up to date information.


For TCP:


address: the IP Address of the modbus slave this system will communicate with.

port: The port the Modbus slave is listening on.


Note: If you are using TCP as your interface, you should set this module to run asynchronously. You can configure this from your engine configuration in the Module Setting tab.


For Serial:




The serial page has additional configuration. You should configure your serial port so that it has the same setting as the other serial endpoints for your Modbus configuration.


Note: To see the VISA resource names and settings of your devices, you can find them in the 'Devices and Interfaces' pane of NI Measurement and Automation Explorer. This is useful when configuring your application on a different system than the one it will run on.


Export Pane: If you want to easily add your configuration to Kepserver, you can export this configuration as a CSV file that you can load in other applications.

Using the Modbus Module

 If you are using the Modbus module as a master, make sure that the modbus slaves are accessible otherwise you may encounter initialization errors. 

Modbus Module Example


Attached to this page is an example DCAF Application set to act as a Modbus master.



1. Open the ModbusExample.lvproj. Open and run the Modbus Slave Example.vi (This is the example shipping with the NI Modbus Library). 

2. Open the Host Main.vi and choose the Modbus Example.pcfg file to load. Type in 'PC' as the target alias. Run the Host Main.vi. If you don't already have the slave running, you will encounter an error when initializing the DCAF application.

3. A front panel should be launched that lets you interact with the Modbus Slave Example.vi. The DCAF panel will automatically set and fetch the values. The Modbus Slave Example.vi requires you to hit the fetch and set buttons to update its UI. You should see changes made in one panel affect the other.


Open the Modbus Example.pcfg to see how the example is configured.




Software Requirements

  • LabVIEW 2014 or later
  • NI Modbus Library


  • Supports the IEEE Modbus standard. If your device does not strictly implement the IEEE standard you may need to modify the module to conform to your devices specifications.



Install the DCAF Modbus Module directly from VI Package Manager.



Post issues on GitHub and ask questions below.


Visit Collaborating on the Development of DCAF to learn how to contribute your own improvements to this module directly.


Other Modules


A full list of DCAF Modules can be found here.

Message 1 of 1