Modbus Slave FAQs

NI Vision Builder

Communicate

Modbus Slave FAQs

Q: Why is my Modbus device timing out and not receiving responses from Vision Builder AI?

First, Make sure that your Modbus device is declared in the Communication Device Manager. Then, make sure that your serial port settings match the serial settings for the Modbus device. If you are running Vision Builder AI on a PC, complete the following steps to configure your serial port settings.

  1. Launch Measurement & Automation Explorer (MAX).
  2. Expand Devices and Interfaces.
  3. Expand Ports (Serial & Parallel).
  4. Click your serial port name in the configuration tree.
  5. Click the Port Settings tab.
  6. Configure your serial port settings.

If you are running Vision Builder AI on remote target, complete the following steps to configure your serial port settings.

  1. Launch Vision Builder AI.
  2. Select the remote target you want to configure.
  3. Select Target»Target Options.
  4. Click the Serial Port tab.
  5. Configure your serial port settings.
Note  You must have NI-VISA installed to communicate with serial devices.

Check your device manual for the type of serial cable you need to communicate with the device. Some devices require straight-through cables while others require crossover cables.

Tip  Make sure you select the serial port connected to your device when sending and receiving commands. Also, make sure that the Modbus server is running in the Communication Device Manager. Select Tools»Communication Device Manager to launch the Communication Device Manager.

Q: How can I verify that my serial port is working correctly?

Refer to Serial Communication Starting Point for information and troubleshooting tips.

Q: How do I set the value of a local Modbus register based on the result of an inspection?

At the end of your inspection diagram, add a Logic Calculator step that computes the AND of all the step statuses. Then, add a Serial I/O step after the Logic Calculator step to send a serial command based on the Step Status of the Logic Calculator step.

Note  The AND of all the step statuses equals the Inspection Status.

Q: The register values are not being updated on the Modbus device or in Vision Builder AI, but the Modbus device is not timing out. What could be the reason for this?

Make sure that you specify the correct address in the Modbus device configuration software for the register you want to use in Vision Builder AI. In most Modbus device configuration software, you must enter a name for the register you want to use. Per Modbus convention, the register address of the slave device is calculated by subtracting 1 from the register name that you specify in the master device configuration software. Vision Builder AI expects register addresses, not register names, so you may have to subtract 1 from the address you defined in the Modbus device configuration software. For example, a register name defined as 2 in a Modbus configuration device translates to register address 1 in the Vision Builder AI Holding Registers table.

Modbus DeviceHolding Register Name = 2
Vision Builder AIHolding Register Address = 1

The Modbus data model is based on a series of four tables: Discrete Inputs, Coils, Input Registers, and Holding Registers. These tables do not overlap in Vision Builder AI. Some Modbus devices use the following start addresses for these tables.

  • 0x00000 for the Coils
  • 0x10000 for the Discrete Inputs
  • 0x30000 for the Input Registers
  • 0x40000 for the Holding Registers

Because the tables do not overlap in Vision Builder AI, ignore the first digit of the start addresses when entering the addresses in Vision Builder AI. For example, a register name defined as 0x40000 in a Modbus configuration device translates to register address 0 in the Vision Builder AI Holding Registers table.

Modbus DeviceHolding Register Name = 0x40000
Vision Builder AIHolding Register Address = 0

Sometimes you need to subtract 1 from the register name that you specify in the master device configuration software and ignore the first digit of the start address to ensure proper register addressing. For example, a register name defined as 0x40008 in a Modbus configuration device translates to register address 7 in the Vision Builder AI Holding Registers table.

Modbus DeviceHolding Register Name = 0x40008
Vision Builder AIHolding Register Address = 7