Post Reply 
Help With Using the Math Module
04-23-2018, 01:16 AM
Post: #1
Help With Using the Math Module
Hi all,

So I got myself a math module "MATH 1" p/n 5061-5261 "1C" module for my HP41-CX.

I've been playing with it but have become quite frustrated with how I cannot pause the program to write down the values it displays as the programs progresses.

Using the example in the manual for the Math Pac, I will run SINZ to calculate sin(2 + 3i). The output in quick succession with no pausing is:
U = 9.145
V =-4.169

The problem is that the first answer goes by so quickly I cannot read it fast enough to remember easily.

My reading of the instructions regarding the keystrokes is that after the U value is displayed, the user would have to press the R/S key for the V answer to be displayed. This is not happening for me.

I've played with the other functions like the ones for solving a set of simultaneous equations and have had the same thing happen: i.e. all of the answers are displayed in quick succession automatically without the program waiting for the user to press the R/S key.

I have tried stopping the program using the R/S key so to be able to write down the values but the program does not always start up again properly.

Am I missing something?

Thanks!

Just a nerd girl with too much alphabet soup behind her name and an HP-41CX.
Find all posts by this user
Quote this message in a reply
04-23-2018, 01:19 AM
Post: #2
RE: Help With Using the Math Module
Change the status of flag 21. If it is set, then CF 21 or vice versa. That should cause the 41 to stop when displaying output like that.
Find all posts by this user
Quote this message in a reply
04-23-2018, 01:29 AM
Post: #3
RE: Help With Using the Math Module
(04-23-2018 01:19 AM)Gene Wrote:  Change the status of flag 21. If it is set, then CF 21 or vice versa. That should cause the 41 to stop when displaying output like that.

Gene,

Thanks for the quick reply. I just now tried what you suggested.

First I checked the status of flag 21 and it was set.
I then cleared it.
I actually tested it again to be sure it was not set.
I then ran the SINZ function (as described above).
Unfortunately, no change.

I discovered that executing the function SINZ caused flag 21 to be set.

I checked my manual and flag 21 is the printer enable flag. I could not find another flag in the manual that seemed to address my needs.

Just a nerd girl with too much alphabet soup behind her name and an HP-41CX.
Find all posts by this user
Quote this message in a reply
04-23-2018, 01:40 AM
Post: #4
RE: Help With Using the Math Module
Try setting flag 4. That allows the routines to be used as subroutines and should leave the complex results in the X and Y registers. That should allow you to have access to the values when SINZ.

Are you using the dedicated printer along with the HP 41 ?
Find all posts by this user
Quote this message in a reply
04-23-2018, 06:24 AM
Post: #5
RE: Help With Using the Math Module
(04-23-2018 01:40 AM)Gene Wrote:  Try setting flag 4. That allows the routines to be used as subroutines and should leave the complex results in the X and Y registers. That should allow you to have access to the values when SINZ.

Are you using the dedicated printer along with the HP 41 ?

Thanks for the second idea but it did not work.

I set flag 4 and I saw no difference in how the program worked.

I then ran the command (the SINZ one) again with the IR printer attached. The program did not run any differently but as expected it did send the output to the printer which I think would be expected for flag 21 being set ("printer enable").

So I went ahead and dug a bit deeper into my 41CX manual (appendix D to be specific, "Printer Operation") and found that if the computer thinks the printer is connected, then it will not pause between outputs whereas when it is present, will go through them without stopping.

I'll give you one guess what I had installed all this time? My IR printer module. With it installed, the flag 55 was set which indicated to the computer that there was a printer to which to send the output and thus not to stop between sending output to the screen.

As we like to say in our family after we do something boneheaded: "When in doubt, read the directions." LOL

This is a problem I should have not fallen for. I did a bit of coding "back in the day" (FORTRAN and C, does that date me??) so I should have remembered what I've told graduate students. I.e that computers are really good at following directions, even if they are not the ones you thought you gave them to follow. ;-)

I had made the assumption that the printer had to communicate back to the transmitter for the computer to think the printer is there. This is obviously wrong! :-O

It would have taken a LOT more time to work this out without you help. So with that in mind: Thank you very much!

Christine

Just a nerd girl with too much alphabet soup behind her name and an HP-41CX.
Find all posts by this user
Quote this message in a reply
04-23-2018, 06:34 AM
Post: #6
RE: Help With Using the Math Module
Quick update: I've also just discovered the PRTOFF command to suppress the setting of flag 55.

Getting there!!! :-)

Just a nerd girl with too much alphabet soup behind her name and an HP-41CX.
Find all posts by this user
Quote this message in a reply
04-23-2018, 09:41 AM
Post: #7
RE: Help With Using the Math Module
(04-23-2018 01:16 AM)ID_girl Wrote:  So I got myself a math module "MATH 1" p/n 5061-5261 "1C" module for my HP41-CX.

That's the early, original version. Later the math and statistics module were combined and labelled MATH/STAT. The box then included one module and two individual manuals.

(04-23-2018 01:16 AM)ID_girl Wrote:  Using the example in the manual for the Math Pac, I will run SINZ to calculate sin(2 + 3i). The output in quick succession with no pausing is:
U = 9.145
V =-4.169

The problem is that the first answer goes by so quickly I cannot read it fast enough to remember easily.

OK, the issue seems to be resolved now, but maybe some additional info will explain why this happened.

The HP41 series has VIEW and AVIEW commands that display X or Alpha while the program continues. This is a nice feature that allows for instance displaying successive approximations during an iteration loop while the calculation continues.

This means that if a VIEW or AVIEW directly follows another it will immediately clear the first message and show the second one:

"FIRST"
AVIEW
"SECOND"
AVIEW

...will produce a very brief, hardly visible display of "FIRST" which then is immediately overwritten by "SECOND".

This is what you described above. The "U=..:" message was directly overwritten by the "V=..." message.

But then, if a printer is attached and ready, VIEW and AVIEW also print X or Alpha. This way the quickly changing display is no problem because you can read the results in the printout. If a printer is enabled, flag 21 is set. But you can also set flag 21 manually. If you do so while there actually is no printer (!) – the calculator can detect this via flag 55 – your '41 knows that there will be no printout and... it will stop (!) at each VIEW or AVIEW. And this feature is what it's all about here.

So setting flag 21 will lead to the following result for VIEW and AVIEW:
- printer attached and ready: display content is printed, program continues.
- no printer: message is displayed, program stops, waiting for you to read the message. Continue with R/S.

This feature is used in the complex program. Take a look at the output routine starting at line 14:

Code:
14 LBL 00
15 FS? 04
16 RTN
17 SF 21
18 "U="
19 ARCL X
20 AVIEW
21 "V="
22 ARCL Y
23 AVIEW
24 RTN

The program first checks if flag 04 is set. If the user has done so this means that no labelled output is wanted and instead the program simply returns with the real and imaginary parts in X and Y.

Then flag 21 is set. So the following "U=..." and "V=..." output will be printed if a printer is attached, or else (without a printer) both messages will be displayed and the program will stop, waiting for you to read the two results, one after another.

That's why the above posts recommended checking flag 21 first. Actually this is not required since the program sets it by itself directly before the output starts. So with flag 21 set the program should have stopped after each of the two messages. But it didn't because your '41 was configured with an activated printer! So the calculator assumed that the results are printed and did not stop. So deactivating the printer fixed it.

You may also set flag 04 (SHIFT SF 04) so that the "4" annunciator in the display comes on. This causes the program to simply return the result in X and Y without the "U=..." and "V=..." message. This way you can use the various complex functions as subroutines in your own programs. So setting flag 04 does make a difference as it generates a different output. Press X<>Y to switch between the real and imaginary part of the result.

Dieter
Find all posts by this user
Quote this message in a reply
04-23-2018, 03:30 PM
Post: #8
RE: Help With Using the Math Module
(04-23-2018 09:41 AM)Dieter Wrote:  ...
(04-23-2018 01:16 AM)ID_girl Wrote:  Using the example in the manual for the Math Pac, I will run SINZ to calculate sin(2 + 3i). The output in quick succession with no pausing is:
U = 9.145
V =-4.169

The problem is that the first answer goes by so quickly I cannot read it fast enough to remember easily.

OK, the issue seems to be resolved now, but maybe some additional info will explain why this happened.

The HP41 series has VIEW and AVIEW commands that display X or Alpha while the program continues. This is a nice feature that allows for instance displaying successive approximations during an iteration loop while the calculation continues.
...

Dieter

Dieter,

This is great information. Thank you so much for writing up the explanation.

Before I read your reply I had been wondering how best to write a program that can have the desired output with and without the printer installed. What you wrote will help me do that. This will be a great help to me.

Thanks!

Just a nerd girl with too much alphabet soup behind her name and an HP-41CX.
Find all posts by this user
Quote this message in a reply
04-23-2018, 04:40 PM (This post was last modified: 04-23-2018 04:51 PM by Dieter.)
Post: #9
RE: Help With Using the Math Module
(04-23-2018 03:30 PM)ID_girl Wrote:  This is great information. Thank you so much for writing up the explanation.

You're welcome. But I just noticed I wrote that VIEW displays X. Of course you can VIEW any register: VIEW X, VIEW Z, VIEW 01, VIEW IND 15 ... ;-)

(04-23-2018 03:30 PM)ID_girl Wrote:  Before I read your reply I had been wondering how best to write a program that can have the desired output with and without the printer installed.

Here VIEW and AVIEW indeed are very useful. They are available on every standard HP41 so that no printer-specific commands like PRX or PRA are required. There even is an ADV command on every '41 that prints a blank line (paper advance). So you can write programs that run on any HP41 and nevertheless provide some formatted output if a printer is attached. On the other hand you can CF 21 to avoid that output like e.g. a short error message gets printed.

In the early Eighties I used these features quite a lot in my own programs – I wanted to acquire a printer sooner or later. But finally I never did... #-)

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




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