The Museum of HP Calculators

HP Forum Archive 13

[ Return to Index | Top of Index ]

8051 as HP-41 module?
Message #1 Posted by Ben Moss on 14 Aug 2003, 3:08 a.m.

I have been considering the possibility of using an 8051 microcontroller to act as one of the HP41 ROM modules. I would like feedback on some of my early ideas.

From reading the articles at Meindert's MLDL site (Meindert, you have one impressive gizmo!) the clock on the serial line is at 359kHz. A typical 8051 can run 10-20MHz, so it can process at least 30 instructions in the time one bit goes by on the serial line. If the ROM image from the module is kept in internal memory of the 8051, I think that is plenty of time to do the necessary thinking to send out the data on the serial line.

Atmel sells a variety of 8051-derivative microcontrollers with 32K of flash (and in-system programmable) memory, internal oscillators, and plenty of I/O pins to do the job. These chips come in PLCC packages which are small enough to fit in a module case. The 8051 would probably draw somewhere between 15-25mA while in operation, which is a bit steep... if the clock speed is kept down the power consumption would be less. These chips can run off of 6V - a single chip could do everything. A level convertor (like a MAX232) would be needed to reprogram the chips (like if you wanted to change from a Game to a PPC rom) but that could easily be outside of the module.

Now, the tricky part. The HP-41 is a 10 bit machine, and the 8051 is an 8-bit machine. To make the 8051's job easier, I think the ROM image should be broken up into 10-bit chunks, with each 10-bit chunk occupying 2 bytes in the 8051's memory. There will be 6 bits wasted per every 10-bit word, but since there is memory to spare, it won't be a problem. It will also be tricky to keep track of the necessary timing so that the 8051 receives and talks to the HP41 correctly.

I think this could work. Anybody have ideas, or lots of experience with 8051 chips? Anything horribly wrong with what I have thought up so far?

Thanks, -Ben M.

Re: 8051 as HP-41 module?
Message #2 Posted by Vassilis Prevelakis on 14 Aug 2003, 6:00 a.m.,
in response to message #1 by Ben Moss

There is already a PIC based version designed by ji. The system is described at

The problem with the PIC is that the high clock rate causes it to eat up too much juice. Also the fact that the PIC core has to be running to see whats on the bus, does not allow the MLDL to go into sleep mode, so it drains even more power.

To avoid draining the HP-41 batteries, I placed the PIC board into a printer enclosure so that it can be powered by the much larger printer battery pack. Pictures are at

The FPGA version should solve the power consumption problem. However, it introduces a new one: size. The FPGA is too big to fit into a module so you need to use a card reader enclosure.

Re: 8051 as HP-41 module?
Message #3 Posted by Diego Diaz on 14 Aug 2003, 7:57 a.m.,
in response to message #2 by Vassilis Prevelakis

Hello Ben, Vassilis.

I've done some job on the hardware side of the PIC-ROM modules approach.

As a result, the layout of a module-sized (23 x 14mm) PCB is on my drawing board rigth now, it contains the PIC18LF252 (SMD), 40Mhz Xtal, 2x15pF caps, and 2x1n4148 in series with V+ line just to pull it ~1v down. I think that nothing bigger than a 28pin SO SMD device can fit into a HP-41 module, and even this has some difficulties to manage with such an small area (less than 1/2 sq inch!!.)

I'm now dealing with the PIC programmer, and hope to have it working in a few days.

Vassilis, it seems that you have already developed the required software to deal with the HP-41 I/O lines, wich is BTW the most difficult part of the job. Your info will be of great help to me, if you feel the will to share it. I'd also like to know if the B3-B4 lines handling and the BankSwitching are implemented in your design.

Thank you.

(remove the NO-SPAM if you want to mail me)

Re: 8051 as HP-41 module?
Message #4 Posted by Ben Moss on 14 Aug 2003, 10:43 a.m.,
in response to message #3 by Diego Diaz

Hello Diego, Vassilis.

What would be an acceptable level of current consumption to run the module off of the calculator's batteries? I have found several chips that draw slightly less than 10mA in operating mode at 10MHz.

Thanks, Ben

Re: 8051 as HP-41 module?
Message #5 Posted by Diego Diaz on 14 Aug 2003, 2:06 p.m.,
in response to message #4 by Ben Moss

Hi Ben,

Typical Idd vs Vdd @ given Osc Freq. chart for PIC18LF252 in HC mode (Xtal operated), shows 7.5mA for 5v. Vdd @ 20MHz. This is much more than a *real* HP-41 module, but I think it's still low enough for the 41 to handle.

Anyhow I'm confident about beeing able to manage with SLEEP mode, wich will ask for a few A only.

You can chek the full specs for that PIC at, make a search for 18F252.


Slowing CLK down?
Message #6 Posted by Vieira, Luiz C. (Brazil) on 15 Aug 2003, 2:46 a.m.,
in response to message #5 by Diego Diaz

Hi, folks;

As Ben mentioned in starting post, the 8051 has plenty of "waitting time" between two bits if working at 10-20MHz. Also, Diego mentions using a 20MHz CLK PIC and Vassilis is using an ATMEL chip (probably fast, too).

As Ben's first idea is emulating ROM moduless, I'd like to know if a lower clock-while-active (and consequent low power consumption in most cases) wouldn't be a better choice if applicable. In this case, how many cycles would any of these processors need to "push" the next bit out of its internal flash memory? If I am not wrong, bit manipulation facilities in the 8051 are restricted to internal RAM, although it has a serial OUT pin and I'm not sure if TX-rate is clock dependant. Also I'm not aware of the ATMEL and/or PIC instructions and if they would allow a better data handling than the 8051. As they are newer designs, it's possible that they will.

Have you, guys, also thought about I/O implementation other than IL-compatible? I know this is something that would never work if standard protocol is not set firstly, but I do not like to think that I depend on HPIL devices to transfer data from/to the HP41.

I'd like to be in contact with you all about these subjects, may I? For these days I've been working with some heavy activities and my spare time is none; I can barely read new posts. But I'll find a way to follow this subject as I can.


Luiz ((Brazil)

Edited: 15 Aug 2003, 2:47 a.m.

Re: 8051 as HP-41 module?
Message #7 Posted by Vassilis Prevelakis on 15 Aug 2003, 3:02 a.m.,
in response to message #3 by Diego Diaz

Actually all I did was stuff the PIC board into the printer enclosure (and take lots of pictures).

ji at tla dot org is the person to contact regarding the actual implementation.

I am trying to do something similar for the HP-85 ROM modules though, but I am a bit busy at the moment.


Re: 8051 as HP-41 module?
Message #8 Posted by Meindert Kuipers on 17 Aug 2003, 2:37 p.m.,
in response to message #2 by Vassilis Prevelakis

I'm back form my vacation and ready to join the discussion. Have a look at the products fron Cygnal at These are very small and include oscillator, power regulator and a full 8051 with pretty low power consumption. These should fit inside a module housing as the require virtually no other extrenal components.

As most of you are aware of, I am building an MLDL with an FPGA but I have been seriously looking at the small microcontroller products, but the main problem is that they lack serious amounts of memory, otherwise I would certainly have chosen one. Especially the USB version are great!


Re: 8051 as HP-41 module? a note or two about 8051s
Message #9 Posted by Bill Wiese on 14 Aug 2003, 4:19 p.m.,
in response to message #1 by Ben Moss

Hi... Just remember that many 8051 CPUs - at least of original design - run at 12 clock states min. per instruction. (Some take longer). That is, many 12MHz 8051s effectively give a 1MHz instruction rate (or less, if lots of 3-byte instructions used...)

Some 51s have a newer internal design with 6-state or less but these aren't as prevalent as yet..

Bill San Jose

Re: 8051 as HP-41 module? a note or two about 8051s
Message #10 Posted by Diego Diaz on 15 Aug 2003, 3:18 p.m.,
in response to message #9 by Bill Wiese

HI all,

Well Luiz, you can of course contact me for whatever I can be of any help, so can the rest of you.

First a pair of mods to my previous posts:

a) The Xtal must be slower than 26 ~ 24 Mhz, wich is the max. speed a PIC18F252 can run at from its internal resonant circuitry, and there is no space inside a module enclosure to fit an external oscilator. (Pls correct me if I'm wrong about that.)

b) You can pull the V+ line down to 3.5v with a series zener diode, this is enough for the 41 to handle the ISA line, while the 18LF252 is able to keep the 24Mhz Xtal running when powered at 3.5v thus lowering the Idd to a typical 5.5mA, 6.5mA max. wich seems quite reasonable, as the original MLDL design drawn about 12 ~ 14 mA. (not counting the EPROMS!!, they were only powered during ONE single cycle for -obvious- reading purposes.)

Now some facts:

It's about 2.77S between clock pulses in a standard 41 (not 2x clocked) at 360kHz. The PIC needs four clock cicles per instruction so it gives us 6MIPS at 24MHz so we can process 16 instructions to handle the corresponding I/O line... It's not too much but I think it's worth trying.

Regarding the program Vassilis, I'll contact I.J. and will ask him about. I asked you because I didn't know if you were the one that developed the code, and there is no downloadable file in your page nor Mr. Ioannidis'. Is this code copyrighted? or is it only a "Coca-Cola formulae alike" well keep secret...? :-)

I'm starting the PIC18F252's thick PDF Data Sheet reading, I've also already done the flowcharts for the corresponding port B interrupt handling, and hope to begin testing (and a huge amount of debugging) as soon as my PIC programmer is ready.

Trying to keep 41's alive.


Re: 8051 as HP-41 module? a note or two about 8051s
Message #11 Posted by David Smith on 15 Aug 2003, 4:27 p.m.,
in response to message #10 by Diego Diaz

The Scenix chips are PIC compatible and can do 1 instruction per clock (at up to 100MHz). Draws 1 mA/MHz.

Re: 8051 as HP-41 module? a note or two about 8051s
Message #12 Posted by Diego Daz on 15 Aug 2003, 8:25 p.m.,
in response to message #11 by David Smith

Hi David,

Yes, they are really fast processors but lack of memory space, only 2048 x 12bits, wich is not room enough to place a 4096 x 10bits standard HP-41 module, and there are double, triple and four times this size modules out there...

Please let us know if you have any further info about those chips other than I have stated above as it should be of great interest for some of us.



Re: 8051 as HP-41 module? a note or two about 8051s
Message #13 Posted by David Smith on 18 Aug 2003, 1:09 p.m.,
in response to message #12 by Diego Daz

Use an external EEPROM chip. You can get over 256Kbits in a single 8 pin chip.

[ Return to Index | Top of Index ]

Go back to the main exhibit hall