SCL Fehlermeldung: "Baustein nicht korrekt"

dinner4one

Level-1
Beiträge
44
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
Hallo,

habe folgenden Source geschrieben und bekomme immer o.g. Meldung...
Code:
FUNCTION FIND_SETPOINT: VOID
VAR_INPUT
    ENBL_STEP : BOOL;
    SETP : REAL;
    SETP_ACT :REAL;
    STEP : REAL;
END_VAR
VAR_OUTPUT
    OUT_SETP : REAL;
    SETP_OK : BOOL;
END_VAR   
LABEL
  ENDE;
END_LABEL
BEGIN
//Init
//------------------------------------------------------------------------------
OUT_SETP := SETP;
SETP_OK := TRUE;
IF NOT ENBL_STEP THEN
    GOTO ENDE;
END_IF;
SETP_OK := FALSE;
//Programm
//------------------------------------------------------------------------------
IF SETP_ACT > SETP THEN
    OUT_SETP := SETP_ACT - STEP;
    IF OUT_SETP < SETP THEN
        OUT_SETP := SETP;
        SETP_OK := TRUE;
    END_IF;
ELSIF SETP_ACT < SETP THEN
    OUT_SETP := SETP_ACT + STEP;
    IF OUT_SETP > SETP THEN
        OUT_SETP := SETP;
        SETP_OK := TRUE;
    END_IF;
ELSIF SETP_ACT = SETP THEN
    OUT_SETP := SETP;
    SETP_OK := TRUE;
END_IF;
ENDE:
END_FUNCTION
Kommt der Compiler nicht mit dem Sprung klar??

Gruß d40
 
... du brauchst nur statt "Ende:" schreiben "Ende: ;" ... dann funktioniert es ...

--- im Programm - nicht in der Definition ---
 
Streiche GOTO ENDE, setze RETURN.
Dann sparst Du Dir den GOTO-Befehl.

Oder noch besser so:

Code:
SETP_OK := FALSE;
//Programm
//------------------------------------------------------------------------------
IF ENBL_STEP THEN
 IF SETP_ACT > SETP THEN
    OUT_SETP := SETP_ACT - STEP;
    IF OUT_SETP < SETP THEN
        OUT_SETP := SETP;
        SETP_OK := TRUE;
    END_IF;
 ELSIF SETP_ACT < SETP THEN
    OUT_SETP := SETP_ACT + STEP;
    IF OUT_SETP > SETP THEN
        OUT_SETP := SETP;
        SETP_OK := TRUE;
    END_IF;
 ELSIF SETP_ACT = SETP THEN
    OUT_SETP := SETP;
    SETP_OK := TRUE;
 END_IF;
END_IF;
 
Zurück
Oben