FB_NciFeedTablePreparation

FB_NciFeedTablePreparation 1:

The function block FB_NciFeedTablePreparation appends an entry of a specific type to the feed table (stFeedGroupTable). An appended entry can generate more than one row in the table. If the table has not enough free rows, an error is returned and no entry is added to the table. In this case the entry either has to be added to another table or to the same table, after FB_NciFeedTable was executed. This function block deals with modal functions, such as tangential following. It is therefore important to always use the same instance of this function block. The function block can be called repeatedly in a PLC cycle.

FB_NciFeedTablePreparation 2: Inputs

VAR_INPUT
    nEntryType       : E_NciEntryType;
    pEntry           : POINTER TO ST_NciGeoLine;
    bResetTable      : BOOL;
    bResetAll        : BOOL;
END_VAR

Name

Type

Description

nEntryType

E_NciEntryType

Specifies the entry type, e.g. line, circle, tangential following.

pEntry

POINTER TO ST_NciGeoLine

Pointer to entry structure – must match nEntryType.

bResetTable

BOOL

If bResetTable is TRUE, the table 'stFeedGroupTable' is set to zero and nFilledRows is also set to zero. If nErrorId = ErrNciFeedTableFull, this error is reset. All modal flags (such as tangential following) remain constant.

bResetAll

BOOL

Like bResetTable. In addition, all modal flags are set to their default values, and all error IDs are reset.

FB_NciFeedTablePreparation 3:/FB_NciFeedTablePreparation 4: Inputs/Outputs

VAR_IN_OUT
    stFeedGroupTable : ST_NciFeedGroupTable;
END_VAR

Name

Type

Description

stFeedGroupTable

ST_NciFeedGroupTable

Table containing the rows for the NC kernel.

FB_NciFeedTablePreparation 5: Outputs

VAR_OUTPUT
    nFilledRows      : INT;
    bError           : BOOL;
    nErrorId         : UDINT;
END_VAR

Name

Type

Description

nFilledRows

INT

Number of filled rows

bError

BOOL

Becomes TRUE as soon as an error has occurred.

nErrorId

UDINT

Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs. The error numbers in ErrId can be looked up in the ADS error documentation or in the NC error documentation (error codes above 0x4000).

FB_NciFeedTablePreparation 6:
  • If bResetTable, bResetAll, or bError is true, no further entries are accepted.
  • The error code 0x4B72 indicates that the table is full and the last entry was not accepted.

Sample:

stGeoLine.nDisplayIndex := 1;
stGeoLine.fEndPosX := 0;
stGeoLine.fEndPosY := 400;
stGeoLine.fEndPosZ := 100;
stGeoLine.fEndPosQ1 :=-90;
stGeoLine.fVelo := 1000; (*mm per sec*)

fbFeedTablePrep(
    nEntryType := E_NciEntryTypeGeoLine,
    pEntry := ADR(stGeoLine),
    bResetTable:= FALSE,
    stFeedGroupTable:= stNciFeedGroupTable,
    nFilledRows=> nFilledRows,
    bError => bError,
    nErrorId => nErrorId);

Requirements

Development environment

Target platform

PLC libraries to be linked

TwinCAT v3.1.0

PC or CX (x86 or x64)

Tc2_PlcInterpolation