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.
Global.PartEyeXIC
Global.EyeFilterTON
PRE 1500 ACC 0 EN 1 TT 1 DN 0
Global.EyeFilter.DNXIC
Global.PartPresentOTE
1. Eye flickers on. The TON starts timing. ACC is below PRE, so DN is 0.
Global.PartEyeXIC
Global.EyeFilterTON
PRE 1500 ACC 0 EN 0 TT 0 DN 0
Global.EyeFilter.DNXIC
Global.PartPresentOTE
2. Eye flickers off. The rung went false before PRE, so the TON resets. PartPresent never turned on.
Global.PartEyeXIC
Global.EyeFilterTON
PRE 1500 ACC 0 EN 1 TT 1 DN 0
Global.EyeFilter.DNXIC
Global.PartPresentOTE
3. Eye on. The TON starts again from 0, so ACC is 600 after this scan.
Global.PartEyeXIC
Global.EyeFilterTON
PRE 1500 ACC 600 EN 1 TT 1 DN 0
Global.EyeFilter.DNXIC
Global.PartPresentOTE
4. Still on. ACC keeps rising while PartEye stays on.
Global.PartEyeXIC
Global.EyeFilterTON
PRE 1500 ACC 1200 EN 1 TT 1 DN 0
Global.EyeFilter.DNXIC
Global.PartPresentOTE
5. Still on. ACC has reached PRE, 1500 ms. DN turns on and so does PartPresent.
Global.PartEyeXIC
Global.EyeFilterTON
PRE 1500 ACC 0 EN 0 TT 0 DN 0
Global.EyeFilter.DNXIC
Global.PartPresentOTE
6. Eye off. The TON resets at once, so PartPresent turns off on the same scan.
| Step | PartEye | EyeFilter.ACC | EyeFilter.DN | PartPresent |
|---|---|---|---|---|
| 1. Eye flickers on | 1 | 0 | 0 | 0 |
| 2. Eye flickers off | 0 | 0 | 0 | 0 |
| 3. Eye on | 1 | 0 | 0 | 0 |
| 4. Still on | 1 | 600 | 0 | 0 |
| 5. Still on | 1 | 1200 | 0 | 0 |
| 6. Eye off | 0 | 0 | 0 | 0 |
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, notPartEye, 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.