Debounce an input

A sensor can flicker for a moment. A TON on the input ignores anything shorter than its preset.

Step by step

Pick a step. The rungs are drawn by the editor after Core scans the program up to that step.

1. Eye flickers on. The TON starts timing. ACC is below PRE, so DN is 0.

StepPartEyeEyeFilter.ACCEyeFilter.DNPartPresent
1. Eye flickers on1000
2. Eye flickers off0000
3. Eye on1000
4. Still on160000
5. Still on1120000
6. Eye off0000

Why it works

  • A TON times only while its rung is true and resets the moment it goes false. A flicker shorter than PRE never reaches DN.
  • The rest of the program reads PartPresent, not PartEye, so it only sees a confirmed signal.
  • Each step here is one scan, 600 ms apart.

Common mistakes

  • PRE in secondsPRE is in milliseconds. 1500 is one and a half seconds.
  • Filtering the off side tooThis filters turning on only. Use a TOF as well if the signal must also stay off for a while before it counts.

Instructions used

Related