Rc7 Script 💫 💯

Keywords: rc7 script, RC7 programming, industrial automation script, PLC structured text, robot control script, RC7 syntax, IEC 61131-3.

VAR fbDelay : TON; bOutputDelayed : BOOL; END_VAR fbDelay(IN := bInput, PT := T#5s); // Wait 5 seconds bOutputDelayed := fbDelay.Q; TYPE RobotJoint : STRUCT nJointID : INT; rPosition : REAL; rVelocity : REAL; bHomed : BOOL; END_STRUCT END_TYPE VAR arm : ARRAY[1..6] OF RobotJoint; END_VAR rc7 script

FUNCTION F_ScaleInput : INT VAR_INPUT rRaw : REAL; // 0.0 to 10.0 Volts rMin : REAL; rMax : REAL; END_VAR VAR_TEMP rPercent : REAL; END_VAR rPercent := (rRaw - 0.0) / (10.0 - 0.0); // Normalize F_ScaleInput := REAL_TO_INT(rMin + (rMax - rMin) * rPercent); END_FUNCTION Real-time control relies on timing. RC7 uses the TON (Timer ON delay) function block. Keywords: rc7 script