Sysmac Studio Β· NJ/NX Β· the toolkit

Power Tools

The handful of building blocks every real machine leans on: a timer that waits, a state machine that decides, and the IEC languages you'll write them in. Let's make them tick.

⏲️ TON / TOF / TP🚦 CASE state machine
01 Β· Timers

TON β€” the on-delay timer

A TON waits. Hold its input IN true and its elapsed time ET climbs toward the preset PT; when it gets there, the output Q snaps true. Let go and it resets. Press and hold the button.

Q
PT = T#3s
tmr : TON;
// call it every cycle
tmr(IN := btnHeld,
    PT := T#3s);

lampOn := tmr.Q;
elapsed := tmr.ET;

πŸ’‘ TOF delays the turn-off; TP fires a fixed-length pulse. Same shape, different waiting game.

02 Β· State machines

CASE β€” one state at a time

A machine should always be in exactly one known state. A CASE on a state variable is the cleanest way to guarantee that. Step this little start/run/stop cycle.

IDLE STARTING RUNNING STOPPING
CASE state OF
  0: // IDLE
     IF startCmd THEN state := 1; END_IF;
  1: // STARTING
     motor := TRUE; state := 2;
  2: // RUNNING
     IF stopCmd THEN state := 3; END_IF;
  3: // STOPPING
     motor := FALSE; state := 0;
END_CASE;
03 Β· Check yourself

One quick question

A TON with PT := T#3s has had IN true for 1.2 s. What is Q?