A SIMPLE CLOCK DISPLAY for the HP28C ==================================== Here is a simple way of keeping and displaying real time on the HP28C. This code was adapted from several sources: << #123E SYSEVAL 8192 / >> 'TIME' STO << HMS> 3600 * TIME B>R - 'TD' STO >> 'CS' STO << 4 FIX DO TIME B>R TD + 3600 / 24 MOD >HMS 1 DISP UNTIL KEY END DROP >> 'CLOCK' STO 1. Enter the current time in HH.MMSS (24 hour) format into the command line. 2. Press CS in the USER menu ("Clock Set") 3. Press CLOCK in USER menu to show the time in HH.MMSS 24 hour format in line 1 of the display 4. Press CLOCK any time thereafter for the displayed time The routine 'TIME' recalls one 8192nd of the system clock, which is used in the 'CS' routine to generate the variable TD ("time difference") which is the constant offset between entered time and system clock time. The routine 'CLOCK' recalls, converts and formats the clock to real time. A Simple HP28C Stopwatch ======================== Here is a simple stopwatch for the HP28C which uses the system clock to time events with accuracy displayed to thousandths of a second. A 'RESET' button sets the timer to zero while 'STRT' begins the timer. Then, pressing 'SPLIT' places a time split onto the stack. 'STRT' will restart the timer at this point. Time is displayed in HH.MMSSsss format. << #123E SYSEVAL B>R 8.192 / >> 'TM' STO << 1 SF 0 'RT' STO >> 'RESET' STO << TM 'OFFST' STO 1 CF >> 'STRT' STO << 7 FIX IF 1 FS? THEN RT ELSE TM OFFST - RT + END 3600000 / >HMS >> 'SPLIT' STO << 7 FIX IF 1 FS? THEN RT ELSE 1 SF TM OFFST - RT + DUP 'RT' STO END 3600000 / >HMS >> 'STOP' STO Variables Used: TM - current time in thousandths of a second RT - runing time OFFST - offset from system clock FLAG 1 also used Note: you may wish to use the ORDER function to arrange that the main functions RESET, STRT, SPLIT and STOP are first across the top row of user keys: { RESET STRT SPLIT STOP } ORDER Jake Schwartz, 135 Saxby Terrace, Cherry Hill, NJ 08003, USA [609-751-1310 home] [609-866-6269 work] Notes added by Mark Cracknell, 6 Stratton Mews, Of South Street, Leighton Buzzard, Bedfordshire LU7 8NT, England. [Home : 0525-383265] 1. The code shown above contains two changes from the original - one a simple error and the other a functional enhancement: a. The original of 'CLOCK' had the sequence '/ 86400 MOD'; I have altered that to '/ 24 MOD'. b. The original of 'SPLIT' had no display setting so if you made use of 'SPLIT' before making use of 'STOP' you might not get a meaningful display - I therefore taken the liberty of inserting the sequence '7 FIX' before 'IF 1 FS? THEN ...' in 'SPLIT'. 2. I would also recommend making the the following enhancements :- a. Change the '7 FIX' sequences to '5 FIX' in 'SPLIT' and 'STOP' for an 'easier to use' output. b. Insert the sequence '" " SWAP >STR + between >HMS and 1 DISP UNTIL ... in 'CLOCK'.