Arduino HP-25 Simulator
|
03-23-2022, 03:17 PM
(This post was last modified: 03-25-2022 02:00 AM by TellyS.)
Post: #1
|
|||
|
|||
Arduino HP-25 Simulator
(moved from the Articles Forum, where it was misplaced)
I purchased a couple of 3.5" TFT LCD screens for Arduino some time ago and I was looking for a project for them. I finally decided to replicate the functionality of my very first HP calculator, the HP-25. 2,500 lines of code later I managed to get something that looks like the HP-25 and, for the most part, behaves like an HP-25. Those TFT screens are not very reliable, so getting a few things to work properly was very hard. If you have 5 minutes to kill, you may want to watch it in action on YouTube: https://youtu.be/XZgH-pHiQMw What is not even close to the HP-25, however, is the accuracy of calculations and even the number representations. I relied on Arduino's built-in math library and number handling that is apparently not sufficient. Arduino float/double has a range of 3.4028235E+38 to -3.4028235E+38 and 6-7 decimal digits of precision. The 25 can handle much larger numbers and with greater accuracy. Any suggestions would be appreciated, if there is a solution. |
|||
03-24-2022, 02:04 AM
Post: #2
|
|||
|
|||
RE: Arduino HP-25 Simulator
Just a minor point, Classic HP calculators have lower case letters for function keys.
Eg [f] [g] and on some, [h] cheers Tony |
|||
03-24-2022, 12:52 PM
Post: #3
|
|||
|
|||
RE: Arduino HP-25 Simulator
I assume your emulator is written in C? What library did you use for the graphics?
Are you planning on publishing the code anywhere? I did something similar using a Raspberry Pi with a PiTFT recently using X11 and can say that I understand the difficulty you had when it came to calibrating the screen, it was a real pain in the rear. If you want to improve the accuracy of your emulator and actually simulate the original Woodstock processor (and others) feel free to borrow the processor emulation here. (Note that other simulators are available!) Mike T. HP21, HP25, HP32E, HP33C, HP34C, HP10C, HP11C, HP12C, HP32S, HP22S |
|||
03-24-2022, 01:40 PM
(This post was last modified: 03-24-2022 01:42 PM by TellyS.)
Post: #4
|
|||
|
|||
RE: Arduino HP-25 Simulator
(03-24-2022 02:04 AM)teenix Wrote: Just a minor point, Classic HP calculators have lower case letters for function keys. Tony, I tried! I really tried. The lower-case "g" is terrible in this font. "f" is decent, "g" is terrible. Here is an early attempt. What do you think? Telly |
|||
03-24-2022, 01:54 PM
Post: #5
|
|||
|
|||
RE: Arduino HP-25 Simulator
(03-24-2022 12:52 PM)Mike T. Wrote: I assume your emulator is written in C? What library did you use for the graphics? Mike, Yes, it is written in C. I used a couple libraries, but I ended up using LCDWIKI, downloaded from here. I encountered some issues however. For example, to clear the display, you would assume that drawing a black box would do it. However the black box cannot extend all the way to the other side. It wraps at about 4/5ths. So now, clearing the screen requires two black boxes! I am finishing the code shortly. The only button I have not implemented is EEX, because I wanted to see how I was going to deal with the inaccuracy of the Arduino calculators. For now, I will accept what it is - until I try the suggestions that were made in this forum - and will, then, share the code on Instructables. After finishing it and looking at the code, I am sure it could use a rewrite! I will look into your code. Thank you. I am still trying to understand the differences of sim- and emulator. Telly |
|||
03-24-2022, 03:49 PM
(This post was last modified: 03-24-2022 03:49 PM by Mike T..)
Post: #6
|
|||
|
|||
RE: Arduino HP-25 Simulator
(03-24-2022 01:54 PM)TellyS Wrote: I am still trying to understand the differences of sim- and emulator. As far as I could tell from some older posts if you were emulating the processor and other hardware, using the original firmware (or a version of it) it was a simulator, otherwise its is an emulator. Since it seems a reasonable distinction to make I try to follow that convention when posting here. That may be a rather simplistic view but it is one I can understand! Mike T. HP21, HP25, HP32E, HP33C, HP34C, HP10C, HP11C, HP12C, HP32S, HP22S |
|||
03-24-2022, 04:39 PM
Post: #7
|
|||
|
|||
RE: Arduino HP-25 Simulator
Love your project!
|
|||
03-24-2022, 05:20 PM
(This post was last modified: 03-24-2022 05:27 PM by Mike T..)
Post: #8
|
|||
|
|||
RE: Arduino HP-25 Simulator
Something similar using x11-calc with a PiTFT display, unfortunately the image is is lot less clear than the display actually is.
Had to align the touch screen by trial and error (mostly error) adjusting the parameters until it worked. I eventually resorted to using a q-tip so I had some idea where I was actually touching the screen when trying to calibrate it! Mike T. HP21, HP25, HP32E, HP33C, HP34C, HP10C, HP11C, HP12C, HP32S, HP22S |
|||
03-24-2022, 06:31 PM
Post: #9
|
|||
|
|||
RE: Arduino HP-25 Simulator
(03-24-2022 05:20 PM)Mike T. Wrote: Something similar using x11-calc with a PiTFT display, unfortunately the image is is lot less clear than the display actually is. That looks really great! Can you simulate the key-down, key-up action on this display? That's something I could not get it to work with Arduino. Pressing and holding on to SST, should display the command, releasing it should execute it. |
|||
03-24-2022, 06:33 PM
(This post was last modified: 04-01-2022 07:45 PM by TellyS.)
Post: #10
|
|||
|
|||
RE: Arduino HP-25 Simulator
(03-24-2022 02:04 AM)teenix Wrote: The only real way to address this problem is to add the ACT simulation code for the Woodstock calculators Tony, I am responding here on your post on the parallel thread we created. My code uses the various states that are needed to track the key entry and stores all commands the way the HP 25 codes them, so f-FIXED-02 is recorded as 140102. A list of states is shown below. I am really glad I own an actual HP-25, because I would not be able to do it without it. I am not sure what the ACT simulation code is that you mentioned. Is the approach you are suggesting discarding the code I have and work out a way to use the original firmware? That is interesting on its own and I would like to do another version of this with that approach, if you can guide me. Thanks, Telly |
|||
03-25-2022, 02:45 AM
(This post was last modified: 03-25-2022 10:32 PM by teenix.)
Post: #11
|
|||
|
|||
RE: Arduino HP-25 Simulator
It is only a suggestion as you may be satisfied with your simulator the way it is.
The ACT - Arithmetic Control Timing chip is in the HP-25 - 1820-1596 It is basicly the CPU of the calculator as amongst other things, it will get instructions from the ROMs and execute them to perform the required tasks. If you look at a code listing for the HP-25 you will see these instructions. If you look at the emulator at teenix.org you can see them in operation and how they affect the internal operating registers and memory. You could, if you wanted to, rewrite the code so that the native instruction set, along with the ROM code, will do all that the HP-25 does. There are examples on the web for decoding each instruction either in JAVA or C. I did mine in PIC assembler. You also have to provide the code with the appropriate values of each key press, the position of the Run/PRGM switch, decode the 7 segment display digits and provide access to each of the operating registers and memory. It is a big job but well worthwhile if you decide to pursue it. cheers Tony |
|||
03-25-2022, 02:48 PM
Post: #12
|
|||
|
|||
RE: Arduino HP-25 Simulator
Hi Telly,
Nice addition to the HP25 legacy, congrats! I am not sure if this is off topic but you may approach Bernhard (PANAMATIK in this forum). He has built a replacement of the ACT which tended to melt down if not handled with care (typically by the use of the power supply without batteries). He should be knowledgeable about the implementation of the original code into new hardware. Cheers, Frido |
|||
03-25-2022, 03:02 PM
Post: #13
|
|||
|
|||
RE: Arduino HP-25 Simulator
The NP25 source code could be a good exemple of an emulator running the original HP-25 ROM code on a microcontroller in C.
|
|||
03-25-2022, 08:17 PM
Post: #14
|
|||
|
|||
RE: Arduino HP-25 Simulator
Thank you all for your suggestions. I will return with a completed code and - I am sure - with questions on HP ROM implementation.
|
|||
03-25-2022, 10:40 PM
(This post was last modified: 03-25-2022 10:41 PM by Mike T..)
Post: #15
|
|||
|
|||
RE: Arduino HP-25 Simulator
(03-24-2022 06:31 PM)TellyS Wrote: That looks really great! Can you simulate the key-down, key-up action on this display? That's something I could not get it to work with Arduino. Pressing and holding on to SST, should display the command, releasing it should execute it. Yes Mike T. HP21, HP25, HP32E, HP33C, HP34C, HP10C, HP11C, HP12C, HP32S, HP22S |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)