User manual
Toolbox 32 User Manual 1.47d www.cse-semaphore.com/mykingfisher
Page
127
Example - Pager Messages With Variables
The previous example showed how a fixed pager message could be sent to a mobile phone as an SMS.
Pager messages can also be sent that contain register values. This is achieved by sending a string of up to
31 ASCII characters. The string is overwritten with register values prior to sending the pager message. The
string is stored in local registers with two characters in each register (8 bits are used for each character).
A string can be created using a String Copy block which creates a string up to 31 characters long. The String
Copy then terminates the string with a null character (00 Hex).
To transmit a string in a pager message, Line 1 of the pager message block is configured as the local
register (#R1 to #R2048) that contains the first character of the string (in bits 1-8).
The example shown below converts a tank level stored as 0-999 in #R2 into ASCII characters and then
transmits the tank level as a string in a pager message whenever #DI14.1 (Tank overflow alarm) is triggered.
0-999 is converted into ASCII characters by separating the number of 100s, 10s and 1s. Each digit is then
converted into ASCII by adding 30 Hex (represented by 16#30 in ladder logic) to each digit. A standard string
is created using the String Copy block containing xxxxxxxxxx_Tank_Level_nn.n_% and then nn.n is
overwritten by the tank level ASCII characters. When overwriting the string with the tank level characters,
care must be taken to overwrite the correct character positions. In this example the tank level is stored in
characters 23-26 of the string. Since the string starts at #R401 (as configured in the String Copy block) and
there are two characters in each register, the tank level is then stored in #R412 and #R413 as illustrated
below. The first character in each register (ie. the left character) is stored in bits 1-8 (LSB). The second
character is stored in bits 9-16 (MSB). Note: the LP-1/2/3 stores the left character in the MSB and the right
character in the LSB.
Register # 401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
Characters
xx xx xx xx xx _T an k_ Le ve l_ nn .n _%
null
Note: letters denoting the site name can be used instead of the x's at the start of the string.