User manual

Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
106
Example - Counting Pulses And Starts
Counting Pulses Using A Standard Digital Input (DI-1, IO-x)
An RTU is capable of counting input pulses up to a rate of at least 10 Hz. The actual pulse rate that the RTU
can count depends on how often it is able to scan its ladder. Since pulses are counted by counting the rising
or falling edges of digital inputs, the ladder needs to be scanned fast enough to allow the RTU to register the
pulse in the ACTIVE and in the INACTIVE states. Assuming that a pulse has a 50% duty cycle then the
maximum pulse rate that can be counted is half the maximum ladder scanning rate (as displayed by the RTU
Status). An example of an acceptable pulse input is shown below.
50 50 ms
Figure: Acceptable Pulse Input That The RTU Is Able To Count.
Figure 5.3b shows how to count pulses using a rising edge trigger. Every time there is a new pulse, the
Pulses Today register is incremented.
Count DI Pulses (up to 50Hz)
Flow Pulse Pulses Today
#DI14.1 #R8
├──[UP-EDGE]──────────────────────────────────────────────────────────(Inc)────┤
Figure: Counting Standard DI Pulses
Shaft Encoder - Quadrature Pulse Counting
A shaft encoder has two pulse outputs. Each time the level changes, a pulse is generated on each output.
Depending on which output pulsed first, the direction of the level change can be determined. By beginning
with a default level (eg. say 50%), the total can be incremented or decremented according to whether the
level change is positive or negative. In the example below, #R15 contains the Shaft Encoder Level. The level
is set to a default of 1000 after a warm start and is incremented or decremented depending on the order of
the pulses from LP-1/2/3 digital channels 1 and 2. Note: the accuracy of this type of quadrature counting
depends on the RTU scanning fast enough to capture each pulse (a scan rate of at least 100 times a second
is recommended). For greater accuracy, a DI-10 module can be used.
Perform quadrature pulse counting using LP-1/2/3 DI chs 1 and 2
On warm start, reset quadrature count level to 1000.
DoFirstScan Shaft Level
#YSYS.SCAN1 #R15
├─────┤ ├────────────────────────────────────────────────────────────(Copy)────┤
1000
DI Ch1 0->1 DI Ch 2 Inc ShaftLev
#DI1.1 #DI1.2 #R15 ┐│
├──[UP-EDGE]───────┤/├────────────────────────────────────────────┤= #R15 ├┤
+ 1 ┘│
DI Ch1 1->0 DI Ch 2 Dec ShaftLev
#DI1.1 #DI1.2 #R15 ┐│
├─[DOWN-EDGE]──────┤/├────────────────────────────────────────────┤= #R15 ├┤
- 1 ┘│
Figure: Quadrature Pulse Counting From a Shaft Encoder