ConvertDcTimeToPathPos

ConvertDcTimeToPathPos 1:

This function block converts a 32-bit distributed clock system time variable of type T_DCTIME32 to a relative Nci path distance on the contour of the currently active Nci program (i.e. the function block returns a positive or negative relative interval, depending on the timing).

ConvertDcTimeToPathPos 2: Inputs

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

Name

Type

Description

nGrpId

UDINT

Group ID of the corresponding Nci channel

nSubIdx

UDINT

This 32-bit input variable 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).
    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.

dcTime

T_DCTIME32

32-bit "Distributed Clock System Time" variable. This input variable is converted to the corresponding relative Nci path distance on the contour.

ConvertDcTimeToPathPos 3:

The 32-bit time may only be used in the narrow range of ± 2,147 seconds around the current system time, to ensure that it is unambiguous. Within the function block this prerequisite cannot be checked.

ConvertDcTimeToPathPos 4: Outputs

VAR_OUTPUT
    fPosition : LREAL;
    iErr      : UDINT;
END_VAR

Name

Type

Description

fPosition 

LREAL

Returns the relative Nci path distance on the contour that corresponds to the dcTime.

iErr

UDINT

Returns an error number in the event of an error

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_EtherCAT