• 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

  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Protocols - Modbus I/O
  • Modbus Configuration Manual
  • 4.11.14

Modbus Setup Guide Protocols - Modbus I/O

Modbus Configuration Manual

Introduction

The Modbus I/O Servers are CDPComponents that transform CDP values to and from the format required by the MODBUS protocol specification.

Click here for a quick guide how to set up a Modbus TCP Master/Slave Demo

Modbus Protocol Quick Guide

Modbus is a request/reply protocol where there typically is one client (Modbus master) and one or more servers (Modbus slaves). As the Modbus protocol initially was used on a shared line serial bus, each Modbus slave has a unique address (slave ID) on the bus. Valid slave IDs for a Modbus slave are 1 to 247. The Modbus master sends a request to the Modbus slave(s). The Modbus slave(s) that match the slave ID in the request will then process the request and return a reply. The Modbus master then processes the response from the Modbus slave.

There are several types of requests a Modbus master can issue. Each request contain a FunctionCode that tell the Modbus slave(s) what to do. The following FunctionCodes are supported by CDP Studio:

Name of Function CodeNumberDescription
ReadCoils0x01 / 01The Modbus master requests the slave to return a range of coil (digital) values. This FunctionCode can be used if the packet contains only physical digital input data
ReadDiscreteInputs0x02 / 02The same as ReadCoils, but FunctionCode is 2.
ReadHoldingRegisters0x03 / 03The Modbus master requests the Modbus slave to return a range of register values. This FunctionCode can be used if the packet contains only physical input data.
ReadInputRegisters0x04 / 04The same as ReadHoldingRegisters, except the functioncode is 4.
WriteMultipleCoils0x0f / 15The Modbus master requests the Modbus slave to write a supplied range of coil (digital) values to the specified register range. This FunctionCode can be used if the packet contains only physical digital output data.
WriteMultipleRegisters0x10 / 16The Modbus master requests the Modbus slave to write a supplied range of register values to the specified register range. This FunctionCode can be used if the packet contains only physical output data.
ReadWriteMultipleRegisters0x17 / 23The Modbus master asks the Modbus slave(s) to write an amount of data to registers starting at specified address, and to return a specified range of register values. This FunctionCode can be used if the packet contains both physical input and output data.

Typical function codes used are ReadWriteMultipleRegisters, ReadHoldingRegisters and WriteMultipleRegisters. The other functioncodes are there to provide compatibility with old devices.

Note: The FunctionCode must be selected according to the data in the packet. For instance, FunctionCode ReadWriteMultipleRegisters can only be used if there is both input and output data in the packet. For only physical inputs, use ReadHoldingRegisters, and for only physical outputs, use WriteMultipleRegisters.

CDP Studio does not do any mapping of ReadAddress or WriteAddress according to the functioncode. (f.i. the ReadHoldingRegisters function code can be used with any Modbus address). It is the user's responsibility to set up the Read and Write addresses correctly.

The Modbus packets contain 16-bit register data values in a continuous array. The Modbus master specifies the start address where the Modbus slave should read or write (all) this data. If there are values that should not be read or written, these value addresses should not be within the range of the Modbus request. It is therefore important how the data is organized in the Modbus slave. To avoid having many packets, Modbus slave data that should be read and written should be organized in separate continuous arrays.

The Modbus addresses as defined by the modbus Standard are 16 bit, and thus range from 0 to 65535. Some manufacturers add a number in front of the Modbus address to signify that the address is analog or digital, input or output, or it may have some other manufacturer-defined meaning. This prefix number is not part of the modbus address, and must be removed when the modbus address is specified. To further complicate the issue, some manufacturers specify adresses as 1-based instead of 0-based. CDP Studio uses 0-based Modbus addresses.

Note: Be aware of how the Modbus slave has defined its modbus addresses, as it might be off by one, depending on the implementation.

By using CDP Studio you can easily map CDPSignal values into or out of the Modbus packets by using Routing. Each packet contains one or more consecutive IOModules (groupings) that hold a user-defined amount of CDPSignalChannels. The data from each channel is mapped into the packet address at the position where the channel is placed.

The table below shows the Modbus address layout of an example Modbus packet that starts at ReadAddress 0x00, and contains the CDPSignalChannels 'Speed', 'Position' and 'Acceleration':

Modbus Address (Hex / Dec)NameTypeData size (Modbus registers / bytes / bits)
0x00 / 0SpeedCDPSignalChannel<unsigned short>1 Modbus register = 2 bytes = 16 bits
0x01 / 1PositionCDPSignalChannel<unsigned int>2 Modbus registers = 4 bytes = 32 bits
0x03 / 3AccelerationCDPSignalChannel<short>1 Modbus register = 2 bytes = 16 bits

The Packet address starts at 0x00, so this is where the first item 'Speed' maps into. It takes up one Modbus register in size, so the next data 'Position' is put at Modbus address 0x01. The 'Position' data takes up 2 Modbus registers in size. This means that the 'Acceleration' data is located at Modbus address 0x03. The total amount of data in the packet is 4 modbus registers, which is 8 bytes. As can be seen from the table, each item's size impacts the address of the next item. The Modbus packet maps the Modbus data array into (or out of) the CDPSignalChannels in the order and sizes that are specified.

Modbus in CDP Studio

The Modbus protocol is implemented in the following base I/O-servers:

NameDescription
ModbusMasterUDPA Modbus master that sends Modbus/TCP requests to a slave using the UDP network protocol.
ModbusMasterTCPA Modbus master that sends Modbus/TCP requests to a slave using the TCP network protocol.
ModbusMasterRTUA Modbus master that sends Modbus/RTU requests to a slave using a serial bus protocol.
ModbusSlaveUDPA Modbus slave that accepts Modbus/TCP requests from the UDP network protocol
ModbusSlaveTCPA Modbus slave that accepts Modbus/TCP requests from the TCP network protocol
ModbusSlaveRTUA Modbus slave that accepts Modbus/RTU requests from a serial bus protocol

In addition, some pre-configured I/O-servers have been made, to simplify setting up Modbus communication with supported devices, see Pre-made ModbusIOServers below.

Principle of Operation

Every period (as defined by fs), the Modbus master will try to send packets that are marked ready to send, in the order they are defined. If a response for a packet is not received within the Transport Timeout (or packet ResponseTimeout, if configured), then that slave ID is marked as inactive and put at the end of a retry list together with a time for when to retry. See ExponentialBackoffTime for more information on the exponential backoff time calculation.

After sending all packets that are marked ready to send, the Modbus master will pick the first packet from the retry list which is at or later than the packet send Time, and try to send that. When ResponseTimeout is set to a sensible value in relation to the Modbus fs, this ensures that non-responding Modbus slaves will cause minimal disturbance for the other responsive Modbus slaves.

Note: All the packets are sent in the order they are configured in the ModbusIO Packets table, given that they have been flagged for sending.

The Modbus master implements the internal states Init, Error and Online for handling of each Modbus slave ID as shown in the image below. The states correspond to the packet SendMode, except that state Online handles packets with SendMode Periodic, Trigger and OnChange:

A Modbus slave receives requests from a Modbus master. If the request matches a defined packet, then that response packet is returned to the Modbus master. If there is no matching Modbus slave ID, or there is a Broadcast request (slave ID 0) then no response is returned to the Modbus master.

States and Status

The Modbus I/O has the following states, as represented by the CurrentState property:

StateDescription
OfflineIndicates broken communication with all nodes (packets). Communication is still attempted, but as long as no nodes are online, the IOServer will be in Offline State.
OnlineIndicates successful communication with one or more nodes (packets). The packet state can be retrieved from the packet's Online status.

The signals NumberOfNodes and NumberOfNodesOnline can be used to tell how many packets are configured, and how many nodes are online.

Each packet also has an Online Property that is continously updated.

When the Modbus IO goes Offline, the Transmission Error alarm is set, indicating a failure. See CDPAlarm for more information on how to control Alarms.

Note: All this information can be used by other components in the system, to enable or disable system functionality. The relevant information can be Routed, or queried through a CDPConnector or CDPPort.

Transport Configuration

The Transport must be configured to tell the IOServer how to send and receive the data. The available transports are:

  • TCPTransport
  • UDPTransport
  • SerialTransport.

The Transport has a configurable Timeout (in seconds, f.i. '0.5'). This is the allowed amount of time to pass from a packet being sent until an answer is received (unless overridden by ResponseTimeout, see below).

Periodic packets are sent at the configured frequency (CDPComponent fs).

Note: In the event that no response is received within a Process Period, UDP and Serial will refresh the packet data and send the packet again, while TCP will resend the last packet without refreshing its data.

Pre-made ModbusIOServers

Some pre-made ModbusIOServers are provided. These are pre-set up to simplify configuration of the device, and typically have an IO packet and maybe some watchdog initialization packets. To function correctly, these IOServers usually only need the transport set up correctly, and some modules (that match the physical configuration) added to them. If the IOServer already has an IO packet, put your IOModules in there. See the models for the Weidmüller-UR20-FBC-MOD for an example of this.

Generic Modbus Configuration

The Modbus I/O Servers send the requests to slaves (numbered nodes) in the form of Modbus Packets.

First, select a suitable Modbus I/O server to use (see table above), either master or slave, TCP, UDP or RTU. Choose one of the pre-configured I/O servers if available for your target node; it simplifies the setup. Then set it up:

  • The fs property determines the Send-rate for a Modbus master.
  • The transport layer configuration must be set up in the Transport table. This can be either UDP, TCP or Serial. Take care to set a sensible Timeout as explained above.
  • Packet(s) must be added into the Packets table and configured. See the table below for configuration options.
  • Modules must be added to a packet to determine what data to read or write. A module is a logical grouping of CDPSignalChannels that encapsulates data to send or receive.

If there is no pre-configured I/O server available for your Node, the following properties must also be set:

  • Set DigitalModuleHandling, see table below for more information.
  • Set DigitalRegistersAreLinear, see table below for more information.
  • Set ModuleOrdering, it is typically set to AsConfigured, see table below.
  • Set NetworkConvert according to the node specification.

A Modbus slave packet has the following settings:

Property NameDescription
NameUnique packet name
SlaveIDThe unique Modbus slave identifier
ReadAddressThe address that the first input channel uses. The following input channels get their data from the following addresses.
WriteAddressThe address that the first output channel uses. The following output channels write their data to the following addresses.
FunctionCodeHow to transmit the data in the packet: If the data is read only, use ReadHoldingRegisters. Channels in the packet must have Input="0". If the data is write only, use WriteMultipleRegisters. Channels in the packet must have Input="1". If the data is read and write, use ReadWriteMultipleRegisters. Channels that have Input="0" will receive the 'Read' part, and Channels that have Input="1" will be sent to the connected node.
DigitalRegistersAreLinearWhen this is 1, the digital registers are transfered 'Most Significant Byte' first. This is typically set for devices where digital channels are linear, but the analog channels are byteswapped (In other words; NetworkConvert is 1, but not for digital content registers). If DigitalRegistersAreLinear is set to 0, then the NetworkConvert property decides how to transfer the bytes in the Packet.
DigitalModuleHandlingSets how to handle digital channels in memory.
  • AlignAdjacent: Bits are stacked next to each other, even if they are from different modules. See ModuleOrdering AsConfigured for special condiditions.
  • AlignOnByteBoundary: Digital channels from each new module with size <9 bits start on the following byte. Modules that are >8 bits will start on the following word (16 bits).
  • AlignOnByteBoundaryStrict: Digital channels from each new module start on the following byte, regardless of the size. This means that a 16 bit digital module following an 8 bit or less digital module might be 'split' so that the first half is in one Modbus register, and the other half is in the next Modbus register.
  • AlignOnWordBoundary: Digital channels from each new module start on a new word (16 bits)
ModuleOrderingSets how to handle module ordering organization in memory.
  • Analog first: All analog channels will be put into memory first, then the digital channels follow. The configured setup is only used to get the order of the modules within analog and digital domains.
  • Digital first: All digital channels will be put into memory first, then the analog channels follow. The configured setup is only used to get the order of the modules within analog and digital domains.
  • AsConfigured: Module ordering is determined entirely by the configuration order. This means that the Modbus data is organized in the order specified by the modules.

    Note: For the combination of DigitalModuleHandling AlignAdjacent and ModuleOrdering AsConfigured, inserting an analog module inbetween digital modules breaks up the digital module alignment so that digital modules after the analog module are aligned together. Analog modules after digital modules will always be aligned on a Modbus register/word boundary.

NetworkConvertWhen checked, data will byteswapped (this can also be controlled on a per-channel level).
OnlineWhen packet data is being communicated correctly (responses are received within the transport Timeout), then the packet is Online (1). If not, it is Offline(0).
EnableSet to 1 to enable the packet. When Enable is 0, the packet is skipped.
LastSendTimeLast time this packet was sent. Time is number of seconds since epoch, as returned by CDPTime::GlobalClockMs(). It can be converted to human-readable time using the Automation::DecomposeTimestampOperator.
LastReceiveTimeLast time this packet received a reply. Time is number of seconds since epoch, as returned by CDPTime::GlobalClockMs(). It can be converted to human-readable time using the Automation::DecomposeTimestampOperator.
LastFailTimeLast time this packet had a failure. Time is number of seconds since epoch, as returned by CDPTime::GlobalClockMs(). It can be converted to human-readable time using the Automation::DecomposeTimestampOperator.
WaitTimeBetweenPacketsA configurable time (in seconds) to wait before sending. On a Modbus master the wait happens before sending the request, and on a Modbus slave the wait happens before sending the reponse. For Modbus RTU, this time is added to the '3.5 character times' inter-frame delay.
LastExceptionCodeModbus Exception code as related to this packet. Typical values are 0 (no error), 1 (Illegal Function), 2 (Illegal Data Address), 3 (Illegal Data Value) and 4 (Slave Device Failure).

A Modbus master packet has the following additional properties:

Property NameDescription
RetryCountWhen no response has been received from a request, this is the number of times to retry sending the packet before setting the packet Online property to 0. Note that for TCP transports, RetryCount is unused, as the connection will be closed and reopened when transport errors occur.
SendModeHow to send the data:
  • Init: Send once whenever the IOServer connects
  • Error: Send after any Modbus exception error occurs
  • OnChange: Transmit data when CDP outputs change. This feature is only active when channels marked with Input="1" are available. Specifically, an OnChange packet using FunctionCode ReadHoldingRegisters won't function as there is no output data to monitor for changes
  • Periodic: Send each Period (as denoted by the fs property)
  • Trigger: Send only when the packet 'Trigger' changes from 0 to 1

Note that packets which are ready to send are sent on the next run as specified by the fs property.

TriggerOnly valid when SendMode is 'Trigger'. Change from 0 to 1 to trigger sending the packet.
InitialFaultWhen set to 1, the master-packet has a fault condition before it is sent first time. Faulty packets trigger the IOServer Transmission Error alarm
CurrentRetryWhen retrying send, this is the current retry number, limited by the packet RetryCount. If not retrying send, this number is 0.
PacketsLostTotal number of packets lost. This variable is incremented each time a Response is missing from a Request. Note that this number wraps around if it becomes larger than what the storage-type can handle.
PacketsSentTotal number of packets sent. This is incremented when a packet is sent. Note that this number wraps around if it becomes larger than what the storage-type can handle.
PacketsReceivedTotal number of packets received. This is incremented when a packet is received. Note that this number wraps around if it becomes larger than what the storage-type can handle.
ResponseTimeoutThe time (in seconds) to wait for a response; for instance 0.2. If ResponseTimeout is 0, then the Transport Timeout is used as ResponseTimeout. The ResponseTimeout is usually set to lessen the impact of a non-responding SlaveID (typically when using Modbus RTU), in conjunction with setting ExponentialBackoffTime.
ExponentialBackoffTimeThe time (in seconds) used in the calculation for exponential backoff when no response is returned for a packet: Time-offset to next send for the packet = ExponentialBackoffTime*slaveID_send_try*slaveID_send_try. If ExponentialBackoffTime is 1 second and no reply is received for a packet then the next send time calculations for a packet for that SlaveID are as shown in the table ExponentialBackoffTime Timings.

ExponentialBackoffTime Timings

Send-try#ExponentialBackoffTimeCalculationTime-offset for next packet-send
111*1*11 second
211*2*24 seconds
311*3*39 seconds
411*3*39 seconds
...11*3*39 seconds

Note: As can be seen from the table above, the send-tries are limited to 3. See Principle of Operation for how the Modbus master implementation works.

Modules in Packets

A Modbus packet in CDP Studio contains one or more modules. Modules are named groupings of channels, and typically used to reflect a physical I/O module. Many hardware-manufacturers have stackable modules that can be put on their 'buscouplers' to add physical conversion to and from physical signals.

To enable easy configuration of these, the concept is mirrored in CDP Studio.

A Modbus I/O Module has the following properties, most of which are there to handle module/data-packing quirks:

Property NameDescription
NameThe name of the module
InputBytesReservedBeforeThe number of bytes to reserve before the actual input data in this module. Set this to the number of 'gap' bytes in front of the input data in this module (Typically set to 0).
OutputBytesReservedBeforeThe number of bytes to reserve before the actual output data in this module. Set this to the number of 'gap' bytes in front of the output data in this module (Typically set to 0).
InputBytesReservedAfterThe number of bytes to reserve after the actual input data in this module. Set this to the number of 'gap' bytes after the input data in this module (Typically set to 0).
OutputBytesReservedAfterThe number of bytes to reserve after the actual output data in this module. Set this to the number of 'gap' bytes after of the output data in this module (Typically set to 0).

Channels in Modules

Depending on the FunctionCode used, a Modbus master writes channels that have Input="1", and it reads channels that have Input="0". A Modbus slave handles write requests into channels that have Input="0", and it handles read requests from channels that have Input="1". This means that for a Modbus slave to mirror a Modbus master, then the setup of the Modbus master and Modbus slave is equal for the Packet setup (For instance, the Modbus slave has the same FunctionCode as the Modbus master). Note that the channels differ, in that the Input attribute on the Modbus master and Modbus slave is inverted (A Modbus slave has Input="1" and a Modbus master has Input="0" for the corresponding channel). See Modbus slave setup for more information.

Boolean (digital) channels are bit-packed into 16-bit Modbus registers so that the first channel becomes bit 0, the next is bit 1 and so on. Bitpacking per module is done according to the configuration of DigitalModuleHandling. Digital channels from adjacent modules are put together according to the ModuleOrdering configuration.

Large Data-types

The Modbus standard does not specify how to transfer data larger than 16 bits. This poses a challenge when working on data-types larger than 16 bits, as the byte-sequence of that data is not properly defined. The CDP Automation add-on defines a ByteSwap operator which can be used to manipulate the byte order of a signal.

In Modbus, int, {unsigned int},float, double and other large datatypes might require a ByteSwap operator on that signal to be converted corrrectly, depending on the implementation in the device being communicated with. For instance, the byte-sequence of float data '0123', where 0,1,2 and 3 represent bytes in the float, could be converted to '2301'. As devices have different implementations of the byteswapping of large data-types, it is advisable to test that the values sent match the values received. We recommend using a 'Hex to float' converter to test this. By generating a known number on one side, it is possible to test that the other side converts this correctly, and if not, use the 'Hex to float' converter to determine how the swapping becomes incorrect.

For instance, the hex value '0x1122331f' corresponds to the float value '1.27953e-28'. '11' fills one byte, '22' fills the next byte, '33' fills the third byte, and '1f' fills the last byte. (Note that the last byte can not be '44' due to restrictions in the IEEE 754 floating-point format). Send the value '1.27953e-28' from the transmitting side, and check the hex value that is received in a 'float to hex' converter. By looking at the byte positions of '11', '22', '33' and '1f' in the received hexadecimal number, it should be possible to determine how the ByteSwap operator should be configured to produce the correct result.

See ByteSwap operator for more information about the ByteSwap operator.

I/O Channel Scaling

Physical analog I/O modules typically accept 2-byte (short) values from the control-system. To see how these values map to physical values, please consult the manufacturer documentation for the module in question.

Let's say you are controlling a +/- 10 Volt output. In CDP, your program code is working with the values -1 to 1, since it is convenient to decouple the external details from your code. By looking up the manufacturer documentation for the Analog Output module, you learn that the module will output -10 Volt when it receives the value -32768, and that +10 Volt is output when the module receives a value of 32767. Values inbetween scale linearily between -32768 and 32767.

We can add a ScalingOperator to the output channel that scales the value '-1' to '-32768' and the value '1' to '32767':

NameInValueOutValue
SP0-1-32768
SP100
SP2132767

The above scaling-operator scales an input of -1 to -32768 , 0 is 0 and 1 is scaled to 32767. See the ScalingOperator for more information about how the scaling is done and how it works.

Watchdog

Some Modbus slave nodes have a watchdog function. A watchdog is typically a counter that counts down at a determined time-interval. If the watchdog is allowed to reach 0, the physical outputs of the node are set to a pre-defined value (typically 0, or last value). Whenever a Modbus access is performed, the watchdog is reloaded, preventing a timeout. This mechanism can help ensure that when communication to the physical equipment is lost, the equipment stops safely. Note that for problem-free operation, the Modbus master must be configured to send packets fast enough so that this watchdog in the Modbus slave is reloaded before it times out.

Value Change on Error

When a Modbus Packet goes to Offline state, the default behavior is to keep the last value for all physical input channels. It is the Packet Argument KeepLastValueOnDisconnect that controls this behavior:

  • When it is set to 1 and the packet goes Offline, the packet keeps its physical input values to its last value.
  • When it is set to 0 and the packet goes Offline, the physical inputs in the packet are forced to 0.

All packet KeepLastValueOnDisconnect Arguments are by default Routed to the governing KeepLastValueOnDisconnect property that is present in the ModbusIO component:

To change the default behavior so that all packet physical inputs get value 0 when the packet(s) go Offline, change the ModbusIO KeepLastValueOnDisconnect property to 0.

If you only want to change an individual packet's behavior so that it sets its physical inputs to 0 when it goes Offline, remove the Routing in the KeepLastValueOnDisconnect Argument for that packet, and set the Argument Value to 0:

See also the related topic Safe Value CDPSignals.

Modbus Slave Setup

The Modbus slave is set up from the perspective of the Modbus master. If the Modbus master has a packet with 'ReadHoldingRegisters', then the slave should also be set up with a packet with 'ReadHoldingRegisters'. The only difference is in the channels. For a Modbus master packet where the channels are set up with Input='0', the channels in the Modbus slave are set up with Input='1'. Where Modbus master channels have Input='1', the Modbus slave channels have Input='0'. In other words, set up the Modbus slave packet exactly as you would set up the Modbus master packet, but make sure to invert the Input in the Modbus slave channels relative to the Modbus master channels.

Note: If you have a Modbus master already set up, go into the Packet and copy all modules. Go into the corresponding Modbus slave packet and paste in the modules. Then go into each module in the Modbus slave and invert the Input attribute for all the channels in each module.

Debug Information

Various levels of Debug information can be enabled by setting the Debug property. When Debug = 0, only startup-errors are printed. If you encounter problems with Modbus communication, try increasing Debug to get more information about the cause of the failure. Increasing Debug increases the amount of information printed.

If Debug is set to 1, it will print out the configuration during Configure():

14:38:15.192 BRApp.BRIO: Configuring packet 'AIO' : FunctionCode='ReadWriteMultipleRegisters', SendMode='Periodic',
  DigitalModuleHandling='AlignOnByteBoundaryStrict', ModuleOrdering='AsConfigured', SlaveId=1,
  ReadAddress=0x0, WriteAddress=0x800, NetworkConvert='1', RetryCount='0', WaitTimeBeforeSend='0',
  ResponseTimeout='0.000000', ExponentialBackoffTime='0.000000'
14:38:15.196 CDPSignal[BRApp.BRIO.AIO.X20PS9400.BusSupplyCurrent]: Created CDPOperator DivOperator.
14:38:15.198 CDPSignal[BRApp.BRIO.AIO.X20PS9400.BusSupplyVoltage]: Created CDPOperator DivOperator.
14:38:15.198 BRApp.BRIO: Module='X20PS9400', #AI=0, #AO=3, #DI=0, #DO=0', ReadLength=6.00, WriteLength=0.00
14:38:15.201 BRApp.BRIO: Module='AO4-X20AO4632', #AI=4, #AO=0, #DI=0, #DO=0', ReadLength=0.00, WriteLength=8.00
14:38:15.204 BRApp.BRIO: Module='AI4-X20AI4222', #AI=0, #AO=4, #DI=0, #DO=0', ReadLength=8.00, WriteLength=0.00
14:38:15.210 BRApp.BRIO: Module='AI8-X20AI8321', #AI=0, #AO=8, #DI=0, #DO=0', ReadLength=16.00, WriteLength=0.00
14:38:15.212 BRApp.BRIO: Module='AO2-X20AO2437', #AI=2, #AO=2, #DI=0, #DO=0', ReadLength=4.00, WriteLength=4.00
14:38:15.213 BRApp.BRIO: packet 'AIO' : ReadLength=34, WriteLength=12'
  

When running periodically and Debug is set to 1, connection info and packet-sending will be printed:

14:38:16.654 BRApp.BRIO: Trying to send Periodic-packet 'BRApp.BRIO.AIO'
14:38:16.655 BRApp.BRIO: Trying to send Periodic-packet 'BRApp.BRIO.DIO'
14:38:16.656 BRApp.BRIO: Communication established.
14:38:16.754 BRApp.BRIO: Transport connected.
14:38:16.754 BRApp.BRIO: Trying to send Periodic-packet 'BRApp.BRIO.AIO'
14:38:16.755 BRApp.BRIO: Trying to send Periodic-packet 'BRApp.BRIO.DIO'
14:38:16.855 BRApp.BRIO: Trying to send Periodic-packet 'BRApp.BRIO.AIO'
14:38:16.855 BRApp.BRIO: Trying to send Periodic-packet 'BRApp.BRIO.DIO'

When running periodically and Debug is set to 2, the packet data sent and received will be printed in addition:

14:38:17.457 BRApp.BRIO: Trying to send Periodic-packet 'BRApp.BRIO.AIO'
14:38:17.457 BRApp.BRIO.AIO: SendRequest: 10 81 00 00 00 17 01 17 00 00 00 11 08 00 00 06 0c 00 00 00 00 00 00 00 00 00 00 00 00
14:38:17.458 BRApp.BRIO.AIO: ReadResponse: 10 81 00 00 00 25 01 17 22 00 00 00 03 00 36 ff fe 7f ff 7f ff 7f ff 19 99 00 00 00 00 00 04 00 01 00 01 00 00 00 00 00 00 00 04
14:38:17.458 BRApp.BRIO: Setting state 'Online' for Modbus slave ID 1

To determine errors in module configurations, Debug can be set to 3. The Modbus IO will then print at which byte offset it maps the various channels into. This information can be used together with knowledge about the I/O layout to determine if something is set up wrong.

14:43:20.311 BRApp.Wago-750-UDP: Configuring packet 'IO' : FunctionCode='ReadWriteMultipleRegisters', SendMode='Periodic',
  DigitalModuleHandling='AlignAdjacent', ModuleOrdering='AnalogFirst', SlaveId=1,
  ReadAddress=0x0, WriteAddress=0x0, NetworkConvert='1', RetryCount='0', WaitTimeBeforeSend='0',
  ResponseTimeout='0.000000', ExponentialBackoffTime='0.000000'
14:43:20.317 BRApp.Wago-750-UDP: Module='750-431', #AI=0, #AO=0, #DI=0, #DO=8', ReadLength=1.00, WriteLength=0.00
14:43:20.324 BRApp.Wago-750-UDP: Module='750-530', #AI=0, #AO=0, #DI=8, #DO=0', ReadLength=0.00, WriteLength=1.00
14:43:20.329 BRApp.Wago-750-UDP: Module='750-451', #AI=0, #AO=8, #DI=0, #DO=0', ReadLength=16.00, WriteLength=0.00
14:43:20.341 BRApp.Wago-750-UDP: Module='750-1406', #AI=0, #AO=0, #DI=0, #DO=16', ReadLength=2.00, WriteLength=0.00
14:43:20.341 BRApp.Wago-750-UDP: IO.750-451.AI0 Byte Offset [AI: 0]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-451.AI1 Byte Offset [AI: 2]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-451.AI2 Byte Offset [AI: 4]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-451.AI3 Byte Offset [AI: 6]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-451.AI4 Byte Offset [AI: 8]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-451.AI5 Byte Offset [AI: 10]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-451.AI6 Byte Offset [AI: 12]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-451.AI7 Byte Offset [AI: 14]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-431.DI0 Byte Offset [DI: 17]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-431.DI1 Byte Offset [DI: 17]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-431.DI2 Byte Offset [DI: 17]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-431.DI3 Byte Offset [DI: 17]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-431.DI4 Byte Offset [DI: 17]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-431.DI5 Byte Offset [DI: 17]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-431.DI6 Byte Offset [DI: 17]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-431.DI7 Byte Offset [DI: 17]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-530.DO0 Byte Offset [DO: 1]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-530.DO1 Byte Offset [DO: 1]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-530.DO2 Byte Offset [DO: 1]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-530.DO3 Byte Offset [DO: 1]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-530.DO4 Byte Offset [DO: 1]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-530.DO5 Byte Offset [DO: 1]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-530.DO6 Byte Offset [DO: 1]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-530.DO7 Byte Offset [DO: 1]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI00       Byte Offset [DI: 16]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI01       Byte Offset [DI: 16]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI02       Byte Offset [DI: 16]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI03       Byte Offset [DI: 16]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI04       Byte Offset [DI: 16]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI05       Byte Offset [DI: 16]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI06       Byte Offset [DI: 16]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI07       Byte Offset [DI: 16]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI08       Byte Offset [DI: 19]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI09       Byte Offset [DI: 19]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI10       Byte Offset [DI: 19]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI11       Byte Offset [DI: 19]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI12       Byte Offset [DI: 19]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI13       Byte Offset [DI: 19]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI14       Byte Offset [DI: 19]
14:43:20.341 BRApp.Wago-750-UDP: IO.750-1406.DI15       Byte Offset [DI: 19]
14:43:20.341 BRApp.Wago-750-UDP: packet 'IO' : ReadLength=20, WriteLength=2'
  

Modbus TCP Master / Slave Demo

Modbus TCP Master / Slave Demo - Describes how to run and configure a ModbusMaster and slave TCP Demo

Modbus Setup Guide Protocols - Modbus I/O

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

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

    © Copyright 2022 CDP Technologies. Privacy and cookie policy.

    Return to top