HP Forums

Full Version: Wanted stopwatch to 42s
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Has anyone a program for turning the 42s into a stopwatch ? Or even better, a program where you can take a time and then enter the number of pieces produced during the time. The calculator then calculates estimated pieces per minute.

Regards
Rikard

Hi;

I do not know if there is a program to simulate a precision stopwatch in an HP42S; it would need some loops and PSE instructions to simulate time counting, unless the HP42 has a poition in memory that can be read and manupulated, so a clock can be simulated. This is the trick that was used to simulate (trully) a clock in the HP28S. Anyway, if you want the program to compute # of pieces for a given time, try this:

LBL "PPM"
"T.(sec) each p:"
PROMPT
60
X<>Y
÷
"# of Pieces: "
ARCL X
AVIEW
END
Some improvements can be added, like choosing time basis for each piece (seconds, minutes, hours, etc.), input forms, integer # of estimated pieces, output look, storing data for statistics analysis... If you want any improvement, you can e-mail me directly. (Do you know how to type the program in?)

Cheers.

Some basics to the clock ticks or time questions on the HP42S.

The HP42S programming language is similar to the HP41, but on the HP42S this programming language is rebuild by a high level interface in RPL, so synthetic programming isn't possible. Internally the HP42S is programmed in RPL with the objects known from the HP28 and HP48.

When I remember correct, there was a thought or discussion about native programming on the HP42S in the newsgroup comp.sys.handhelds in the early nineties or here in MoHPC. The thought was, every emulated HP41 command is saved as a RPL pointer object in RAM. When I write a program now, I can fill the program with dummy RPL pointers, then call the integrated memory scanner, go to the position of the program (but don't ask me how to find the address) and overwrite these dummy RPL pointers with own code. That's a sort of sythetic programming for the HP42S and for our further discussion let's asssume that this will work.

Now back to our time problem. Like all high end Pioneer calculators (veryfied on the HP17BII and HP27S) the HP42S has a 13 nibble (52 bit) tick counter at #50000 (=NEXTIRQ). The HP17BII and HP27S use this counter in connection with the timer2 content for the visible clock. So on all high end Pioneer calculators the content of =NEXTIRQ in connection with the timer2 content makes a good time base. When you write a very small piece of code using internal entries to get the ticks, how you want to handle them in the HP42S? Just calculate 2^52 on your HP42S and you'll get something like 4.5036E15 depending on the display format. Putting 13 nibbles into a 12 nibbles mantissa don't work without precision loss. OK, who's interested in a timer with 1/8192Hz resolution in most cases? So it's possible to pack a tick value with reduced precision into a float number. But remember, we are speaking here about pure assembler code packed into a code object patched by hand into the HP41 code. This object can't of course be edit with the internal editor any more.

I can only say very very hairy. Perhaps I forgot something very important, and there's a much easier way.

Because of that I like my HP48, and with restrictions the HP28S. On both calculators it's quite easy to add SysRPL or Code objects, but I don't want to discuss especially the techniques of SysRPL programming on the HP28S here.

Regards

Christoph

I wrote a program about 10 years ago that lets you use the 42S as a clock/countdown timer. I could send it to you if you think it would help. It's not fansy, but it will keep time to within +/- 3 seconds over an hours time. I'm sure it could be modified for splits if needed. I can send it to you or I could post it here.

The 41 with time module would the the job easily. I have done similiar thing with my 41. I have always been surprised to see that so many people regard the 42S so highly. I think the 41 is a much better calculator even if it has less memory, only 1 line display and larger.

Here is the clock program. It's simple, but it did what I wanted it to at the time.

00 { 140-Byte Program }
LBL gCLKh
ASSIGN gSWh TO 01
ASSIGN gSETWh TO 02
ASSIGN gRUNh TO 03
05 SF 27
STOP
LBL gSWh
CLRG
CLST
10 LBL gRUNh
LBL 00
CLA
0.0001
0.0000277 May vary due to processor speed
15 -
STO+ 00
RCL 00
¨HMS
g h 5 Spaces
20 AIP
„¥hH:h Append H:
FP
1E2
*
25 AIP
„¥hM:h Append M:
FP
1E2
*
30 AIP
„¥hSh Append S
AVIEW
GTO 00
LBL gSETWh
35 gSet Time +/- H.h
„¥hMMSSh Append MMSS
PROMPT
¨HR
STO 00
40 GTO 00
END

Sorry, this should be it.

{ 140-Byte Program }

LBL CLK

ASSIGN SW TO 01

ASSIGN SETW TO 02

ASSIGN RUN TO 03

SF 27

STOP

LBL SW

CLRG

CLST

LBL RUN

LBL 00

CLA

0.0001

0.0000277 (Numbers may vary due to processor speed)

-

STO+ 00

RCL 00

HMS

_____ (5 Spaces)

AIP

H: (Append H:)

FP

1E2

*

AIP

M: (Append M:)

FP

1E2

*

AIP

S (Append S)

AVIEW

GTO 00

LBL SETW

Set Time +/- H.

MMSS (Append MMSS)

PROMPT

HR

STO 00

GTO 00

END

Hi;

Maybe it's not necessary to mention this fact, but any sort of time counter (stopwatch, clock, etc.) in the HP42S that does not use internal tick counter will only count while the program itself is running. This is not what happens in the HP28S, where the tick counter is an internal register. As Christoph mentions, there is such an internal position in the HP42S' memory that holds this count, but there is no easy way (yet) to use it in a program.

So, the time counting programs that will use loops, as the excelent version shown by Richard Garner, when stopped will stop time counting. Just beware of the fact it cannot be interrupted while counting. HP41's Time Functions access an actual Xtal-based clock.

Just my US$0.05...

NM