Announcement

Collapse
No announcement yet.

Switch DeBounce logic for Click PLC

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • Switch DeBounce logic for Click PLC

    In my shade controller (discussed in the "How Do You Implement ELSE" thread), I discovered a problem which appears to be due to switch bounce. My PLC loop is so fast (~1ms), that sometimes (5-10%) the system behaves strangely. I finally traced it down to switch bouncing! The RC input circut should eliminate bouncing, but perhaps it is tuned for speed, and my switch has a slow bounce or something.

    Anyway, the incredibly simple fix was to Enable Fixed Scan Mode with a 20ms iteration time. Works perfectly! Also, now that I know the scan time is fixed, I can calculate current shade position with a simple up/down counter, and leave timers out...

    --Bob

    P.S. So much for my obsession with speed.


  • #2
    Originally posted by rbroders View Post
    In my shade controller (discussed in the "How Do You Implement ELSE" thread), I discovered a problem which appears to be due to switch bounce. My PLC loop is so fast (~1ms), that sometimes (5-10%) the system behaves strangely. I finally traced it down to switch bouncing! The RC input circut should eliminate bouncing, but perhaps it is tuned for speed, and my switch has a slow bounce or something.

    Anyway, the incredibly simple fix was to Enable Fixed Scan Mode with a 20ms iteration time. Works perfectly! Also, now that I know the scan time is fixed, I can calculate current shade position with a simple up/down counter, and leave timers out...

    --Bob

    P.S. So much for my obsession with speed.
    Hey that's a good way to do it - I think the Click also has input filters you can enable in the CPU set-up for de-bounce but I'm not sure (software not installed on this PC).

    Comment

    Working...
    X