Post Reply 
Programming WP34s
10-09-2017, 04:58 AM (This post was last modified: 10-13-2017 06:45 AM by Matthias D..)
Post: #1
Programming WP34s
Hi there,

Wp34 works, but recently had problems with programming.

Typed in a little benchmark program:
Label "SPD"
1
Label 01
Atn
Tan
Squareroot
X^2
LN
E^x
1 + (these 2 steps I forgot in my original post, flaw mentioned in #5)
X<y?
Goto 01
End

Starting with a number in X (and press Enter) - the number of loops it shall do - it works - but only the first time having it started with XEQ "SPD".
Having ended, the program pointer should be at the start again, making it possible to start next time with R/S only. But as I can trace with "Arrow down", the next operation, the program goes to is "squareroot"!

I did a hardware reset, but the problem stayed.

Greetings from Germany.
Find all posts by this user
Quote this message in a reply
10-09-2017, 06:23 AM (This post was last modified: 10-09-2017 06:46 AM by Dieter.)
Post: #2
RE: Programming WP34s
(10-09-2017 04:58 AM)Matthias D. Wrote:  Wp34 works, but recently had problems with programming.
...
Having ended, the program pointer should be at the start again, making it possible to start next time with R/S only. But as I can trace with "Arrow down", the next operation, the program goes to is "squareroot"!

Compared to HP calculators the 34s behaves differently in this regard. After a program has finished (e.g. with RTN or END) the program pointer is not set to the top of the memory (like on the 34C) nor does it point to the next instruction after the RTN (like on the 67 and 41C). Instead it points to the instruction where you last left it. For instance, if you go to line 005 (GTO . 005) and then XEQ "SPD", the program pointer afterwards will still be at line 005.

This also means there is an easy fix: simply press g RTN after you entered a program. The BEG annunciator will appear in the display to confirm that the calculator is now reset to the top of memory, i.e. line 000. Even if the program ends at another step somewhere down the program it will still be set to line 000 if you press P/R, and R/S will restart it from the first line.

Dieter
Find all posts by this user
Quote this message in a reply
10-09-2017, 11:34 AM
Post: #3
RE: Programming WP34s
(10-09-2017 06:23 AM)Dieter Wrote:  Compared to HP calculators the 34s behaves differently in this regard. After a program has finished (e.g. with RTN or END) the program pointer is not set to the top of the memory (like on the 34C) nor does it point to the next instruction after the RTN (like on the 67 and 41C). Instead it points to the instruction where you last left it. For instance, if you go to line 005 (GTO . 005) and then XEQ "SPD", the program pointer afterwards will still be at line 005.

....

Dieter

In case this seems strange - the logic is that XEQ "SPD" is a subroutine call, and so after completing the routine the pointer goes back to where it was beforehand. This is useful - if you have written your own routine you can call it to calculate something while a program is waiting for input without upsetting that program.

Nigel (UK)
Find all posts by this user
Quote this message in a reply
10-12-2017, 04:21 AM
Post: #4
RE: Programming WP34s
Thanks,
But the case is that the program ended because x not < y, so the program pointer should stay at "end" or at the beginning again, but it continues with "atn"!
Find all posts by this user
Quote this message in a reply
10-12-2017, 01:53 PM (This post was last modified: 10-12-2017 02:01 PM by Dieter.)
Post: #5
RE: Programming WP34s
(10-12-2017 04:21 AM)Matthias D. Wrote:  Thanks,
But the case is that the program ended because x not < y, so the program pointer should stay at "end" or at the beginning again, but it continues with "atn"!

Yes, sure. Please read the answers again, that's perfectly normal and the way the 34s behaves. If the program reaches a RTN or END it does not stop there (!). It stops and resets the program pointer to the point where it was before the program was started. I know this looks strange if you are familiar with other (HP) calculators, and I don't like this either, but that's the way it is. Among other peculiarities of the 34s.

The only way to make a program stop at its current position is R/S (or PROMPT). So you may add a R/S before the END. But pressing R/S once more after the program had ended will then proceed to the END and stop ...and reset the program pointer again to step 005 or 007 or whereever you left it last time – because that's what happens at and END or RTN command.

You may try this for a better understanding:

1. Enter the program, quit program mode with P/R
2. GTO .005
3. P/R shows step 005 with TAN. Press P/R again to quit program mode.
4. 1 XEQ"SPD"
5. Program immediately stops with "1" in the display
6. P/R shows step 005 with TAN again.

7. Quit program mode again with P/R
8. Press g RTN, program pointer now is set to first step, BEG appears.
9. 1 XEQ"SPD"
10. Program immediately stops with "1" in the display
11. P/R shows step 001 with LBL"SPD"

You can now rerun the program with R/S as often as you like. When it stops it is always reset to step 001 because that's where it was (due to the RTN) before you started the program.

This means: if you want to run a program several times by simply pressing R/S you have to position the program pointer to its start before the first run. Either by a GTO"SPD" or with a simple RTN (if the program is the first in memory). This way, when the program stops due to a RTN or END, it will automatically be reset to its start.

BTW I do not understand what the program is supposed to do. It puts a 1 in X and does some calculations after which the result is exactly 1 again. Then this 1 is compared to a value in Y. This value must have been entered before by the user because the program does not change Y. So if you enter any number ≤1 before the program is run, it will stop immediately. Enter anything >1 and it will loop forever and never stop.

Dieter
Find all posts by this user
Quote this message in a reply
10-12-2017, 09:04 PM (This post was last modified: 10-13-2017 08:24 AM by Matthias D..)
Post: #6
RE: Programming WP34s
Edit: You where right, I forgot the "1 +" before the test in the program listing.
Sorry.

And thanks for the loooong answer, now I understand.

The program is a benchmark.
Type in a number in Stack X and start.
X is lifted to y by putting 1 to the stack. Register x is changed by the calculations, but shall end with approximately the starting-x. Then 1 is added. If x<y: loop, else end.
HP32 does 5 loops/sec, HP28 s 10 loops.
Input smaller than one is not intended.
Find all posts by this user
Quote this message in a reply
10-12-2017, 10:09 PM
Post: #7
RE: Programming WP34s
(10-12-2017 09:07 PM)Matthias D. Wrote:  You where right, I forgot the "1 +" before the test in the program listing.
Sorry.

Suggestion: You can edit your original post (look for the "edit" button) to add the missing line to your original listing, which will make it easier for future readers to understand the complete (corrected) program. Only you can edit the post since you were the original author. After you edit and save the post, it will show that an edit has taken place, as a clue to readers what Dieter's comment and you reply were about.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
10-13-2017, 05:47 AM
Post: #8
RE: Programming WP34s
(10-12-2017 09:07 PM)Matthias D. Wrote:  You where right, I forgot the "1 +" before the test in the program listing.
Sorry.

OK, that's of course an essential point. #-)
BTW instead of 1 + you can use INC X. Or at least #001 + (from the CONST menu), that's faster.

Dieter
Find all posts by this user
Quote this message in a reply
10-13-2017, 07:00 AM
Post: #9
RE: Programming WP34s
Dieter said: Even if the program ends at another step somewhere down the program it will still be set to line 000 if you press P/R, and R/S will restart it from the first line.

That's weird. But sometimes usefull too, I admit.

By the way, I read the manual many times, (for recreation in a sense) liked it to see, how sophisticated the calculator's firmware and how elaborated the manual is done. But not being an English native, I had problems to comprehend.
And every time I look into the manual I find a command that I didn't remembered.

Well, thank you all not being afraid of my "English for runaways" and helping me out.

Your's
Matthias
Find all posts by this user
Quote this message in a reply
10-13-2017, 06:42 PM (This post was last modified: 10-13-2017 06:46 PM by Dieter.)
Post: #10
RE: Programming WP34s
(10-13-2017 07:00 AM)Matthias D. Wrote:  Dieter said: Even if the program ends at another step somewhere down the program it will still be set to line 000 if you press P/R, and R/S will restart it from the first line.

...if (!) the calculator was previously set to line 000 (or 001), e.g. by a RTN. Of course you can also set it to the start of another program somewhere in memory, so that after this program finishes with a RTN or END the pointer is reset to the start of that program again.

(10-13-2017 07:00 AM)Matthias D. Wrote:  That's weird. But sometimes usefull too, I admit.

I still don't like this behaviour very much. It's simply completely different from what I am used to after 27 years of using HP calculators.

(10-13-2017 07:00 AM)Matthias D. Wrote:  Well, thank you all not being afraid of my "English for runaways" and helping me out.

I think this requires an explanation for our non-German forum members: "English for runaways" refers to Otto Waalkes, a German comedian who was especially popular in the 70s and 80s. One of his most popular performances was an English lesson for advanced students, i.e. "Englisch für Fortgeschrittene". Which he translated in this ...err... very special way. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)