User manual

Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
128
Convert Tank Level (0-999=0-99.9%) to ASCII for pager msg
Determine number of 100's, 10's and 1's as single integers
No of 100s
#YTICK.SEC #R301 ┐│
├─────┤ ├────────────────────────────────────────────────────────┬┤= #R2 ├┤
│└/ 100 ┘│
No of 10s
│┌ #R302 ┐│
├┤= #R2 ├┤
│└/ 10 ┘│
No of 10s
│┌ #R302 ┐│
├┤= #R302 ├┤
│└% 10 ┘│
No of 1s
│┌ #R303 ┐│
├┤= #R2 ├┤
│└% 100 ┘│
No of 1s
│┌ #R303 ┐│
└┤= #R303 ├┤
% 10 ┘│
Convert to ASCII digit representation (eg. 1 = HEX31)
ASCII 100s
#YTICK.SEC #R304 ┐│
├─────┤ ├────────────────────────────────────────────────────────┬┤= #R301 ├┤
│└+ 16#30 ┘│
ASCII 10s
│┌ #R305 ┐│
├┤= #R302 ├┤
│└+ 16#30 ┘│
ASCII 1s
│┌ #R306 ┐│
└┤= #R303 ├┤
+ 16#30 ┘│
Move tens to high byte, then combine hundreds and tens
Move10s Left
#YTICK.SEC #R307 ┐│
├─────┤ ├────────────────────────────────────────────────────────┬┤= #R305 ├┤
│└* 256 ┘│
Combine 100s
│┌ #R307 ┐│
└┤= #R307 ├┤
+ #R304 ┘│
Create blank string: xxxxxxxxxx_Tank_Level_nn.n_%
Pager String
#YTICK.SEC #R401
├─────┤ ├───────────────────────────────────────────────────────────(StrCopy)──┤
Overwrite 'nn' portion of the string with ASCII level
Write 'nn'
#YTICK.SEC #R412
├─────┤ ├────────────────────────────────────────────────────────────(Copy)────┤
#R307
Then add the '.n' value (dot = ASCII 16#2e)
Move 1s Left
#YTICK.SEC #R306 ┐│
├─────┤ ├────────────────────────────────────────────────────────┬┤= #R306 ├┤
│└* 256 ┘│
Combine dot
│┌ #R413 ┐│
└┤= 16#2e ├┤
+ #R306 ┘│
Send message: "xxxxxxxxxx Tank Level nn.n % dd/mm/yy, hh:mm:ss"
TankOflowAlm TankLevelMsg
#DI14.1 #R100.16
├──[UP-EDGE]─────────────────────────────────────────────────────────(PAGER)───┤
Figure: Generating A Pager Message Containing A Variable nn.n