FB_PN_ALARM_DIAG

The function block FB_PN_ALARM_DIAG can be used to read out diagnosis alarms. Each instance of this function block provides a PLC input ("PnIoBoxDiag"). This input must be linked to the "PnIoBoxDiag" input of the device to be evaluated. Once the diagnosis alarms/warnings have been successfully read, the alarm state of the device is reset. The function block must be called once for each PROFINET device. A run index (iNrAlarms) indicates how many diagnosis alarms have been read from the buffer.
Inputs
VAR_INPUT
bEnable : BOOL;
NETID : T_AmsNetId;
PORT : T_AmsPort;
END_VAR
Name | Type | Description |
---|---|---|
bEnable | BOOL | Enabling the function block. |
NETID | T_AmsNetId | AMS Net ID of the controller |
PORT | T_AmsPort | Port via which the controller communicates with the device (port = Device ID + 1000hex). |
Outputs
VAR_OUTPUT
bBusy : BOOL;
stAlarmDiagData : ST_PN_AlarmDiagData;
bError : BOOL;
iErrorID : UDINT;
iNrAlarms : INT;
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. |
stAlarmDiagData | Diagnostic messages are output via this structure. An alarm is output via the structure in each cycle as long as the status bit [0x0010 = at least one AlarmCR got a diagnosis alarm] is present at the PLC input. | |
bError | BOOL | If an error occurs during the transmission of the command, this output is set after the bBusy output is reset. |
iErrorID | UDINT | Returns an ADS error number if bError output is set. |
iNrAlarms | INT | Number of alarms last read. |
VAR
VAR
PnIoBoxDiag AT %I* : WORD; (*Hardware Input*)
END_VAR
Name | Type | Description |
---|---|---|
PnIoBoxDiag | WORD | Hardware input. This variable must be linked to the PROFINET device. A change in the state of this variable informs the PLC program that new alarm diagnoses are pending in the linked PROFINET device. |

Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.1.4018 | PC or CX (x64, x86, ARM) | Tc2_ProfinetDiag |