RPN Calculator for PicoCalc V1

This project implements one RPN Calculator (Polish Reverse Notation) for the PicoCalc, inspired by the HP48 series. The calculator takes advantage of the PicoCalc’s graphical display to display the stack and hierarchical menus, offering an experience similar to classic scientific calculators.

Main features

  • Interface with stack of up to 100 levels.
  • Data entry with basic editing (backspace, deletion).
  • Angular modes: SDR, RAD, GRA.
  • Numeric format modes: NORM, FIX, SCI, ENG.
  • System of hierarchical menus to access advanced features.
  • Screen of integrated help .

(En español únicamente, al menos por un par de semanas ; )

6 Likes

Looks great…
Since I personally is not a fan of RPN’s, have you considered making a “normal” variant?

Yeah, I’ve thought about that. Actually, I built a Python version of the Casio FX82 that looks and behaves just like the real thing… only on PC.

Writing an infix notation parser in BASIC is way more complicated—that’s why the early calculators went with RPN.

That’s also why it was much easier for me to do it this way: at the end of the day it’s just a stack, and… not much else!

2 Likes

@ArielPalazzesi My message was misplaced in the other thread. Let me make a copy of it here =>

Very nice ! I found a few things tho :

1 - X X X 7 7 “^” →error, after “ESC” it doesn’t display the entry back, but it’s still there hidden

2 - 171 ! → gives a basic error and exit the calculator (and “run” loses the stack)

It’s nice to have a calc in picocalc already ! :slight_smile:

1 Like

I got my first HP in university, so 45+ years ago. My brain still prefers RPN and RPL. Not sure which models I had along the way, but my current one is the Prime.

My Spanish in non-existent so I’ll have to wait for an English version.

Hello friends!
Thank you for your comments and bug reports.

I promise I’ll fix them soon. First I want to finish another project I’m currently working on (this time on the uConsole using Python, image later), and then I’ll return to complete the calculator.

I’m planning to change the stack structure to support complex numbers (at least), and to make it multi-language — meaning the user will be able to choose the interface language.

The language issue is… really a challenge. Naturally, I feel much more comfortable and productive working in Spanish, but most people who use these devices are more familiar with English. So in the project I’m developing for uConsole, all the UI text is already stored in a “dictionary,” so users can switch languages (see image below).

In the case of this calculator, implementing something similar would require rewriting a good portion of the code, so I kindly ask for a bit of patience.

I’ll be on vacation in January, and although I’ll be away for about 3 weeks, I think I’ll still have time to address everything you’ve mentioned.

Thank you — and sorry for the delays.

1 Like

There is no rush. Much better to take your time, and get things the way you would like them.

I understand the conflict of having multiple projects on the go, and trying to decide which gets worked on.

Have a great day.

1 Like

Das ist richtig gut gemacht. Auf jeden Fall weitermachen.

1 Like

Here is a little RPN calculator I made for the PicoCalc. It just a little different from the HP calculators in that you have to hit ENTER after keying in every number and command and function. That is because of the INPUT command I used to inter the data and functions. I wrote it in MMBasic so it is easy to modify if you want to add any more functions. Below is a formula for calculating the mach number for a jet.

Given a pressure altitude of 25,500 feet and a calibrated airspeed of 350 knots, the following formula calculates the Mach number of the aircraft:

(5[({[(1+0.2[350/661.5]^2)^3.5-1][1-(6.875*.000001)25500]^(-5.2656}+1)^0.286-1])^0.5
= 0.84 Mach number

Try using this formula on an algebraic calculator and then on a RPN calculator. Remember, on the RPN calculator you want to start inside the ()’s and work your way out. The answer is 0.84 Which do you prefer? - Jim

Option EXPLICIT
Dim STACK(6), Value, A, B, RESULT As FLOAT
Dim I As INTEGER
Dim AAA$, c, q As STRING

For I = 1 To 6
STACK(I) = 0
Next I

Do
Cls
Print " < RPN Calculator >"
Print
Print " Enter a number or operator:"
Print " (+ - * / ^ sin cos tan {Deg})"
Print " (c to Clear Stack, q to Quit)"
Print
Print
Print " T > "; Stack(4)
Print
Print " Z > "; Stack(3)
Print
Print " Y > "; Stack(2)
Print
Print " X > "; Stack(1)
Print
Input " > > "; AAA$

If AAA$ = “q” Then Exit Do
EndIf

If AAA$ = “c” Then
For I = 1 To 6
STACK(I) = 0
Next I
EndIf

Value = Val(AAA$)
If Value <> 0 Then
For I = 6 To 2 Step -1
STACK(I) = STACK(I-1)
Next
STACK(1) = Value
EndIf

If AAA$="+“Or AAA$=”-“Or AAA$=”*“Or AAA$=”/“Or AAA$=”^"Or AAA$="sin"Or AAA$="cos"Or AAA$="tan"Then

Select Case AAA$
Case “+”
RESULT = STACK(2) + STACK(1)
Case “-”
RESULT = STACK(2) - STACK(1)
Case “*”
RESULT = STACK(2) * STACK(1)
Case “/”
If STACK(1) <> 0 Then
RESULT = STACK(2) / STACK(1)
Else
Print “Division by zero!”
Pause 2000
Continue DO
EndIf
Case “^”
RESULT = STACK(2)^STACK(1)
Case “sin”
RESULT = Sin(Rad(STACK(1)))
Case “cos”
RESULT = Cos(Rad(STACK(1)))
Case “tan”
RESULT = Tan(Rad(STACK(1)))
End Select
For I = 2 To 5
STACK(I) = STACK(I+1)
Next I
STACK(6) = 0
STACK(1) = RESULT
EndIf
Loop

2 Likes