ConvertDcTimeToPos

ConvertDcTimeToPos 1:

This function block converts a 32 bit Distributed Clock System Time into an associated NC axis position (i.e. the axis position that was – or will be – present at exactly that time).

VAR_INPUT

VAR_INPUT
    nAxisId : UDINT;
    nSubIdx : UDINT;
    dcTime  : T_DCTIME32;(* 32 bit distributed clock time *)
END_VAR

nAxisId

ID of the NC axis.

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 that has just one encoder, the null subindex is correct.
The HighWord (the most significant 16 bits) contains a control word (bit mask) that affects the way in which the position is calculated (e.g. the type of interpolation or extrapolation). A bit mask value of 0x0001 means that the set acceleration of the axis is to be included in the calculation.

dcTime

32-bit distributed clock system time (T_DCTIME32). This input value is converted into the corresponding NC axis position.
This 32-bit time may only be used in the close time range of ± 2.147 seconds around the current system time, as it is only unique here. This requirement cannot be checked within the FB.

 

VAR_OUTPUT

VAR_OUTPUT
    fPosition   : LREAL;
    iErr        : UDINT;
END_VAR

fPosition

Supplies the NC axis position corresponding to dcTime. This is an NC axis position that has been scaled and provided with an offset, having, for instance, physical units of degrees or of millimetres.

iErr

Returns the error number if an error occurs, e.g. error 0x4012 (axis ID is not allowed, or axis does not exist within the system).

Requirements

Development Environment

Target System

PLC Libraries to include

TwinCAT v2.11.0 Build >= 1524 or higher

PC or CX (x86, ARM)

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