L_IPAP_ParameterRead

The L_IPAP_ParameterRead function block serves to read the device and PLC parameters of the Lenze Controller by the PLC application.

L_IPAP_ParameterRead

BOOL

-

xExecute

xDone

-

BOOL

BOOL

-

xAbort

xBusy

-

BOOL

WORD

-

wIndex

xAborted

-

BOOL

BYTE

-

bySubIndex

xError

-

BOOL

UDINT

-

udiTimeOut

eErrorId

-

L_IPAP_ERRORID

POINTER TO BYTE

-

pDataBuffer

udiDataRead

-

UDINT

UDINT

-

udiBufferSize

eDataType

-

L_IPAP_DATATYPE

Inputs

Name

Datentyp

Value / meaning

xExecute

BOOL

FALSE ä TRUE

With the rising edge of the xExecute input, the read request of a parameter is started.

xAbort

BOOL

FALSE ä TRUE

Abort processing of the FB

wIndex

WORD

Index of the parameter to be read

bySubIndex

BYTE

Subindex in the object directory of the master or the slaves.

udiTimeOut

UDINT

Timeout in milliseconds [ms]

  • The value '0' corresponds to a request without timeout.

pDataBuffer

POINTER TO BYTE

Reference to the memory buffer into which the values to be read are to be copied.

udiBufferSize

UDINT

Size of the memory buffer passed under pDataBuffer .

  • The memory buffer must be large enough to hold the read value.

Outputs

Name

Datentyp

Value / meaning

xDone

BOOL

TRUE

Processing is completed

xBusy

BOOL

TRUE

Processing is running

xAborted

BOOL

TRUE

Processing of the FB has been aborted.

xError

BOOL

TRUE

An error has occurred. For details see eErrorID .

eErrorId

L_IPAP_ERRORID

If xError = TRUE: Error number for the error that has occurred.

udiDataRead

UDINT

Number of bytes actually read during the read request

eDataType

L_IPAP_DATATYPE

Indication of the data type of the read parameter

Application examples

Read parameter 0x2001:000 “Device name” (data type: STRING)

PROGRAM PLC_PRG

VAR

  • fbParameterRead : L_IPAP_ParameterRead;

  • read : BOOL;

  • index : WORD;

  • subindex : BYTE;

  • abyDeviceName : ARRAY [0..127] OF BYTE;

END_VAR

(* read device name *)

// index can be set as hexadecimal- or as decimal value

index := 16#2001; //or: index := 8193

subindex := 0;

fbParameterRead(

  • xExecute := read,

  • wIndex := index,

  • bySubIndex := subindex,

  • pDataBuffer := ADR(abyDeviceName),

  • udiBufferSize := SIZEOF(abyDeviceName)

);

Read parameter 0x2452:001 “Active eng. port settings: IP address” (data type: UDINT)

PROGRAM PLC_PRG

VAR

  • fbParameterRead : L_IPAP_ParameterRead;

  • read : BOOL;

  • udiIPaddr : UDINT;

  • abyIPaddr : ARRAY [0..3] OF BYTE;

END_VAR

(* read IP address to UDINT value*)

fbParameterRead(

  • xExecute := read,

  • wIndex := 16#2452,

  • bySubIndex := 1,

  • pDataBuffer := ADR(udiIPaddr),

  • udiBufferSize := SIZEOF(udiIPaddr));

);

(* or read IP address to array of 4 BYTES*)

fbParameterRead( xExecute := read,

  • wIndex := 16#2452,

  • bySubIndex := 1,

  • pDataBuffer := ADR(abyIPaddr),

  • udiBufferSize := SIZEOF(abyIPaddr)

);