HP Forums

Full Version: WP-34s clock program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I wrote this program to display internal clock.

LBL'CLK'
LocR 001
CLx
TIME
x=?.00
BACK 003
STO.00
CL[alpha]
[alpha]TIME
VIEW[alpha]
PSE 09
BACK 009
Exit interrupts program and leaves time on stack.

I take extra effort to avoid unnecessary screen updates (update screen only when time changes) and also I use PSE 09 to reduce amount of busy wait.
Does it make sense from the power use point of view? Does PSE command saves power compared to busy wait? Or it has no advantage over simple

LBL'CLK'
CLx
TIME
CL[alpha]
[alpha]TIME
VIEW[alpha]
GTO'CLK'

Edited: 6 June 2013, 11:02 p.m.

Did I get something wrong?

I only had Time showing on the Display after changing the VIEW[alpha] to VW[alpha]+.X

Before that the Display only showed "TIME" in the upper line and three hyphens in the numeric section.

Quote:
Display only showed "TIME"

Like in T, I, M, E? 4 characters? Here is what it looks like on my calc:

I do not show rX contents because it is the same time, just formatted as decimal fraction.

Here is what my entire time program look like.
I tried to implement some functionality of HP-01, which allowed for convenient timestamp arithmetic.

Instruction:

[c] start clock, exit clock to grab current time

XEQ EEX ;; load current time into X

XEQ + ;; add timecode to timecode

XEQ - ;; add timecode to timecode

XEQ * ;; multiply timecode in Y by number in X

XEQ / ;; divide timecode in Y by number in X

XEQ 00 ;; (internal routine) convert both X and Y from timecode to number

Nothing fancy, really.

LBL C
LBL'CLK'
LocR 001
CLx
TIME
x=?.00
BACK 003
STO.00
CL[alpha]
[alpha]TIME
VIEW[alpha]
PSE 09
BACK 009

LBL 00
[->]HR
x<> Y
[->]HR
x<> Y
RTN

LBL 34 ;; XEQ EEX = load current time
TIME
RTN

LBL 75 ;; XEQ + = add timecode to timecode
XEQ 00
+
[->]H.MS
RTN

LBL 65 ;; XEQ - = add timecode to timecode
XEQ 00
-
[->]H.MS
RTN

LBL 55 ;; XEQ * = multiply timecode in Y by number in X
x<> Y
[->]HR
*
[->]H.MS
RTN

LBL 45 ;; XEQ * = divide timecode in Y by number in X
x<> Y
[->]HR

anetzer, you must have entered the word TIME in alpha mode. There is a command in the alpha catalog the formats the X register as a time value and puts the result the alpha register. Use this instead.

Andrew,

always avoid using busy waits on the WP34s (and similar machines). A tight loop runs at the full processor speed quickly draining the batteries (at a rate of about 30 to 40 mA). A PSE command, on the other hand, puts the processor in a low power sleep mode consuming only a few micro A.

You're so right. I took "[alpha]TIME" as instruction to input an alpha string.

The following seems to work and leave the stack in order:

001 LBL C

002 LocR 001

003 LBL 00

004 DROP

005 TIME

006 CL[alpha]

007 [alpha]TIME

008 VIEW[alpha]

009 PSE 09

010 GTO 00

011 END

And if we drop the power-hungry loop?

001 LBL C

002 TIME

003 CL[alpha]

004 [alpha]TIME

005 VIEW[alpha]

006 PSE 09

007DROP

008 GTO C

009 END

I can see no difference in power consumption between your two programs here - you just drop two dispensable steps IMHO.

d:-)

Marcus, thank you for explanation. I will use it as a guidance.