Function Description

The READ_VAR function is used to read the value of one or more language objects:

  • internal bits,

  • internal words.

Verify that the objects to be read are consecutive. They may be located in a remote CPU or in a device connected to a communication channel.

On Modicon M340 and M580 CPU, the READ_VAR function can read up to 2,000 consecutive bits in a remote device.

On Premium PLCs, the READ_VAR function can read up to 1,000 consecutive bits in a remote device, whatever the device and the protocol used may be (Uni-Telway or Modbus/Jbus).

NOTE: For Premium PLCs only, reading over 1000 bits requires the use of the SEND_REQ function.

The additional parameters EN and ENO can be configured.

FBD Representation

Representation:

LD Representation

Representation:

IL Representation

Representation:

LD Address
READ_VAR Object_Type, First_Object, Object_Number, Management_Param, Receiving_Array

ST Representation

Representation:

READ_VAR(Address, Object_Type, First_Object, Object_Number, Management_Param, Receiving_Array);

Parameter Description

The following table describes the input parameters:

Parameter

Type

Comment

ADR

ARRAY [0..5] OF INT for Premium

ARRAY [0..7] OF INT for Modicon M340 and M580

Specific statements by hardware platforms:

  • Premium:

    • Address of the message's receiving character mode channel is given by the ADDR function.

    • Address of the destination entity of the exchange.

      The following addresses are prohibited:

      • {Network.Station}APP,

      • {Network.Station}APP.num.

  • Modicon M340:

    • Address of the message's receiving character mode channel is given by the ADDM function.

    • The syntax of the address is of ADDM ('r.m.c.node')-type.

  • Modicon M580:

    • Address of the destination entity of the read operation, result of ADDMX function.

OBJ

STRING

Type of objects to read for Premium PLC:

  • ’%M’: internal bits

  • ’%MW’: internal words

  • ’%S’: system bits

  • ’%SW’: system words

  • ’%I’: input bits

  • ’%IW’: input words

Type of objects to read for Modicon M340 and M580 CPU:

  • ’%M’: internal bits

  • ’%MW’: internal words

  • ’%I’: input bits

  • ’%IW’: input words

NUM

DINT

Index of the first object to read.

NB

INT

Number of objects to read.

The following table describes the input/output parameters:

Parameter

Type

Comment

GEST

ARRAY [0..3] OF INT

Exchange management table consisting of the following words:

  • Rank 1 word: a word managed by the system and consisting of two bytes:

    • Most significant byte: exchange number

    • Least significant byte: activity bit (rank 0) and cancel bit (rank 1)

      NOTE: The cancel bit is only available for Modicon M340 and M580 PLCs.
  • Rank 2 word: a word managed by the system and consisting of two bytes:

    • Most significant byte: operation report

    • Least significant byte: communication report

  • Rank 3 word: a word managed by the user which defines the maximum response time using a time base of 100 ms.

  • Rank 4 word: a word managed by the system which defines the length of the exchange.

For detailed information, refer to section Structure of the Management Parameters.

The following table describes the output parameters:

Parameter

Type

Comment

RECP

ARRAY [n..m] OF INT

Word table containing the value of the objects read.

NOTE: The size of the data received (in bytes) is written automatically by the system in the fourth word of the management table.

Rules of Use

Verify that object types are entered consistently. Write entries either all in lower case or all in upper case; otherwise, the function sends back a report equal to 16#06 (incorrect specific parameters).

For Micro, Premium or Atrium PLCs receiving the READ_VAR function, read-only access to internal bits has the following particularities:

  • The forcing value of the bits is returned in the response,

  • Reading 1 bit therefore comprises 2 response bytes:

    • The first contains the value of the 8 bits from the one requested.

    • The second indicates whether these bits have been forced.

  • In order to read one of the last 8 bits of the memory it is necessary to read all the last 8 bits, otherwise the function sends back a 16#01 operation report. This last particularity also applies to Modicon M340 and M580 PLCs.

NOTE: Verify that space for the forcing indication bytes are provided for in the receive table; otherwise, a 16#03 detected error code is sent back in the report.
NOTE: For Modicon M340/M580 PLCs, forced bits are not accessed by READ_VAR and WRITE_VAR functions, since Modbus protocol does not support it.

Simultaneous Transactions

The following table gives the capacities of each communication channel to simultaneously process transactions according to various configurations on Micro and Premium PLCs.

Configuration

Micro

TSX 57 10

TSX 57 20

TSX 57 23/30/40/45/55, PCX 57, PMX 57

TSX 57 46/56

Uni-Telway master terminal port

4

4

4

4

8

Uni-Telway master PCMCIA or SCY link

1

8

8

8

8

Uni-Telway client slave terminal port

4

1

1

1

8

Uni-Telway client slave PCMCIA or SCY link

1

1

1

1

1

Uni-Telway server slave terminal port

4

4

4

4

4

Uni-Telway server slave PCMCIA or SCY link

4

6

6

6

6

Modbus terminal port

4

-

-

-

-

Modbus PCMCIA or SCY link

4

8

8

8

8

Character mode terminal block

1

1

1

1

1

Character mode PCMCIA or SCY link

4

8

8

8

8

CANopen PCMCIA

-

10

10

10

10

Fipway PCMCIA or SCY link

4

8

8

8

8

Modbus Plus

4

4

4

4

4

Ethernet

-

16

16

16

16

Embedded Ethernet

-

-

-

-

64

Capacities of each communication channel to simultaneously process transactions according to various configurations on Modicon M340 PLCs:

Configuration

BMX P34 1000

BMX P34 2000

BMX P34 2010/20102

BMX P34 2020

BMX P34 2030/ 20302

Embedded CANopen

-

-

16

-

16

Embedded Ethernet

-

-

-

16

16

Modbus master serial port

8

16

16

16

-

Maximum number of requests as client per scan on standalone M580 CPUs:

Configuration

CPU Reference (BME P58 ...)

10•0

20•0

30•0

40•0

5040

6040

Ethernet

16

32

48

80

80

96

Maximum number of requests as client per scan on Hot Standby M580 CPUs:

Configuration

CPU Reference (BME H58 ...)

2040

4040

6040

Ethernet

32

80

96

Maximum number of requests served per scan on standalone M580 CPUs:

Configuration

CPU Reference (BME P58 ...)

10•0

20•0

30•0

40•0

5040

6040

CPU from all origin (1.)

16

24

32

40

48

64

Embedded Ethernet

8

12

16

24 (2.)

32

32

USB

4

4

4

4

4

4

1. %SW90 system word allows to adjust the number of requests served per cycle. The minimum number of requests served per cycle is set to 2 in order to reduce the CPU jitter.

2. Maximum number of requests is 16 for M580 CPU BME P58 40•0 with firmware version ≤ 1.20.

Maximum number of requests served per scan on Hot Standby M580 CPUs:

Configuration

CPU Reference (BME H58 ...)

2040

4040

6040

CPU from all origin (1.)

24

40

64

Embedded Ethernet

12

24

32

USB

4

4

4

1. %SW90 system word allows to adjust the number of requests served per cycle. The minimum number of requests served per cycle is set to 2 in order to reduce the CPU jitter.

NOTE: Verify that the maximum number of simultaneous requests given in all tables takes into account the maximum number of simultaneous requests that each CPU can manage per cycle, as Client and as Server.