Programming trouble



#14

hello
can t save any programmed program.
simple example:
<< -> A B 'A-B'>> STO TEST
errormessage:
"A" Invalid Syntax

why doesnt work that?
i hope anybody can help me


#15

If I'm reading you properly, you are pressing buttons in the wrong order.

<<

->

a

b

( <<operation of some sort>> )


ENTER

TEST

STO

>>

-Christof

#16

Hi;

Try this sequence:

<< -> A B 'A-B' >>

[ENTER] 'TEST' [STO]

If you want, try also this:

<< -> A B << A B - >> >>

[ENTER] 'TEST' [STO]

Both should work.

I believe you forgot a 'TEST' in your typing, betwen >> and [STO]. Anyway, before executing your program (TEST) you should supply A and B values: say, 2 [ENTER] 3 [TEST].

One point I did not get: the "A" Invalid Syntax message. Does it appear when you try to store the program or whern you execute it? If you store it successefuly, there are no syntax errors. If the message appears when you try using it, the only reasonable explanation is the previous existence of an A-variable with some object already stored in it. And it must be in the "working" directory OR IN ANY UPPER (FATHER) ONE. Check for its existence!

Hope it helps.

Cheers.


#17

thanx for answering my question.

i ve found the problem.
if i programm it in the RPN Mode, it will work...
but why doesnt work it on algebraic mode???


#18

I just happened to stumble on the answer to your question - shows how to do it in RPN and algebraic. Here is the link to hp.com - HP 48G Series and HP 49G Calculators - Storing and Recalling an Equation. The HP website has a few things in FAQs for each calculator, but if you use the search with a model (like "hp49g") and a keyword (I used "solver" to get this one) there are more articles.


#19

I'm just learning to use my new 49G and I see that the info I pointed to on the HP website only tells how to save something in RPN or algebraic mode. Even though the article is written for an equation the instructions for saving apply to a program as well. To figure out how to execute the program in either RPN or algebraic mode, I had to resort to reading the manual. It is very brief but if I keep in mind what the manual says it is at the beginning - a wide ranging INTRODUCTION to features and functions - it's pretty good. Anyway, section 10 - Programming tells in the first few pages how to write, save, and run a program, but only in algebraic mode. Since Christof and Luiz showed how to do it in RPN mode (the manual tells you to look on the internet for RPN instructions!), now I think I have a good start. It seems peculiar compared to RPN but to run a program in algebraic mode you have to treat it like a Basic function - put the parameters in parentheses separated by commas. Undoubtedly the algebraic interpreter is pushing the parameters on the stack "for you". So to run the example in algearaic mode:

TEST(x,y)[enter]

in RPN mode:

x [enter] y [enter] TEST [enter]

or, if "TEST" is in the menu line:

x [enter] y [TEST]

Algebraic is more work especially because parentheses and comma are shifted keys.

I think the reason I never made any progress with the 28 or the 48 is I never got straight in my mind what type of object each of the different delimiters is for. I'm going to make myself a 3X5 card spelling it out and then see how I do with the 49G. (Now that I think of it, the 28 might have had that printed on the left keyboard - but writing it is a good way to impress it on the memory.)


#20

I used "x" and "y" out of habit in my examples but now I wonder: assuming that in algebraic mode, the 49g is pushing the parameters on the stack, does it start with the parameter on the left or the right? And how does that relate to the list of local variables in the program? That doesn't seem to be spelled out in the first few pages of section 10 of the manual, although page 10-5 does tell the difference in how you run a program in RPN vs. algebraic mode.


#21

I haven't gotten into the 49g much yet- I'm sort of going in a combination of history and power as I sit through a mostly boring summer term.

(I'm about done playing with the 20s, it's programmable, but limited almost painfully. The 32sii will be put on the shelf as a backup in about another week and I'll just use a 42s for pocket. for RPL I'm mostly using the 28s right now instead of the 48sx. I suppose I'll move on to the 49g for actual carrying around sooner or later- it runs emacs, after all)

Delimiters I somehow just used until I knew them insternally- I guess this is what me constantly writing dozens of "useless" little programs is for :)

There may be some info on area48.com, though I think the best bet would be to put the questions on the newsgroup. I'll keep an eye out as I haven't looked at the algebraic programming at all.

-C


#22

Hi;

may I point some things out?

Since the very appearance of the HP28 (C, remember?), the algebraic X RPN/RPL quiz became one of my personal battles. Which one to use? (a bit off topic, but more than that, defining our own unit as a new algebraic object amused me, too)

When I write programs for any RPL calc I use as much algebraic as comprehension is required, so I myself am able to understand my own programs later. Using algebraic expressions as program resource is, sometimes, a must. I completely agree with many contributors in here that state that extensive use of RPL, mostly stack manipulations, will cause a program to be unreadable and hard to understand. I have programs written some years ago I cannot easily change or add features, because I simply do not remember what the h... that ROLLD or PICK use as parameter, so I must step through almost all the program to get to the point and find out the parameter value. Gee!

And when previous stack contents are needed and the programmer (me) did not use local variables? Who in Heaven can tell? If a simple

 << -> A B C << .... >>  >>
is there, no matter at all! In this case, using
value [ENTER] value [ENTER] value [ALPHA] [ALPHA] program_name [ENTER]
is easy. Also, using algebraic feature (since the HP28), we have:
[ALPHA] [ALPHA] program_name[(] value [SPC] value [SPC] value [ALPHA] [ENTER]
. Both will work fine. What matters is, for me, how to handle them inside the inner << and >>.

When only 4-plus-1 level RPN calcs were available, anything should "chronometrically" fit in the stack. Debugging was easier, mostly because T-values were simply lost OR duplicated (how I miss this duplication sometimes...). Some new RPL features for handling objects in the stack are very important tools, but also more data to process (in our brain).

Wanna know? The fact is that programming them all is still funny. After all.

Comments? Corrections? All wellcome.

Cheers.

(Hey, Mr. Belillo; proud of me?)


#23

I am a little confused because the manual says it only covers algebraic mode usage but (thankfully!) throws in a little RPN mode.

I followed your suggestions and experimented with simple programs that do the same thing in RPN or algebraic. I see that the syntax of elementary operations as well as functions like SIN depend on whether they are inside ' ' or << >>. I also see that I can run either type of program with the calculator in algebraic or RPN mode, as long as I pass the parameters correctly. Is it correct to think that while a program is running, the calculator essentially switches to algebraic mode when it encounters the ' ' delimiters, and switches to RPN mode for << >> delimiters?


#24

Hi;

I work with computer architecture (no deep knowledge, only enough to teach elementary structure) and I know Von Newman's based machines essentially work in a RPN-fashion arithmetic, say, operands first, operation last (even if the mnemonics predicts ADD A,#200 the addition is the last thing to be performed). I read here, at this very Forum and more than once, that even Algebraic-only calculators (Casio, TI, and others) must stack algebraic tokens first (Katie mentioned this technique in previous recent threads), so error checking and performing operations take place.

The HP49 is not an exception, mostly because it uses both operative paradigms. Dealing with operands and operations in RPN fashion is natural for the processor. I would go farther (but I am not completely confident) if telling you that the O.S. disassembles algebraic objects into RPN procedures, and never switches to an algebraic internal mode. But I'll wait for the guys who can tell it better.

Hope it helps.

(Suggestions, comments, always welcome)

#25

Christof wrote:

"I guess this is what me constantly writing dozens of "useless" little programs is for :)"

I know that's what it takes - practice makes perfect - and the Forum provides plenty of examples to try.


#26

And I've gone insane!

Some parts of my current classes are just boring enough that I've written a working low grade (*extremely* low grade, like late 19th century) crypto handler for the 20S, as well as a decently useful multi-sided die roller.

I'd almost be embarrassed to post them, it's such simple stuff.

-C


Possibly Related Threads…
Thread Author Replies Views Last Post
  trouble flashing wp34s under Linux Glenn Becker 8 2,896 07-23-2013, 02:21 AM
Last Post: Marcus von Cube, Germany
  TVM WP34s trouble Jim P 4 1,838 06-28-2013, 07:31 AM
Last Post: fhub
  Trouble dumping Pioneer ROM via IR Neil Hamilton (Ottawa) 6 2,565 06-20-2013, 08:14 AM
Last Post: Neil Hamilton (Ottawa)
  41CL :TROUBLE IN FILE TRANsFER aurelio 22 6,388 06-18-2013, 03:44 PM
Last Post: aurelio
  Trouble entering a HP35s program line Arno 2 1,589 04-05-2013, 06:28 PM
Last Post: Arno
  wp34s reflashing trouble... Calckidd (USA) 3 1,401 03-04-2013, 04:32 PM
Last Post: CalcKidd (USA)
  [41CL] Trouble compiling CLWriter.cs Dan Grelinger 3 1,680 02-17-2013, 10:52 PM
Last Post: Dan Grelinger
  Trouble with RS-232/HP-IL Interface (HP 82164A) Hans Holzach 9 3,353 01-08-2013, 01:52 AM
Last Post: Marcus von Cube, Germany
  HP28S battery door trouble David Griffith 23 6,329 02-08-2012, 08:24 AM
Last Post: Neil Hamilton (Ottawa)
  WP 34S: trouble with CLSTK Miguel Toro 4 1,358 10-22-2011, 07:36 AM
Last Post: Miguel Toro

Forum Jump: