ReadMemory

Library: IODrvEtherCAT

This function block is for reading the memory of EtherCAT Slaves.

Inputs

Name

Data type

Description

xExecute

BOOL

Rising edge: Starts the reading.

Falling edge: Resets outputs.

If a falling edge occurs before the function block has completed the command, the outputs continue working normally. They are reset only if the command has either been fully executed or aborted (xAbort) or if an error occurs. In this case the corresponding output values (xDone, xError, iError) are present at the output for precisely one cycle.

xAbort

BOOL

TRUE: Command is immediately aborted and all outputs are set to their initial values.

usiCom

USINT

Index number of the EtherCAT master (1 for the first master…)

wSlaveAddress

WORD

Automatically increased address or physical address of the device.

xAutoIncAdr

BOOL

Flag for interpretation of the address

xBroadcast

BOOL

Flag indicating whether broadcast reading is to be used.

TRUE: wSlaveAddress and bAutoIncAdr are not used

uiMemOffset

UINT

Offset of the memory in the EtherCAT slave memory image

iSize

INT

Number of bytes to be read.

pDest

POINTER OF BYTE

Buffer for the storage of the data

udiTimeOut

IDINT

Watchdog time for the command in ms

Outputs

Name

Data type

Description

xDone

BOOL

TRUE: Reading was completed without error.

xBusy

BOOL

TRUE: Reading is not yet completed.

xError

BOOL

TRUE: An error occurred during reading; the function block aborts the command.

xAborted

BOOL

TRUE: Command was aborted by the user.

Example: reading the register 0x130 (current status)

PROGRAM PLC_PRG
VAR
        etcreadmemory : ReadMemory;
        wStatus : WORD;
        xRead : BOOL;
END_VAR

etcreadmemory(xExecute := xRead, usiCom:=1, wSlaveAddress := 1002,
                        xAutoIncAdr := FALSE, xBroadcast := FALSE, uiMemOffset := 16#130,
                        iSize := 2, pDest := ADR(wStatus), udiTimeout := 500);

See also: