MCODE - Unit Conversion


Good news for those interested in archeological achievements :)

I finally cracked the unit conversion functions implemented in the Thermal-1A module - a very nice implementation that I always regarded as a great example of the 41 system capabilities.

I've added the electrical units to the built-in ones, more for the sake of completion than for actual practical purposes - given that SI units are the only practical ones used in electricity.

I love its homogeneity checks, like Horse Power -> Ohm x Amp^2

Will post it at TOS shortly, but I just thought someone out there will be interested in a heads-up.



Yeay!! Kudos.

Eagerly awaiting TOS upload.


Awesome! Will you post it with comments? (pretty please, pretty please...)




Here are the new units added:












There's still room for some more - any wishes??


AU, Lightyear, lightminute

does it have gauss/tesla ?




Cool! I have never tried the unit conversion feature before, though I know it exists in various modules.

This sparks my interest to take a look at it.


guys, there's enough units to fill a 32k rom with them :)

I meant to ask about "electrical" units - call it my tribute to my EE years, I still remember longing gor them when I was in college, so this is payback time in some regard.

But not to worry, you can add your own after you see how it works - just give me a couple of days to finish the "blueprints".

Here's the alphabetical list of new units I've added:


next on my list is a catalog function that shows the unit names in sequence... anybody wants to help?


Edited: 26 Mar 2010, 3:22 p.m.


Did you really have to add KiloOHM, MilliHENRY, and PicoFARAD? I thought they already handled SI prefixes? (Or was that a feature that was added for the 28/48 unit conversions?)


No support for multiple/submultiple chars in the implementation exists - so yes, they have to be added individually.

mH, pF, and kOhm are more typical than their |proper| SI counterparts and therefore the addition...


The fabulous HP Unit Management system was first presented by HP's Eric Vogel on 3/28/81 at the 1981 HP Handheld Conference in Rockville, Maryland. A full 32 pages of the conference proceedings consisted of Eric's material, presented as it first appeared in the HP41 Petroleum Fluids Pac. I remember the audience being amazed. Following the dinner after the one-day affair, Richard Nelson, Irv Weiner (the Providence, RI PPC chapter coordinator), Eric and I returned to the conference meeting room to chat and wound up staying there until 6:30AM the next morning. Fun times.

Jake Schwartz


oh my, did those proceedings survive the passing of time or are they lost forever??

it's not that I would have liked having them before, I've had a great time deciphering this rosetta stone - one of the best ones so far!

I'm curious to see if the assumptions I've made align with the original designer goals.- after all reverse-engineering code is always tricky.-

The main unknown was which code to give to the new primary magnitude (the electric current), as all dimensional checks will use it and should be uniquely characterized. I opted for a nice prime -unlucky for some- number and it seems to work quite well :)

And sure I agree, there's nothing short to fabulous in this implementation, still today!





oh my, did those proceedings survive the passing of time or are they lost forever??

They survive in the PPC CD#4 disk of conference proceedings from 1979-1999 along with all the Australian HP calc newsletters, but I just put up a copy of that proceedings (around 10 MB) here for viewing or downloading if anybody is interested. None of the pdf bookmarks in the left column will work except for the "contents" one, but Eric's material can be found from pages 13 to 44.



Got it , many thanks. I guess I should be placing an order for the new DVD to have the complete story.



I thought Petroleum Fluids ROM had the latest and greatest version, following after the Machine Design ROM and the Thermal Transport ROM. Do I have the history wrong?


HP's most complete implementation of unit conversion for the 41 was in the Petroleum Fluids ROM.

It was extremely clever how they tracked the dimensionality. The general idea was to multiply and divide by prime numbers, so if length (m) was assigned 2, and time (s) was assigned 3, then m/s^2 would be 2/9. However, since multiplication and division are relatively expensive on the Nut processor, they added and subtracted logarithms instead, using a 10 bit field. It is possible to find inconsistent conversions that they won't detect, but it is extremely unlikely in practice.

Edited: 27 Mar 2010, 9:07 p.m.


Yes, I figured that already. I have used 19 (13 Hex) for the Ampere and so far it seems to be uniquely differentiated in all the derived dimensions I've tried.

Possibly Related Threads...
Thread Author Replies Views Last Post
  HP 35s polar/rectangular conversion CD Dodds 6 1,213 11-28-2013, 02:39 PM
Last Post: Dieter
  HP-41 MCODE: The Last Function - at last! Ángel Martin 0 518 11-08-2013, 05:11 AM
Last Post: Ángel Martin
  [WP 34s] Pressure Conversion Factors Timothy Roche 8 1,526 11-04-2013, 07:17 PM
Last Post: Dave Shaffer (Arizona)
  More programs for polar-rectangular conversion on HP Prime Michael de Estrada 4 1,044 11-04-2013, 12:43 AM
Last Post: Michael de Estrada
  Unit circle on HP Prime Mic 2 633 08-28-2013, 05:22 PM
Last Post: Thomas Klemm
  HP Prime: Conversion factors Paul Townsend (UK) 19 2,248 08-27-2013, 09:19 AM
Last Post: Nigel J Dowrick
  41-MCODE: Auto XEQ+ALPHA possible? Ángel Martin 5 993 05-29-2013, 06:15 AM
Last Post: Ángel Martin
  HP 41 Mcode related Questions Michael Fehlhammer 4 932 05-10-2013, 07:09 PM
Last Post: Michael Fehlhammer
  Unit conversions inside programs on 50g Chris Smith 2 670 02-23-2013, 05:35 AM
Last Post: Chris Smith
  41-MCODE: Breaking the FAT barrier. Ángel Martin 0 464 09-03-2012, 06:31 AM
Last Post: Ángel Martin

Forum Jump: