FB_NciFeedTablePreparation

FB_NciFeedTablePreparation 1:

The function block FB_NciFeedTablePreparation appends an entry of a specific type to the feed table (stFeedGropupTable). 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.

Interface

VAR_INPUT
nEntryType       : E_NciEntryType;
pEntry           : POINTER TO UDINT;
bResetTable      : BOOL;
bResetAll        : BOOL;
END_VAR
VAR_IN_OUT
stFeedGroupTable : ST_NciFeedGroupTable
END_VAR
VAR_OUTPUT
nFilledRows      : INT;
bError           : BOOL;
nErrorId         : UDINT;
END_VAR
VAR_INPUT

Input

Data type

Description

nEntryType

E_NciEntryType

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

pEntry

POINTER

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.

VAR_IN_OUT

Input/output

Data type

Description

stFeedGroupTable

ST_NciFeedGroupTable

Table containing the rows for the NC kernel.

VAR_OUTPUT

Output

Data 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 2:

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 System

PLC Libraries to include

TwinCAT v2.10.0

PC (i386)

TcPlcInterpolation.lib