Datasheet
Jon Waddington
39
The code below shows how the name of a device is input with the remote control.
PRI rcname_in(i) | j, t, x
code := 0 'flush code
t := i 'backup device number
repeat j from i to i+9 'clear bytes in name
name[j]~
i := t 'i = device number
text.out($00) 'clear screen
showdate(0, 0) 'show date and time
showtime(35, 0)
text.str(string(13," Add Device (Remote)",13,13," Name: ")) 'prompt
user
x := 12 'x = position on screen
repeat until ((code == enter) OR (i == t+9)) 'repeat until enter is pressed or
all bytes input
code := wait 'wait for button press
if (code =< 9) 'if button pressed is a number
text.xy(x, 4) 'move text cursor to x, y position
text.dec(code) 'display code
name[i] := code + 48 'save code as ASCII number
i++ 'move pointer to next byte
x++ 'increment cursor position
When entering a new name for a device, the 10 bytes which will be the name are cleared
as a precaution. This prevents errors when displaying the name which would occur if
there was any data already in these bytes. The screen is cleared and the date and time
are shown. The user is then prompted to enter the name of the device. A loop is then
entered which displays the key that the user inputs and moves the text cursor to the
next tile and increments the data pointer to write the next byte of the name.
This method is similar for entering, editing and deleting devices. When a device has been
added, the “dvcnum” variable is incremented so that when a new device is added, the
program knows where to write the data in the arrays.
When a device is deleted, the data in the arrays are shifted down so that there is no
empty space in the arrays. The “dvcnum” array is also decremented.
A variable can be assigned to point to a byte from the array to read information for a
specific device. For example, to display the value of device number 2, “dp”(device
pointer) can be set to “2”. To show the name, a loop is used to display the byte at
name[dp*10], then name[(dp*10)+1] and so on, until the name ends or the 10
th
byte is
displayed.










