ConvertPosToDcTime

ConvertPosToDcTime 1:

This function block converts an NC axis position to a corresponding 32-bit distributed clock system time variable of type T_DCTIME32 (i.e. the time which precisely this NC axis position was or will be reached).

ConvertPosToDcTime 2: Inputs

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

Name

Type

Description

nAxisId 

UDINT

ID of the NC axis

nSubIdx 

UDINT

This 32-bit input magnitude is composed of two different items of information, and is 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.

fPosition

LREAL

NC axis position that is converted to the corresponding 32-bit "Distributed Clock System Time" variable.
If the "Distributed Clock System Time" associated with the position is outside the expected time window of ± 2.147 seconds, this conversion is rejected with an error number.

ConvertPosToDcTime 3: Outputs

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

Name

Type

Description

dcTime 

T_DCTIME32

Returns the 32-bit "Distributed Clock System Time" variable that corresponds to input fPosition.

iErr 

UDINT

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 range exceeded (future)
  • Error 0x4362: time range exceeded (past)
  • Error 0x4363: position cannot be determined mathematically.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_EtherCAT