FUNCTION_BLOCK FB_PN_IM4_READ

FUNCTION_BLOCK FB_PN_IM4_READ 1:
FUNCTION_BLOCK FB_PN_IM4_READ

Using this function block the PROFINET controller reads all I&M4 data (Identification & Maintenance) from a device referenced via the Port input.
The frame structure of the I&M4 function corresponds to the index 0xAFF4 according to PROFINET standard.

VAR_INPUT

VAR_INPUT
    bStart  : BOOL;
    NETID   : T_AmsNetId;(* AMS Net ID from Controller *)
    PORT    : T_AmsPort; (* Port used by Controller to communicate with Device *)
END_VAR

bStart: The function block is activated by a positive edge at this input

NETID: AMS Net ID of the controller

PORT: Port via which the controller communicates with the device (port = Device ID + 1000 hex)

VAR_OUTPUT

VAR_OUTPUT
    bBusy       : BOOL;
    st_IM_Signatur  : STRING(54);
    bError      : BOOL;
    iErrorID        : UDINT;
END_VAR

bBusy: When the function block is activated this output is set. It remains set until a feedback is received. While Busy = TRUE, no new command will be accepted at the inputs.

st_IM_Signatur: Returns the manufacturer signature stored for the device.

bError: In the event of an error during the command transfer, this output is set once the bBusy output has been reset.

iErrorID: Supplies an ADS error number when the output bError is set.

Development environment

Target platform

PLC libraries to be linked

TwinCAT v2.11.0 R3

PC or CX (x86, ARM)

TcProfinetDiag.Lib