• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Examples and Tutorials
  • Using Modbus RTU on Adam-4150

Creating GUI with Custom Graphics Grouping Widgets with Container in HMI GUI

Using Modbus RTU on Adam-4150

Using Modbus RTU on Adam-4150

The purpose of this example is to show how to use and setup a Modbus RTU device in CDP Studio, the independent automation software for open PC-based real-time distributed control systems with simple NoCode programming similar to PLC IEC 61131-3 function block diagram.

This example uses an Adam-4150 Modbus RTU device and has a GUI for visualization and control.

This example includes

  • A simple system (project) and application
  • A Modbus RTU master (to communicate with an Adam-4150 device)
  • A GUI to visualize the I/Os and the state of the modbus communication
  • Routings between the GUI widgets and the Modbus master

Prerequisites:

  • An Adam-4150 Modbus RTU device, set up with baudrate 19200,8,N,1
  • A shunt or short wire that connects DO0 with DI0 on the Adam-4150
  • A USB to RS/485 converter

Project Overview

The project consists of a GUI that contains several Lamp and Toggle Button widgets (GUI elements) and the ModbusMasterRTU component. The example allows you to change the digital outputs of the Adam-4150 from the GUI, and to observe the digital inputs coming from the Adam-4150.

Before you run the project, make sure to set the correct ComPort in the SerialTransport inside ModbusGUIApp.Adam4150Modbus. The ComPort is the port that the RS/485 converter the Adam-4150 physical device is connected to.

How to Run the Example

To run the example from CDP Studio, open Welcome mode and find it under Examples. Next, in Configure mode right-click on the system project and select Run & Connect. See the Running the Example Project tutorial for more information.

Project Description

The application has 7 Lamp widgets inside the Inputs groupbox, and 8 Toggle Buttons inside the Outputs groupbox. At the top there is a label to show the state of the ModbusMasterRTU I/O (The label is named ModbusState). All the inputs can not be toggled (the enabled property in the widget is set to 0), but the outputs can be toggled on or off.

The Adam4150Modbus component is a ModbusMasterRTU component that is configured to communicate with the Adam-4150 physical slave device. The Adam-4150 exposes 7 digital inputs from Modbus read address 0 and 8 digital outputs from Modbus write address 16. To access the data, the Adam4150Modbus component has two packets set up:

The Read packet has FunctionCode ReadDiscreteInputs to read the input bits, while the Write packet has FunctionCode WriteMultipleCoils to write the output bits. To get more information about setting up Modbus, see the Modbus Configuration Manual.

GUI Configuration

The GUI configuration can be seen in Design mode:

  • Input Lamp DI0 has cdpRouting set to ModbusGUIApp.Adam4150Modbus.Read.Digital.DI0
  • Input Lamp DI1 has cdpRouting set to ModbusGUIApp.Adam4150Modbus.Read.Digital.DI1, and so on. The Adam-4150 has 7 inputs, DI0 - DI6.
  • Output Toggle Button DO0 has cdpRouting set to ModbusGUIApp.Adam4150Modbus.Write.Digital.DO0
  • Output Toggle Button DO1 has cdpRouting set to ModbusGUIApp.Adam4150Modbus.Write.Digital.DO1 and so on.

When the application is running and all is set up correctly, toggle all outputs to on. The Adam-4150 module now looks something like this:

If you toggle DO0, you will also see that DI0 toggles. This is due to the shunt that connects DO0 and DI0.

Troubleshooting

If there are communication-issues, please verify all the items in the list below:

  • Check that the Adam module has power and that the status light is blinking.
  • Check that the Adam module mode switch is set to 'Normal'
  • Check that the wiring between the Adam module and the rs/485 converter is correct
  • Check that the rs/485 converter is connected to the target computer
  • Check that the ComPort in the SerialTransport inside ModbusGUIApp.Adam4150Modbus is set to the ComPort that the rs/485 converter is at. (on Windows, the ComPort is typically '\\.\COM3' or similar, while on Linux the comport might be '/dev/ttyUSB0'
  • Check that the Adam module is set up according to the BaudRate, Parity, DataBits and StopBits in SerialTransport:

Note: The Property Debug in ModbusGUIApp.Adam4150Modbus can be set to the value 2. This will cause the Adam4150Modbus to write out each telegram it sends along with connection information

Creating GUI with Custom Graphics Grouping Widgets with Container in HMI GUI

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top