WP-34s clock program



#10

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.


#11

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.


#12

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.

#13

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

#14

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.


#15

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


#16

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

d:-)

#17

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.


#18

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


Possibly Related Threads...
Thread Author Replies Views Last Post
  [WP-34S] Unfortunate key damage with update to V3 :( svisvanatha 5 354 12-10-2013, 11:37 PM
Last Post: Les Bell
  WP-34S (Emulator Program Load/Save) Barry Mead 1 194 12-09-2013, 05:29 PM
Last Post: Marcus von Cube, Germany
  DIY HP 30b WP 34s serial flash/programming cable Richard Wahl 2 271 12-04-2013, 11:14 AM
Last Post: Barry Mead
  HP Prime - Revision Suggestion - Setting the Clock Bill Triplett 5 317 11-15-2013, 12:36 AM
Last Post: Joe Horn
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 334 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  WP 34S/43 ?'s Richard Berler 3 290 11-10-2013, 02:27 AM
Last Post: Walter B
  My FrankenCulator (wp-34s) FORTIN Pascal 4 301 11-09-2013, 06:18 PM
Last Post: FORTIN Pascal
  WP 34S Owner's Handbook Walter B 5 444 11-09-2013, 05:34 PM
Last Post: Harald
  wp 34s overlay and programming. FORTIN Pascal 6 377 11-08-2013, 01:28 PM
Last Post: Nick_S
  m.dy in display of WP-34S Harold A Climer 3 212 11-05-2013, 11:28 AM
Last Post: Andrew Nikitin

Forum Jump: