FB_PN_ReadStateOfDevices

FB_PN_ReadStateOfDevices 1:

When called, the function block FB_PN_ReadDtateOfDevices returns the number of configured and missing devices and those with diagnosis information.

FB_PN_ReadStateOfDevices 2:

PROFINET RT Controller driver version

The function block is only available for PROFINET RT Controller driver version v03(v0.21) or higher.
In TwinCAT XAE, the driver version can also be found in the PROFINET RT Controller I/O device.

FB_PN_ReadStateOfDevices 3: Inputs

VAR_INPUT
  bExecute               : BOOL;
  NETID                  : T_AmsNetIdArr;
END_VAR

Name

Type

Description

bExecute

BOOL

The function block is enabled by a positive edge at this input.

NETID

T_AmsNetId

AMS Net ID of the PROFINET RT controller

FB_PN_ReadStateOfDevices 4: Outputs

VAR_OUTPUT
  bBusy                      : BOOL;
  bError                     : BOOL;
  nErrorID                   : UDINT;
  nDevices                   : UINT;
  PnIoError                  : UINT;
  PnIoDiag                   : UINT
  sControllerDriverVersion   : STRING;
END_VAR

Name

Type

Description

bBusy

BOOL

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

bError

BOOL

If an error occurs during the transmission of the command, this output is set after the bBusy output is reset.

nErrorId

UDINT

Returns an ADS error number if bError output is set.

nDevices

UINT

Number of configured devices.(max.255)

PnIoError

UINT

Number of devices with error state or diagnosis.

PnIoDiag

UINT

Number of devices with diagnosis.

sControllerDriverVersion

UINT

PROFINET controller version 03 (V00.21) or higher required.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4024.54

PC or CX (x64, x86, ARM)

Tc2_ProfinetDiag (>= v1.4.1.0)