FB_VN_InitializeFunction

FB_VN_InitializeFunction 1:

This FB initializes selected functions. Before, it needs to initialize itself, i.e. call the FB until the output bInitialized is true before using it for function initialization.

Syntax

Definition:

FUNCTION_BLOCK FB_VN_InitializeFunction
VAR_INPUT
    eFunction : ETcVnInitializableFunction;
    nOptions  : ULINT;
    bStart    : BOOL;
    nTimeout  : TIME;
END_VAR
VAR_OUTPUT
    bBusy     : BOOL;
    bError    : BOOL;
    nErrorId  : UDINT;
END_VAR

FB_VN_InitializeFunction 2: Inputs

Name

Type

Default

Description

eFunction

ETcVnInitializableFunction

 

Selects the function to initialize

nOptions

ULINT

0

Selects initialization options for the function

bStart

BOOL

 

Function initialization is triggered by a rising edge at this input.

nTimeout

TIME

VISION_ADS_TIMEOUT

Indicates the time before the function is cancelled.

FB_VN_InitializeFunction 3: Outputs

Name

Type

Description

bBusy

BOOL

This output remains TRUE until the function block has executed a command, but at the longest for the duration supplied to the 'nTimeout' input. While bBusy = TRUE, no new command will be accepted at the inputs.

bError

BOOL

This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in ‘nErrorId’. If the function block has a timeout error, 'bError' is TRUE and 'nErrorId' is 1861 (hexadecimal 0x745). Is reset to FALSE by the execution of a command at the inputs.

nErrorId

UDINT

Contains the ADS error code or the command-specific error code of the last executed command. Is reset to 0 by the execution of a command at the inputs.

Weiterführende Informationen

Der Funktionsblock FB_VN_InitializeFunction initialisiert die unter eFunction angegebene Funktion. Im Hintergrund werden die benötigten Daten asynchron in die SPS geladen.

Parameter

Einige Parameter sind zentral im Kapitel File Access Parameter beschrieben. Abweichend von der Beschreibung muss bei diesem Funktionsblock die zu initialisierende Funktion anstatt eines Dateipfads angegeben werden.

Funktion

Die zu initialisierende eFunction.

Optionen

Auswahl der Initialisierungsoptionen nOptions für die angegebene Funktion. Die möglichen Enum-Optionen sind in der Beschreibung der zu initialisierenden Funktion zu finden. Die Optionen können mit einem OR verkettet und so mit einem Aufruf des Funktionsblocks geladen werden.

Anwendung

Die Initialisierung der OCR-Funktion mit der Option zur Klassifizierung von Großbuchstaben sieht z. B. so aus:

fbInitOCR(
    eFunction   := TCVN_IF_OCR,
    nOptions    := ETcVnOcrModelType.TCVN_OMT_UCLETTERS,
    bStart      := TRUE,
    nTimeout    := T#500MS);

IF NOT fbInitOCR.bBusy AND NOT fbInitOCR.bError THEN
    // The function is initialized and can be used with the specified options
END_IF

Verwandte Funktionen

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1. 4024.44 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision