Ja, POS ist als Byte definiert, hier die Deklaration:
VAR_INPUT
POS, ANG : BYTE;
S1, S2 : BOOL;
IN : BOOL;
PI, AI : BYTE;
END_VAR
VAR_INPUT
SINGLE_SWITCH : BOOL;
CLICK_EN : BOOL := TRUE;
CLICK_TIME : TIME := T#500ms;
MAX_RUNTIME : TIME := T#60s;
PositionReachedDelay : TIME := t#3s; (*1.8*)
MANUAL_TIMEOUT: TIME := T#1h;
DEBOUNCE_TIME : TIME := T#20ms;
DBL_CLK1 : BOOL := FALSE;
DBL_POS1 : BYTE;
DBL_ANG1 : BYTE;
DBL_CLK2 : BOOL := FALSE;
DBL_POS2 : BYTE := 255;
DBL_ANG2 : BYTE := 255;
D1_TOGGLE : BOOL := TRUE;
D2_TOGGLE : BOOL := TRUE;
MASTER_MODE : BOOL;
END_VAR
VAR_OUTPUT
QU : BOOL := TRUE;
QD : BOOL := TRUE;
STATUS : BYTE;
PO : BYTE := 255;
AO : BYTE := 255;
D1, D2 : BOOL;
END_VAR
VAR
s1e, s2e : TOF;
s1d, s2d : CLICK_MODE;
dir : BOOL;
tx: TIME;
last: TIME;
TimePositionReached: TIME; (*1.8*)
END_VAR
VAR_TEMP
TOP_SI: STRUCT
EV_CLASS: BYTE;
EV_NUM: BYTE;
PRIORITY: BYTE;
NUM: BYTE;
TYP2_3: BYTE;
TYP1: BYTE;
ZI1: WORD;
ZI2_3: DWORD;
END_STRUCT;
START_UP_SI: STRUCT
EV_CLASS: BYTE;
EV_NUM: BYTE;
PRIORITY: BYTE;
NUM: BYTE;
TYP2_3: BYTE;
TYP1: BYTE;
ZI1: WORD;
ZI2_3: DWORD;
END_STRUCT;
ERR : INT;
END_VAR
Die Fehlermeldung bleibt trotz POS < BYTE#255 die gleiche:
1. unzulässige Operandentypen, 2. Der Ausdruck muss vom Datentyp Bool sein. Der Code sieht so aus:
134: (* manual operation single click up *)
QU := TRUE;
QD := FALSE;
PO := POS; AO := ANG;
//IF tx - last >= max_runtime THEN status := 131; END_IF; (*1.8*)
IF POS < BYTE#255 THEN TimePositionReached := tx; END_IF; (*1.8*)
IF tx - last >= max_runtime OR tx - TimePositionReached >= PositionReachedDelay THEN status := 131; END_IF; (*1.8*)
135: (* manual operation single click dn *)
QU := FALSE;
QD := TRUE;
PO := POS; AO := ANG;
//IF tx - last >= max_runtime THEN status := 131; END_IF; (*1.8*)
IF POS > BYTE#0 THEN TimePositionReached := tx; END_IF; (*1.8*)
IF tx - last >= max_runtime OR tx - TimePositionReached >= PositionReachedDelay THEN status := 131; END_IF; (*1.8*)