No announcement yet.

Click PLC Push Button Counter

  • Filter
  • Time
  • Show
Clear All
new posts

  • Click PLC Push Button Counter

    This is my first time posting and I am new to PLCs in general. I'm trying to make something fairly simple and yet I am having difficulties. I have a CO-10DRE-D Click Plc and I have a pushbutton connected to it. I am simply wanting to make a counter that counts every time I push the push button and displays it on an HMI. I'm completely stuck on my code and I'm not sure where to go from here. Any one out there able to help? I attached picture of what I have so far.
    Attached Files

  • #2
    It looks like your setpoint is at 1, which would mean that your counter completes after only 1 press of the pushbutton. Try putting a larger number at your counter setpoint, and then see if you get the desired result. Also, make sure that your PLC is in RUN mode.
    Circumstances don't determine who we are, they only reveal it.
    Jason Wolthuis


    • #3
      It appears, also, that you are not online. If your pc is online with your plc, you should get a choice to monitor your plc statuses.

      In regards to your counter preset, I have my own standard for setpoints for timers/counters.

      I usually reserve DS1-DS50 for timer presets -- keeping a 1:1 relationship.
      Then, I will reserve DS51-DS100 for counters -- still a 1:1, but with a +50 offset.
      If I were to begin to run out of DS registers remaining, I would backfill from DS100 as needed. (this part is not pretty, but sometimes a tradeoff is required!)
      There are so many DS registers available in a CLICK, the this has worked for me - without the backfill.
      Last edited by kewakl; 07-17-2017, 12:11 PM.


      • #4
        Any time you want to count a physical input, it's good practice to debounce the input on leading and trailing edges. (IOW, use a C-bit and turn it on once the physical input has been on continuously for a delay period. Once on, leave it on till the input has been false for continuously for a delay period, then turn off) That way you won't be counting any bounces. 20ms is a pretty good on and off delay. Rejects bounces without limiting the rate at which the guy might want to push the button. There might be some filtering in the Click that would make this redundant, many PLCs have that, but if you do it in the code, then you're guaranteed and the code is more portable.