jrl@images1.Waterloo.NCR.COM (john Latala) (06/13/90)
A couple of days ago someone asked that they be sent a copy of the large
clock display program. I assumed (:-) that they meant my seven segment
display program so I sent them another copy.
I never did like the way that program displayed digits, but it was
really an experiment in programming with the LCD display. Also quite a
ways back I posted a 'Times Square' horizontal scrolling program that
would scroll a text string horizontally in large (double height)
letters.
The font used in that program is just an enlarged version of the HP28's
own font. It looked a little jagged, but was much nicer than the seven
segment clock display so I decided to update the clock display program
to use the blown up font.
Here are four routines:
MAKE - make the large fonts needed by everybody else
BT - 'Big Time' displays the time (HH:MM:SSp) in letters
that are twice the normal size
BDT - 'Big Date and Time' displays the date (mm/dd/yyyy) and
the time (HH:MM:SSp) on two lines in digits that are twice
the normal size.
BT4 - 'Big Time in 4 lines' displays the time (HH:MM) in digits
that are four times the height and width of the normal
text.
MAKE will make two lists of fonts 'Row2' for the two line and 'Row4' for
the four line versions. It also makes a string that lists the valid
characters that are available.
The 'Chars' string variable should contain every character that you're
going to want to display in the date or time format.
The 'ATIME' routine takes two arguments. A numeric time and a string to
indicate which format of time display is wanted. The sequence: TIME
"HMSP" ATIME can be replaced by anything that gets the current time and
converts it to a string. Remember that for BT and BDT the maximum string
length is 137 / 12 or 11 characters and for BT4 it's 137 / 24 or 5
characters.
In all cases the generated date or time string is horizontally centered.
If you have any questions drop me a line. Have fun!
-------------------------------------------------------------------------------
BT : [740C]
<<
IFERR 'Chars' RCL THEN
MAKE
END
DROP
IFERR 'Row2' RCL THEN
MAKE
END
DROP
CLLCD LCD-> DUP XOR "" "" 0
-> nulls top bot time
<<
DO
TIME "HMSP" ATIME convert time to a string <= 11 chars
'time' STO
"" DUP 'bot' STO
'top' STO
1 time SIZE
FOR i
top Row2 1 GET Chars time i DUP SUB
POS 1 - 12 * 1 + DUP 11 + SUB +
'top' STO
bot Row2 2 GET Chars time i DUP SUB
POS 1 - 12 * 1 + DUP 11 + SUB +
'bot' STO
NEXT
nulls 1 137 SUB
nulls 1 137 top SIZE - 2 / IP SUB top + nulls + 1 137 SUB +
nulls 1 137 bot SIZE - 2 / IP SUB bot + nulls + 1 137 SUB +
->LCD
UNTIL KEY END
DROP
>>
CLMF
>>
BDT : [E8F2]
<<
IFERR 'Chars' RCL THEN
MAKE
END
DROP
IFERR 'Row2' RCL THEN
MAKE
END
DROP
CLLCD LCD-> DUP XOR
-> nulls
<<
0 0 "" "" "" ""
<<
-> msg
<<
"" ""
1 msg SIZE
FOR i
SWAP
Row2 1 GET Chars msg i DUP SUB POS 1 - 12 * 1 + DUP 11 + SUB +
SWAP
Row2 2 GET Chars msg i DUP SUB POS 1 - 12 * 1 + DUP 11 + SUB +
NEXT
>>
>>
<<
-> msg
<<
nulls 1 137 msg SIZE - 2 / IP SUB
msg + nulls + 1 137 SUB
>>
>>
-> date time dtop dbot ttop tbot btext center
<<
DO
IF DATE DUP date == THEN
DROP
ELSE
UDATE break mm.ddyyyy into mm dd yyyy
-> m d y
<<
m ->STR "/" + d ->STR + "/" + y ->STR +
>>
btext EVAL
'dbot' STO 'dtop' STO
END
TIME "HMSP" ATIME convert hh.mmss to "HH:MM:SSp"
btext EVAL
'tbot' STO 'ttop' STO
dtop center EVAL
dbot center EVAL
ttop center EVAL
tbot center EVAL
+ + + ->LCD
UNTIL KEY END
DROP
>>
CLMF
>>
>>
BT4 : [E9FE]
<<
IFERR 'Chars' RCL THEN
MAKE
END
DROP
IFERR 'Row4' RCL THEN
MAKE
END
DROP
CLLCD ->LCD DUP XOR
-> nulls
<<
<<
-> msg
<<
nulls 1 137 msg SIZE - 2 / IP SUB
msg + nulls + 1 137 SUB
>>
>>
-> center
<<
<<
-> msg
<<
1 4
FOR r
""
1 msg SIZE
FOR i
Row4 r GET Chars msg i i SUB POS 1 - 24 * 1 + DUP 23 + SUB +
NEXT
center EVAL
NEXT
>>
>>
-> btext
<<
DO
TIME "HMSP" ATIME convert time to "HH:MM:SS"
1 5 SUB keep "HH:MM"
btext EVAL + + +
->LCD
UNTIL KEY END
DROP
CLMF
>>
>>
>>
>>
MAKE : [FBA8]
<<
"0123456789:ap/" 'Chars' STO
"" ""
-> top bot
<<
1 Chars SIZE
FOR i
Chars i i SUB 1 DISP
LCD-> 1 6 SUB
-> c
<<
1 6
FOR j
c j j SUB NUM 128 0
-> n m b
<<
1 8
START
IF n R->B m R->B AND #0d == THEN
b 4 *
ELSE
b 4 * 3 +
END
'b' STO
m 2 / IP 'm' STO
NEXT
bot b 256 / IP CHR DUP + + 'bot' STO
top b 256 MOD CHR DUP + + 'top' STO
>>
NEXT
>>
NEXT
top bot 2 ->LIST 'Row2' STO
>>
{ "" "" "" "" }
-> rows
<<
1 Chars SIZE
FOR i
Chars i i SUB 1 DISP
LCD-> 1 6 SUB
-> c
<<
1 6
FOR j
c j j SUB NUM 128 0
-> n m b
<<
1 8
START
IF n R->B m R->B AND #0d == THEN
b 16 *
ELSE
b 16 * 15 +
END
'b' STO
m 2 / IP 'm' STO
NEXT
b
1 4
START
DUP 256 MOD CHR SWAP 256 / IP
NEXT
DROP
rows LIST-> DROP
-> r1 r2 r3 r4 R1 R2 R3 R4
<<
R1 r1 DUP + DUP + +
R2 r2 DUP + DUP + +
R3 r3 DUP + DUP + +
R4 r4 DUP + DUP + +
4 ->LIST 'rows' STO
>>
>>
NEXT
>>
NEXT
rows 'Rows4' STO
CLMF
>>
>>
--
john.Latala@Waterloo.NCR.COM