VAR_INPUT
// Eingangsparameter
Winkel: REAL; // Aktueller Drehwinkel
N0 : REAL; // Nocken-Anfang (
N1 : REAL; // Nocken-Ende
END_VAR
VAR_OUTPUT
// Ausgangsparameter
Nocken : BOOL; // Nocken betätigt
END_VAR
VAR_TEMP
Winkel_zykl : REAL; // Zyklischer Winkel
END_VAR
Winkel_zykl := TRUNC(Winkel) MOD 360; // + Realzahl
IF (Winkel_zykl >= N0 ) AND (Winkel_zykl <= N1) THEN
Nocken := TRUE;
ELSE
Nocken := FALSE;
END_IF;
END_FUNCTION
1.x - Trunc(1.x) = Nachkommastelle
Ja, das geht.
Nennt sich dann implizierte Typkonvertierung.
*
Winkel_zykl := (TRUNC(Winkel) MOD 360) + (Winkel/360 - TRUNC(Winkel)); // + Realzahl
Winkel_zykl := (TRUNC(Winkel) MOD 360) + (Winkel/360 - TRUNC(Winkel)); // + Realzahl
.... mach ich dann wenn ich bei Siemens anfange...*ROFL*
wie? bist du denn schon entwickler?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?