User manual

Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
136
Count rain pulses
Rain Pulse Rain Pulses
#DI14.1 #R498
├──[UP-EDGE]──────────────────────────────────────────────────────────(Inc)────┤
Call the Time Averaging function each minute
DoEveryMin RainLastMin
#YTICK.MIN #R499
├─────┤ ├────────────────────────────────────────────────────────┬───(Copy)────┤
#R498
Rain Pulses
#R498
├───(Copy)────┤
0
AverageRain
TimeAverages
└──( CALL )───┤
Start Func.
FUNC BLOCK
==========
TimeAverages
Initialise registers
QueuePointer
#R1001
├────────────────────────────────────────────────────────────────┬───(Copy)────┤
501
LoopCounter
#R1002
├───(Copy)────┤
0
Queue Total
#R1003
└───(Copy)────┤
0
Move and totalise the newest 59 rainfall totals in the queue
AvStart: Loop Counter MoveQueue
#R1002 #R[R1001]
├──────────────────[<]───────────────────────────────────────────┬───(Copy)────┤
59 #R[R1001+1]
Queue Total
│┌ #R1003 ┐│
├┤= #R1003 ├┤
│└+#R[R1001] ┘│
QueuePointer
#R1001
├────(Inc)────┤
Loop Counter
#R1002
├────(Inc)────┤
AvStart
└──( JUMP )───┤
AvStart
Add the newest rainfall total to the queue and calc. the average
AddNewValue
#R[R1001]
├────────────────────────────────────────────────────────────────┬───(Copy)────┤
#R499
Queue Total
│┌ #R1003 ┐│
├┤= #R1003 ├┤
│└+#R[R1001] ┘│
QueueAverage
│┌ #R500 ┐│
├┤= #R1003 ├┤
│└/ 60 ┘│
Finished
└──(RETURN)───┤
Figure: Averaging 60 rainfall totals using indirect addressing