Cyclical Channel Interface

The channel interface is responsible for the cyclic data exchange between the PLC and the NCI.

Cyclical Channel Interface 1:

The NC input/output variable names can sometimes differ from the PLC input/output variable names. However, this is not really significant. This description relates to the naming in the PLC.

From the NCI to the PLC (150 bytes)

TYPE NciChannelToPlc :
STRUCT
nJobNo             : DWORD;
nFastMFuncMask     : ARRAY[1..5] OF DWORD; (* Mask to evaluate fast M-unctions *)
nHskMFuncNo        : WORD; (* evaluate M-function with handshake *)
nHskMFuncReq       : WORD;
nHFuncValue        : DINT;
nSpindleRpm        : WORD;
nTool              : WORD;
nReserved1         : ARRAY[37..132] OF BYTE;
nLoadedProg        : DWORD; (* loaded program number if exist *)
nItpMode           : WORD; (* Interpreter mode *)
nItpState          : WORD; (* Interpreter status *)
nItpErrCode        : WORD; (* Interpreter-Channel Error Code *)
nReserved2         : ARRAY[143..150] OF BYTE;
END_STRUCT
END_TYPE

Variable name

Data type

Description

nJobNo

DWORD

Job number

nFastMFuncMask

ARRAY OF DWORD

Bit mask for evaluation of the fast M-functions

nHskMFuncNo

WORD

Number of synchronous M-function present (M-function with handshake)

nHskMFuncReq

WORD

Flag indicating that a synchronous M-function is present
0: no synchronous M-function is present
1: a synchronous M-function is present

nHFuncValue

DINT

Value of the auxiliary function

nSpindleRpm

WORD

Spindle rotation speed

nTool

WORD

Tool number

nLoadedProg

DWORD

Name of the NC program presently being executed. If the name is not a DWORD, this value is 0.

nItpOpMode

WORD

Bit mask that indicates execution in interpreter mode.

nItpState

WORD

Interpreter state

nItpErrorCode

WORD

Error code of the interpreter channel

The above structure contains some reserved areas. Some of these areas are used in newer TwinCAT versions. On the PLC side the structure was not renamed, so that relevant data can be read with the PLC function.

NCI to PLC (structure from NC perspective)

Variable name

Data type

Description

mJobNr

 

see table above nJobNo

mDWORD

 

see table above nFastMFuncMask

sHandshake.nFunc

 

see table above nHskMFuncNo

sHandshake.nRequested

 

see table above nHskMFuncReq

sHandshake.nHFuncValue

 

see table above nHFuncValue

sHandshake.nSpindelRPM

 

see table above nSpindleRpm

sHandshake.nTool

 

see table above nTool

nChnState

DWORD

 

nChnState.bIsEStopRequested

Bit 8 (zero based)

Indicates that an ItpEStop was called, without checking whether the axes are already at standstill.

nChnState.bIsFeedFromBackupList

Bit 10 (zero based)

For retracing the current entries from the interpreter backup list are sent

nChnState.bIsMovingBackward

Bit 11 (zero based)

Indicates that the current motion is a backward movement (from TC 2.11 Build 1550)

nParams

Array of DWORD

Data of the freely configurable channel interface (see ItpSetCyclicUDintOffsets)

fParams

Array of LREAL

Data of the freely configurable channel interface (see ItpSetCyclicLrealOffsets)

mProgNr

 

see table above nLoadedProg

mItpOpMode

 

see table above nItpOpMode

mItpOpState

 

see table above nItpState

mErrorCode

 

see table above nItpErrorCode

nChnId

WORD

Channel ID

nGrpId

WORD

Group ID

nItfVersion

WORD

Version of this cyclic channel interface

From PLC to NCI (150 bytes)

TYPE NciChannelFromPlc :
STRUCT
nSkipLine          : WORD; (* Mask to skip lines *)
nItpMode           : WORD;
nMFuncGranted      : WORD; (* granted signal of the M-function *)
nReserved1         : ARRAY[7..14] OF BYTE;
nChaAxesOvr        : DWORD; (* Channel override in percent * 100 *)
nChaSpindleOvr     : DWORD;
nReserved2         : ARRAY[23..150] OF BYTE;
END_STRUCT
END_TYPE

Variable name

Data type

Description

nSkipLine

WORD

Bit mask with which block skipping of the NCI is parameterized from the PLC.

nItpMode

WORD

Bit mask with which the interpreter execution mode can be altered. This is, for instance, required if the interpreter is to operate in single block mode.

nMFuncGranted

WORD

Flag with which an M-function of type 'Handshake' is acknowledged
0: not acknowledged
1: acknowledgement

nChaAxesOvr

DWORD

Channel override for the axes from 0...1000000 (corresponds to 0 - 100%)

nChaSpindleOvr

DWORD

Channel override for the spindle from 0...1000000 (corresponds to 0 - 100%)