Announcement

Collapse
No announcement yet.

Counting events from the previous hour?

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


  • Counting events from the previous hour?

    I need to count events that occurred in the previous hour. For minutes 1-60, I would look at the counter output. At minute 61 I want to see the count from minutes 1-61. At 65 minutes, the count from minutes 5-65, etc. Any ideas? Shift register?

    CLICK C0-10DRE-D
    low frequency counting


  • #2
    I would use a shift register setup where every minute it moves the counter value into a new register. Then get your total by adding the value of all the registers together. Only have 60 so that as you fill it up it shifts out the oldest value from an hour ago as you put a new one in.
    If Click doesnt have a specific pre-built shift register function then you would do it by simply using a block of 60 memory addresses and a pointer to keep feeding data in. Trigger the move off a 1 minute timer.

    Comment



    • #3
      CLICK has a BIT shift register. No NUMERIC shift register.
      Have a look HERE for an old example.
      Questions? ask. I'll try to answer. It has been a while since I posted that (with Bernie's help.)

      [EDIT]
      It appears that you could use the task 'Shift data down' for the shifting of the quantities and then
      use (with some modification) the task 'Copy using pointer' to select the subset of data you desire to totalize.
      The 'some modification' may include changing the hard-coded '100' value in the for-loop, the '1' and the other '100' in the math instructions to addresses (variables) so that you have a bit more control of the 'range' of 'copied' values.
      Last edited by kewakl; 11-12-2019, 08:11 AM.

      Comment

      Working...
      X