# PLC interface

Delete distance to go, command
Description | The rising edge of the commanded value has the effect that the CNC channel is decelerated to feed velocity 0. Then a linear motion is executed to the target position of the next motion block (short cut). The command only affects motion blocks.

The functional description [FCT-C28] deals with the topic of “Delete distance to go” in detail.

Data type | MC_CONTROL_BOOL_UNIT, see description Control unit
Characteristics | See state data delete_distance_to_go_active_r. P-STUP-00033 must be configured for the channel.
Access | PLC reads request_r + state_r and writes command_w + enable_w
ST Path | gpCh[channel_idx]^.bahn_mc_control.delete_distance_to_go
Commanded, requested and return values
ST Element | .command_w .request_r .state_r (TRUE indicates that the command was detected by the CNC)
Data type | BOOL
Value range | [TRUE = distance to go to be deleted, FALSE = no impacts on motion blocks]
Redirection
ST Element | .enable_w

Delete distance to go, end marker
Description | This control unit sets the end marker defined in the NC program online to valid. A bit mask is defined for this in the NC program. If at least one single bit in the end marker is set on the NC interface, this marker is valid as a jump target.

Example:

N10 #DEL DIST2GO [END = '16#0014']

The end marker can be set to valid by bit3 (hexadecimal 4) or by bit5 (hexadecimal 0x10).

Data type | MC_CONTROL_UNS32_UNIT, see description of Control Unit
Access | PLC reads request_r + state_r and writes command_w + enable_w
ST Path | gpCh[channel_idx]^.bahn_mc_control.delete_distance_to_go_activation
Commanded, requested and return values
ST Element | .command_w .request_r .state_r
Data type | UDINT
Value range | 32-bit
Redirection
ST Element | .enable_w

Delete distance to go, state
Description | If a command is sent via the delete_distance_to_go control unit, this value is TRUE as long as the NC block which exerts a linear motion to the target position of the next motion block is executed (short cut). It also remains TRUE if the active short cut is itself shortened by a new command.

The signal is again reset when the active NC block is no longer related to the command of the delete_distance_to_go control unit.

See functional description [FCT-C28].

Signal flow | CNC → PLC
ST path | gpCh[channel_idx]^.bahn_state.delete_distance_to_go_active_r
Data type | BOOL
Value range | [TRUE = linear motion is executed to the target position of the next motion block (short cut), FALSE]
Access | PLC is reading

## Additional status information of current block

Line counter, NC program
Description | The datum indicates the NC program line which is the source of the command just processed by the interpolator. The value is derived from the number of NC program lines which the decoder has read since the NC program started. All the lines read the decoder are counted, i.e. repeatedly read lines, empty and comment lines. All commands to the interpolator resulting from decoding a NC program line are assigned to the associated line counter.
Signal flow | CNC → PLC
ST path | gpCh[channel_idx]^.bahn_state.block_count_r
Data type | UDINT
Access | PLC is reading

Block number, current path motion
Description | If the N function [PROG//N function] is used in the active NC program to program NC block numbers, this datum indicates the NC block number of the NC block currently processed in the interpolator in this datum.
Signal flow | CNC → PLC
ST path | gpCh[channel_idx]^.bahn_state.block_nr_r
Data type | UDINT
Value range | [0, MAX_UNS32]
Access | PLC is reading