Function Description

The ADDM function is used to convert a character string into an address that can be used directly by the following communication functions: READ_VAR, WRITE_VAR, INPUT_CHAR, PRINT_CHAR, DATA_EXCH, SEND_EMAIL.

The additional parameters EN and ENO can be configured.

FBD Representation

LD Representation

IL Representation

LD Addr_String
ADDM
ST Addr_Array

ST Representation

Addr_Array := ADDM(Addr_String);

Input Parameter Description

The following table describes the input parameter:

Parameter

Type

Comment

IN

Character string

Device address on bus or network.

The input is the concatenation of up to three elements that can take various values. Each element is optional:

Output port used locally to reach the target equipment:

Target equipment

Service to reach in the target equipment:

  • r.m.c

  • Netlink

NOTE: in the first case, the channel number c is optional

  • {hostAddr}

  • node

  • {hostAddr}node

  • SYS

  • MBS

  • SMTP

  • TCP.MBS

  • CON.CIP

  • UNC.CIP

Definitions:

  • Netlink: network name set in the Net Link field of Ethernet channel

  • hostAddr: IP address of the host we want to reach.

  • r: rack number of the communication channel

  • m: module position of the communication channel

  • c: communication channel number

  • node: Modbus or CANopen node behind a gateway (gateway identified with hostAddr)

  • SYS: for addressing the system server

  • MBS: for addressing the Modbus system server (same as SYS)

  • SMTP: for addressing the SMTP server

  • TCP.MBS: for addressing a TCP Modbus server

  • CON.CIP: for addressing a connected equipment through Ethernet/IP

  • UNC.CIP: for addressing an unconnected equipment through Ethernet/IP

NOTE: For Modicon M580 CPU, to configure a communication through the CPU Ethernet port, r=0, m=0 and c=3.

List of different use cases:

Address syntaxes

Comment

’{hostAddr}’

’{hostAddr}SYS’

’{hostAddr}TCP.MBS’

To access the hostAddr by the nearest configured Netlink from the CPU.

Example: ADDM(’{192.168.2.3}TCP.MBS’).

’Netlink{hostAddr}’

’Netlink{hostAddr}SYS’

’Netlink{hostAddr}TCP.MBS’

To access the hostAddr by the Netlink Ethernet network defined in the Control Expert Project Browser Communication > Networks.

Example: ADDM(’Ethernet_1{192.168.2.3}SYS’).

’Netlink{hostAddr}node’

To access the node behind the ’Netlink{hostAddr}’ gateway, it can be a Modbus TCP server ID or a serial Modbus slave managed by the gateway.

Example: ADDM(’Ethernet_1{192.168.2.3}255’).

’r.m.c{hostAddr}’

’r.m.c{hostAddr}SYS’

’r.m.c{hostAddr}TCP.MBS’

To access the hostAddr by giving the rack, module and channel of the Ethernet module.

Example: ADDM(’0.0.3{192.168.2.3}’).

’r.m.c{hostAddr}node’

To access the node behind the ’r.m.c{hostAddr}’ gateway, it can be a Modbus TCP server ID or a serial Modbus slave managed by the gateway.

Example: ADDM(’0.0.3{192.168.2.3}255’).

’r.m.c{hostAddr}CON.CIP’

’r.m.c{hostAddr}UNC.CIP’

To access an equipment through an Ethernet/IP network, the suffix CON.CIP is used if the Equipment is connnected (a link is still established with it) and UCN.CIP if it is not connected.

Example 1: ADDM(’0.0.3{192.168.20.34}CON.CIP’) for a Modicon M580 Ethernet CPU.

Example 2: ADDM(’0.4.0{192.168.20.34}CON.CIP’) for a Modicon M340 with a BMX NOC in the slot 4 of rack 0.

’r.m.c’

’r.m.c.SYS’

To access the channel system of a Modbus channel or to send data through a Character Mode Link.

NOTE: c= 0 or 1.

Example: ADDM(’1.5.0.SYS’).

’r.m.c.e’

’r.m.c.e.MBS’

To access the Modbus serial slave equipment server.

NOTE: c= 0 or 1, e=1 to 247.

Example: ADDM(’1.5.1.54.MBS’).

Specific case for M340 CPU with CANopen embedded:’0.0.2.e’

To access the CANopen slave e server.

NOTE: e=1 to 127.

Example: ADDM(’10.0.2.67’).

Examples with Modicon M340:

In the following examples, the third syntax element is not used:

Device to address

ADDM syntax

Device #4 on CANopen link

ADDM('0.0.2.4')

ASCII printer on CPU serial link

ADDM('0.0.0')

Device whose address is 192.168.100.10 on a NOE Ethernet link

ADDM('0.3.0{192.168.100.10}')

ADDM('Ethernet_1{192.168.100.10}')

Modbus device #4 behind Ethernet gateway whose address is 192.168.100.18 on NOE Ethernet link

ADDM('0.3.0{192.168.100.18}4')

ADDM('Ethernet_1{192.168.100.18}4')

For further information, please refer to M340 PLCs addressing overview of user manual Communication Architectures.

Output Parameter Description

The following table describes the output parameter:

Parameter

Type

Comment

OUT

ADDM_TYPE

Array of 8 integers

Array representing the address of a device. This parameter can be used as an input parameter for several communication functions.

The ADDM block analyses the addressing string syntax (parameter IN) and puts the result into an 8 single integers array which defines the destination address. The destination address can be provided either by the OUT parameter of the ADDM function or directly by an array of 8 INT objects. However, it is strongly recommended to use the ADDM function to address a communication EF.

The destination address’ structure is as follows:

Field

Size

Value

Type

Byte

Reserved.

ClientID

Byte

Reserved.

Rack

Byte

Rack slot number.

Slot

Byte

Module slot number.

Channel

Byte

Channel number.

ProtId

Byte

Reserved. 0 for Modbus.

AddrLen

Byte

This byte can have the following values:

  • value 0 if module or channel server is addressed (neither UnitId nor AddrExt is used)

  • value 1 if device number is specified

  • value >1 if AddrExt is also used

UnitId

Byte

Device number, Modbus device for example.

AddrExt

4 Integers

Reserved. It is used to encode additional address information for TCP/IP addresses.