ConvertPathPosToDcTime

Under construction...

ConvertPathPosToDcTime 1:

This function block converts an NC axis position into an associated 32-bit Distributed Clock System Time (i.e. the time at which this NC axis position was or will be reached exactly).

VAR_INPUT

VAR_INPUT
    nGrpId      : UDINT;
    nSubIdx     : UDINT;
    fPosition   : LREAL;
END_VAR

nGrpId

Group ID of the corresponding Nci channel

nSubIdx

This 32-bit input value contains two different items of information and is therefore divided into two 16-bit values:
The LowWord (the least significant 16 bits) contains the subindex for relative addressing of an encoder subelement at an axis. The subindex is counted upwards from zero. For the typical case of an axis with exactly one encoder the null subindex is correct.
The HighWord (the most significant 16 bits) contains a control word (bit mask) that influences the type of position calculation (e.g. the interpolation or extrapolation type).
The bit mask 0x0001 means that the set acceleration of the axis is to be included in the calculation.
Bit mask 0x0010 means that the calculation is relative and is currently mandatory. Otherwise the call is rejected with an error.

fPosition

Relative Nci path distance that is converted to the corresponding 32-bit distributed clock system time (T_DCTIME32).
If the DC system time associated with the relative Nci path distance is outside the expected timeframe of ± 2.147 seconds, this conversion is rejected with an error number.

 

VAR_OUTPUT

VAR_OUTPUT
    dcTime  : T_DCTIME32;(* 32 bit distributed clock time *)
    iErr    : UDINT;
END_VAR

dcTime

Supplies the 32 bit Distributed Clock System Time (T_DCTIME32) associated with the input fPosition.

iErr

Supplies an error number if an error occurs, e.g.
- error 0x4012: axis ID is not allowed, or axis is not present in the system,
- error 0x4361: time window exceeded (future),
- error 0x4362: time window exceeded (past),
- error 0x4363: position cannot be found mathematically.

Requirements

Development Environment

Target System

PLC Libraries to include

TwinCAT v2.11.0 Build > 2214 or higher

PC or CX (x86, ARM)

TcEtherCAT.Lib
( Standard.Lib; TcBase.Lib; TcSystem.Lib, TcUtilities.Lib are included automatically )