HP 35S Error Handling
|
10-28-2017, 04:04 PM
Post: #1
|
|||
|
|||
HP 35S Error Handling
Is there a way to handle an error without halting a program? For example the following will produce an INVALID (I) message if there is no value in (i) and halt the program:
Code:
The same error also applies to equations: Code:
I am looking for a way to let the user know that there was an error and to try again. Any help would be much appreciated. I did notice that execution is halted at the offending line and if R/S is pressed the error will come up again. I can put a new value in I and if there is a value in the new (I) the program will continue to run. Or I can manually put a value in (I) and continue that way. Both of these solutions work but are not optimal. |
|||
10-31-2017, 05:57 PM
(This post was last modified: 10-31-2017 05:57 PM by Dieter.)
Post: #2
|
|||
|
|||
RE: HP 35S Error Handling
(10-28-2017 04:04 PM)JeremyBeck Wrote: Is there a way to handle an error without halting a program? No. The only way to control error messages is the use of flag 5/6. If flag 5 is set, an overflow error will not just briefly display "OVERFLOW" and then continue (default) but the program will be stopped. Otherwise there is nothing like the HP41's error flag 25. (10-28-2017 04:04 PM)JeremyBeck Wrote: For example the following will produce an INVALID (I) message if there is no value in (i) and halt the program: The program will not produce an error if register (I) is empty. Instead an error will occur if register (I) is not assigned (!). By default there are no indirect registers at all. Only if you store a non-zero number in register n, all registers from 0 to n will be allocated. For instance 20 STO I and then 111 STO(I) will allocate 21 indirect registers from R000 to R020. So if you plan to use registers from 0 to 100, simply store a value in R100 (or better: in R101) and all registers up to R100 become available. At least unless you run out of memory. (10-28-2017 04:04 PM)JeremyBeck Wrote: I am looking for a way to let the user know that there was an error and to try again. Any help would be much appreciated. I fear there is not much you can do in this regard. (10-28-2017 04:04 PM)JeremyBeck Wrote: I did notice that execution is halted at the offending line and if R/S is pressed the error will come up again. Sure. In this case the R/S tries again to execute the command that caused the error. So of course the same error occurs again. For the case you mentioned you could initially define a maximum number for I that is stored somewhere (e.g. 100 STO M) and allocate this number of registers by RCL M 1 + STO I STO(I) This stores 101 in R101 so that R000...R100 are available for your data. Then, after the INPUT I prompt, simply check if the entered value is ≤ M. Code: I001 LBL I Dieter |
|||
11-02-2017, 11:22 PM
Post: #3
|
|||
|
|||
RE: HP 35S Error Handling
Thanks for the reply Dieter. I did try as you suggested and allocated the first 100 registers by storing 0 in an (i) of 100. this stopped the error when recalling (i)50 for example. a zero is returned instead of INVALID(I). I will just have to keep track of what I am entering so as to get the correct results.
One other question I had is that I am working on several programs (one of which is a program to store a point with coordinates in storage registers 1 through 100 as a vector in the format of [northing, easting, elevation]). the program works as intended but I would like to share my programs for other users who might find them helpful. Would this forum be the place for that? |
|||
11-03-2017, 07:38 AM
(This post was last modified: 11-03-2017 07:49 AM by Dieter.)
Post: #4
|
|||
|
|||
RE: HP 35S Error Handling
(11-02-2017 11:22 PM)JeremyBeck Wrote: Thanks for the reply Dieter. I did try as you suggested and allocated the first 100 registers by storing 0 in an (i) of 100. Of course you have to store a non-zero (!) value in R100. (11-02-2017 11:22 PM)JeremyBeck Wrote: this stopped the error when recalling (i)50 for example. a zero is returned instead of INVALID(I). Yes. Now R000....R100 are allocated and useable. Since nothing has been stored in R50 before it is recalled as zero. (11-02-2017 11:22 PM)JeremyBeck Wrote: One other question I had is that I am working on several programs (one of which is a program to store a point with coordinates in storage registers 1 through 100 as a vector in the format of [northing, easting, elevation]). the program works as intended but I would like to share my programs for other users who might find them helpful. Would this forum be the place for that? If you want to publish programs for the 35s you should do so in the General Software Library section of this forum. The subject line should start with "(35s)". If you can't find your program after posting: that subforum is sorted in alphabetical order, you may have to switch to "last post on top" manually. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)