User manual

Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
107
Counting Pulses Using A DI-5
A DI-5 Counter Module automatically keeps pulse totals for its first four digital input channels. For fast pulse
rates (up to 10kHz), the pulse totals will reach the maximum value of 65535 very quickly. To prevent a pulse
total from overflowing, it can be rolled over every 1000 pulses as shown below. In the example, #AI14.2 is
the number of digital input 1 pulses (0-999) and #R14 is the number of thousands of pulses (0-65535 k) for a
DI-5 module in slot 14.
Count DI-5 Pulses (up to 10kHz)
Counter1 Count1/1000
#AI14.2 #R14
├─────[]────────────────────────────────────────────────────────┬────(Inc)────┤
1000
Counter1
│┌ #AO14.2 ┐│
└┤= #AI14.2 ├┤
- 1000 ┘│
Figure: Counting DI-5 Pulses (up to 10kHz)
Counting Starts
Counting starts is exactly the same as counting pulses using a standard digital input. The start and stop
signals are like a very slow pulse. The ladder below shows how to count starts using a rising edge trigger.
Every time there is a new start, the P1 StartsTdy register is incremented.
Count Pump Starts
PumpRunning P1 StartsTdy
#DI14.2 #R4
├──[UP-EDGE]──────────────────────────────────────────────────────────(Inc)────┤
Figure: Counting Pump Starts
Example - Hours Run
The example below records how long pump 1 has been running for in decimal hours. Every 3.6 seconds
(0.001 Hrs) the ladder checks if pump 1 is running and if it is, P1 HrsRunTdy (#R6) is incremented. Local
register #R6 then contains the number of 0.001 hour intervals that the pump has been running for ie. 0-
65,535 = 0-65.535 Hrs. P1 HrsRunTdy is rolled over at midnight (as shown in section 5.6 - Rolling Totals
Over At Midnight) so that the total will not overflow after a few days. The ladder makes use of the 3.6 Sec
Flag from the topic Example - Timer Flag.
Count Pump 1 Hours Run Today
3.6 Sec Flag Pump1Running P1 HrsRunTdy
#R100.1 #DI14.1 #R6
├─────┤ ├──────────┤ ├────────────────────────────────────────────────(Inc)────┤
Figure: Counting Hours Run Today