Datasheet

Jon Waddington
45
The code first displays the time in white text and then the hours value changes to yellow,
indicating to the user that this is the value currently being modified.
The value of the hours is then modified by the user using the ‘up’ and ‘down’ buttons on
the remote control until ‘enter’ is pressed. The hours then turn white again and the code
repeats for the minutes.
3.8.4 Displaying date and Time
The SPIN code below shows a method which shows the time on the screen. Two
variables are passed into the method which set the X, Y position where the time is to be
shown. The Minute and Hour values are obtained using the “Getminute” and “Gethour
methods and displayed using the “dec()” method in the “Tv_text” object.
PRI showtime(x, y) | m, h
{method shows the time at X, Y position on the screen}
m := getminute 'get the minute value
h := gethour 'get the hour value
text.xy(x, y) 'move text cursor to X, Y
text.dec(h>>4 & $03) 'display the 10s h
text.dec(h & $0F) 'display the units of h
text.str(string(":"))
text.dec(m>>4 & $07) 'display the 10s of m
text.dec(m & $0F) 'display the units of m
The date and time are displayed in the same place on television on each menu with the
exception of the set time and date screens. As the menus are often waiting for a button
on the remote control to be pressed, it was practical to write a method to check the time
and also the status of the remote control at the same time.
The method below returns the RC5 command when a button is pressed on the remote
control. While there is nothing being pressed, the program waits for 4000000 clock
cycles (50mS) and checks the RC5 status. This repeats 20 times, taking one second and
then checking the minute value to see if there has been a change. If so, the date and
time update and the program loops back to the previous loop. The purpose of the delay
is so the minute value isn’t being read constantly as this momentarily halts the PCF8563,
making it run slower and becoming less accurate. The reason for the 50ms delay is in a
loop rather than a single one second delay is so that if a button is pressed, the loop
ends. This makes the system seem more responsive to the user.