The HP 28S programmable calculator

 

The HP-28C/S programmable pocket calculator shown above was the first machine offering RPL (Reverse Polish LISP) as its programming language - it by far outperformed its predecessors like the HP 67 or the HP 41C/CV/CX in terms of sheer speed as well as in programming capabilities. With 32 kB of RAM (HP 28S, the HP 28C only had 2 kB of RAM) it is a programmers dream and way more than just another programmable pocket calculator.

Prior to the HP 28S I had and used a HP 48GX mainly, but, to be honest, I never got acquainted to the plethora of menus which hid the functions from me and the cluttered keyboard with its three shift keys (this is exactly what HP tried to overcome with the transition from the HP 67 to the HP 41C - some ten years later the number of functions grew so heavily that three shift keys (including an Alpha key) and lots of (counterintuitive) menus were necessary again) so I used it as my main work horse, but not as something I would program just for fun.

I always liked the HP 28S more - with its clamshell design (it opens like a book and features a complete alphanumeric keyboard which simplifies programming a lot) and its simpler menu structure than the HP 48GX it always attracted me more than the HP 48GX did.

When my friend Götz gave his HP 28S to me as a wedding gift, I was (and still am :-) ) in heaven - now I eventually had the calculator I dreamed of for a long time (thank you very, very much again, Götz!).

It took me more than a year to finally write a small page describing this calculator but here it is.

Taking care of the HP 28S:

All in all there is only one thing about the HP 28S which maybe could have been done better: The main problem is the battery compartment (the HP 28S takes three so called Lady-cells which are rather hard to find at the time of this writing - I have found accumulators in the very same format which work great in the HP 28S and replaced the batteries by these) - its sliding door tends to break! This is a real problem since the batteries make contact to springs which create quite some pressure so it is not easy to replace a broken battery compartment door by something else. The door on my calculator had been broken many years ago and the batteries are held in place by the damaged door and a bit of brown tape which works quite well but it surely doesn't look very nice.

Example programs

As I already noted, the HP 28S features RPL (Reverse Polish LISP) as its programming language. RPL looks a lot like Forth (of course, it is stack based - it is an HP made pocket calculator!) but is more powerful than a simple forth.

First of all it features an arbitrarily deep stack, so there are no X-, Y-, Z- and T-registers like on the HP 67 or HP 41C calculators. This implies that there is nothing like RDN but there are functions like DUP and DROP which are very familiar to anybode having had a look at Forth- or Postscript-code.

In the following I will present some short (only two at the moment) example programs I have written. The first implements a clock (I never have a clock at hand - I do not like wrist watches (I am too thin for wrist watches to look good), but I always have a pocket calculator with me, so why shouldn't I use this instead of a clock.

Unfortunately there is no built-in clock functionality in the HP 28S like there is in the HP 48GX, but the HP 28S has a clock register which will be incremented in stand-by mode as well as during run mode. So this register (its contents) can be used to implement a simple clock which is sufficient for most purposes (parts of the following program have been stolen from somewhere but I can not remember where I picked up the pieces, sorry!).

The following RPL-program implements a simple clock which can be read out by simply executing the program. I stored it in a variable called TIM in a subdirectory TOOLS (by the way: RPL-programs are bracketed by french quotation marks - I will use << and >> to replace these in the following, accordingly there is a special right arrow on the HP 28S-keyboard which I will represent by ->, the comments on the right are, of course, NOT part of the program):

<< RCWS 64 STWS              Remember word length and set it to 64 bit
   +4554d SYSEVAL            Read the time register and convert the
   B->R                      64-bit number to a real value
   29491200 / 19.2 + 24 MOD  The 19.2 is MY correction factor, you will have
                             to adjust it to meet your location and your
                             calculator's clock
   ->HMS                     Convert the resulting value to HH.MMSS format
   4 FIX RND STD             and round it to four decimal places
   SWAP STWS                 Then restore the original word length
>>
          

The next program is a bit more sophisticated - it is yet another implementation of the Ulam series: Start with an positive integer value. If it is even, divide it by two, if it is odd, multiply it by 3 and add one. Repeat this until you reach 1 (it is unclear whether every value will eventually yield 1!). The following program implements this series and will display the series elements in the upper left corner of the display. When 1 is reached, the program halts and leaves two values on the stack: In level 2 the number of iterations it took to reach 1 and in level 1 the sum of all series elements so far:

<< CLLCD                         Clear the display
   0 OVER ROT                    And create two additional stack elements for
                                 the iteration counter and the sum
   DO                            Start of the main loop
     IF DUP 2 / FP 0 SAME THEN   If the number is even,
       2 /                       divide it by two.
     ELSE                        Otherwise
       3 * 1 +                   multiply by three and add one.
     END
     DUP                         Duplicate the current series element
     1 DISP                      and display it in row one of the display.
     DUP ROT + ROT 1 + SWAP ROT  Update iteration counter and sum
   UNTIL                         Until
     DUP 1 SAME                  the current series element equals one.
   END
   DROP                          Remove this last series element and
   CLMF                          restore the display.
>>
          

Other resources on the net

  • As with all HP calculators, the main site on the internet is The Museum of HP Calculators which contains an incredible amount of background information on these great calculators.

 

 

ulmann@vaxman.de

webmaster@vaxman.de

24-JUN-2007