F_iecGetAOTimeTag

F_iecGetAOTimeTag 1:

This function can be used to read the current timestamp of the application object in a byte buffer.

Syntax

FUNCTION F_iecGetAOTimeTag: UDINT
VAR_INPUT
    pDest   : PVOID;
    cbDest  : UDINT;
END_VAR
VAR_IN_OUT
    dbEntry : ST_IEC870_5_101AODBEntry;
END_VAR

F_iecGetAOTimeTag 2: Inputs

pDest: Target buffer address.

cbDest: Byte size of the target buffer.

Inputs/outputs

dbEntry: Application object whose timestamp is to be read.

F_iecGetAOTimeTag 3: Return value

Return parameter

Meaning

0

Error; the application object has no timestamp.

<> 0

Number of successfully copied timestamp data bytes. The CP24Time2a timestamp format has 3 bytes, for example, the CP56Time2a timestamp format has 7 bytes.

Sample in ST

PROGRAM P_iecGetAOTimeTag
VAR_IN_OUT
    AODB     : ARRAY[1..MAX_TABLE_IDX] OF ST_IEC870_5_101AODBEntry;
END_VAR
VAR
    bGet     : BOOL := TRUE;
    index    : DINT;
    cbTagSize: UDINT;
    tTag     : T_CP56Time2a;
END_VAR
IF bGet THEN
    bGet    := FALSE;
    
    FOR index := 1 TO MAX_TABLE_IDX BY 1 DO
        cbTagSize := F_iecGetAOTimeTag ( ADR( tTag ), SIZEOF( tTag ), AODB[index] );
    END_FOR
END_IF

Requirements

Development environment

Target system type

PLC libraries to be linked (category group)

TwinCAT v3.1.4012.0

PC oder CX (x86, x64, Arm®)

Tc2_IEC60870_5_10x (Communication->IEC60870)
Tc2_SerialCom (Communication->Serial)
Tc2_TcpIp (Communication->TcpIp)
Tc2_Utilities (System)