The Museum of HP Calculators

HP Forum Archive 16

[ Return to Index | Top of Index ]

USB for HP41C - is it time?
Message #1 Posted by mark murphy on 24 July 2006, 1:15 p.m.

Quite some time has passed since the stunning MLDL -> John's Pic-> Diego's Clonix/No VRAM projects. In that time things in the microcontroller world have moved on as well - for me it is notable that they've moved to support USB 2.0 directly onchip, no extra's needed..

My dream project for some time has been a simple USB connection on the HP41c - I'm wondering if now is the time to reconsider the possibility.

I've just ordered a Pic development board to build an interface for my Nikon D200 and it struck me.....

Instead of focusing on squeezing as much ram/rom into a port why don't we refocus on putting a micro USB connector (like the ones on cameras and small storage disks etc) in a port instead and use one of the newer Pics to handle the M Code between the PC and HP41C?

Importantly keeping focus on the ONE target of upload/download - no bluetooth, no WiFi or WiMax !!!

Using such a device it would be possible to upload/download to your lap top - or even using PTP/Mass storage devices.

Could we trap mcode from the card reader/wand/HPIL to convert protocols etc and re-use it?

Obviously there are a few of our 'usual heroes' out there who could perhaps help us get the thing rolling.

I suspect that like the Clonex it might need some chip surgery to get it into the port module (got to avoid using the Card reader - too big). But I estimate there is enough space if we use the small USB connector - or worst case a Din plug with cable adapter to USB.

The Pic 18F2550 supports USB 2.0 and is only $4.37 - with the focus on USB I/O rather than storage, this should fit the bill nicely - though as mentioned a Dremel may need to cut it down to size.

Feedback appreciated.

Edited: 24 July 2006, 1:18 p.m.

Re: USB for HP41C - is it time?
Message #2 Posted by DavidMY on 24 July 2006, 4:45 p.m.,
in response to message #1 by mark murphy

A nice idea but implementation involves more than just the USB interface.

What exactly do you want to transfer and from where: Programs in user RAM, programs and/or data in extended [storage] RAM, ROM code, data registers???

Any mass storage solution (and USB to/from a PC is just that) should/would need some implementation/modification of the Mass Storage ROM code to maintain compatibility with the 41 OS code and module code.

This means you either: [1] load the code [8k worth, at least] into PIC eeprom memory along with assembly code to interface to the 41 [ROM] memory space as well as the USB interface code. [2] implement only the hooks to your input/output assembly code at some point in memory [ROM] space and the user needs to provide the mass storage code.

I/O for the 41 is quite complex, involving building and destroying buffers in 41 low memory and various transforms when transfering ASCII data, byte data, and programs from ROM [module] space, standard RAM [user] space or extended RAM [storage] memory.

Remember, mass storage was mostly implemented through the IL, writing either to tape, floppy, RS232 or a pc card, which used the HP IL chips. You might consider programming the PIC to emulate the IL loop module. Let the PIC deal with handshaking to the 41, buffer the I/O in PIC RAM then do what you wish with it.

Remember, 41 mass storage devices were impemented as--serial--not random access storage. This means that writing to a "dumb" mass storage device [say a 2.5" USB hard drive] would be difficult as modern disk formats are imcompatible with serial mass storage.

Also, the 41 supplies no where near enough power to support being a USB host controller any attached device would need to supply power.

All this is not to demean your proposal but to point out there is no such thing as "simple" interfacing with the 41. I suspect such a project would be at least as difficult as developing the MLDL and the Clonix project.

Re: USB for HP41C - is it time?
Message #3 Posted by mark murphy on 24 July 2006, 6:06 p.m.,
in response to message #2 by DavidMY

Correct - as mentioned the 'primary' focus is simply to upload or download data to the calculator - my understanding was also that mcode could be downloaded into ram and executed.

Rom code such as PPC mcode can be downloaded along with the program as needed from the PC. Not sure that all of the PPC Rom calls, for example, are used the average program.

The key is to be able to write/store/download data into the calculator.

At University 20 years ago I wrote a programme on an Digital LSI 11 in Basic - to switch on/off an LED to drive the wand - based on the HP85 barcode programme. That allowed me to write on a screen and download it -obviously it was a one way process though.

So my proposal is to allow for emulation of the various I/O capablities inherent in the various devices that HP supplied and then look at using mcode to assign new commands.

I expect the device to evolve as used over time - Pics are easy to reprogram.

More than anything else I really, simply, just want to download from my PC to the calc.

With regard to mass storage devices - there are protocols that exist on USB for autoback up and retrieval - but I agree this is secondary.

So - let's emulate HPIL or the Wand or the Floppy etc etc or select a few commands to re-route.

There should be plenty of ROM/RAM to do this now in the new PICs.

With regard to Clonix etc - we already have these - so let's have the device I describe in addition.

Of course, looking at the archive there are probably only a handful of people with the experience to do this. At the moment I am writing a Pic programme to replicate my old university project for the Wand - BUT I'm happy to help in a proper USB interface.

Re: USB for HP41C - is it time?
Message #4 Posted by Frank Wales on 24 July 2006, 8:26 p.m.,
in response to message #3 by mark murphy

Correct - as mentioned the 'primary' focus is simply to upload or download data to the calculator - my understanding was also that mcode could be downloaded into ram and executed.

Just to clarify, the RAM you're talking about here is in the proposed PIC-based module, right? There is no way to run 41 machine code from its own internal RAM.

The key is to be able to write/store/download data into the calculator.

Then might I suggest some alternatives, which could be considered steps on the way to a full-blown 41-USB-PC communications channel.

First, program the PIC to create what looks like available storage to the HP-41, perhaps like Extended memory files, for example. All the HP-41 machine code needed to make this kind of thing work is pretty straightforward.

Then program the PIC to allow those files to be copied to and from a standard memory chip, such as an MMC/SD card. A connection to one of these will run over a handful of wires, and there are probably PIC library modules aplenty that you can use to do the heavy lifting of talking to the memory card, and of exchanging data files with its FAT-format file system.

At this point, you have the means to exchange bulk data between the 41 and any PC via the card, which satisfies your major criterion, as well as giving you the ability to carry lots of data and backups in your wallet.

If you also want a writeable machine code store, implement a portion of the PIC's memory so that it behaves like one or more plug-in ROMs from the 41's point of view, allowing ROM modules to be 'plugged in to' or 'unplugged from' the HP-41 just by doing the right kind of file copy or deletion.

Then, if you program the PIC to expose the files it stores for the 41 as a FAT-format file system over the USB link, the PC can read or write them directly, and the memory card interface can be made optional or removed entirely.

Additionally, if you make the device appear to have multiple drive partitions over USB, some of those could be set up to map to the plug-in ROM addresses. This would allow the PC to write modules directly into the HP-41's address space, satisfying your requirement for downloadable machine code routines. (See further comments below.)

Following a path like the one above means that you don't have to wait until the end of the development process to get something you can use to satisfy your main desire.

Now, nowhere in this scheme is there a direct HP-41<->PC link; instead, the 41 and the PC each see a shared storage area in their own terms. But unless you feel the need to have them exchange data directly, this might be an adequate solution, and is probably much easier to implement than some kind of HP-IL/USB bridge, which I see as being potentially fraught with horrible corner cases in things like error handling and data interpretation.

I, for one, can't think of a single problem worth solving where the HP-41 and the PC have to communicate in real time over the USB link as peers. But, of course, you might want to solve that problem anyway for fun, an activity that I cannot possibly fault.

Finally, I interpret some of your comments to suggest that you'd like to see necessary machine code routines automatically accompanying HP-41 user code (Focal) programs that are downloaded into the module. If so, I strongly recommend that you pre-select the programs on the PC, and get it to build what appear to be fully-formed HP-41 modules with all the necessary machine code routines ready to go, which you then download.

Because of the severe restrictions placed upon you by the HP-41's XROM system design, incrementally updating machine code libraries on the fly for use by arbitrary HP-41 user programs would quickly become non-trivial, even where all the machine code routines have been written to be used in this way. Of course, if you weren't thinking of this, forget the last couple of paragraphs.

Re: USB for HP41C - is it time?
Message #5 Posted by Klaus on 25 July 2006, 5:24 a.m.,
in response to message #1 by mark murphy

Hi Mark,

here is my opinion: although USB for the HP-41 is nifty, why not create a USB-interface for the HP-33s? Connecting the PIC to the SRAM might be difficult (because of "glue-logic"), but interfacing to SRAM is pretty easy.

Just my opinion. Anyway, I wish all hardware projects around RPN-calcs success!

Re: USB for HP41C - is it time?
Message #6 Posted by Mark Murphy on 25 July 2006, 9:18 a.m.,
in response to message #5 by Klaus


For me the HP41c series was the pinnacle of the 'hand held calculator' - perfect size, simple and quick to use, expandable etc etc etc. Although I have an HP71b and and an HP48sx, the newer calculators beyond HP41c just don't cut it for me. After 15 years at Apple I supose that I've been seduced by 'lifestyle' elements - simple things like the button click, the fact that I can see the chars on the buttons, even the balance in the hand. The HP41 was the Zenith.

I suppose that as I've got older and surrounded myself with Plasma displays, HDMI AV amps, iPods, WiFi and so on, there is a bit of nostalga in using a 25 year old calculator to do day to day calcs. To me its like the Braun Razor, the Dualite Toaster or the Rolex GMT - a classic. I suppose that's why I want to do it to the HP41 - as an aside I hate the 'smiley' button layout and soft keys of the HP33 - I had one for a few days and took it back -yuk!

Klaus, your IQSIM is perfect example of retro design for the sake of it - and beautiful.

I'm going to explore two areas that may or may not be mutually exclusive - onboard Micro SD card (will fit in the back of a module case hopefully - have some samples being sent over) and MiniUSB.

Frank's suggestion got me thinking about priority and I suppose it should be uSD first, then USB. The thought of being able to carry everything I ever wrote or all ROMs on board is highly exciting - perhaps this is Diego's NoVRAM128?

Now the only problem is my learning curve will be steep - so I may propose some form of GPL once I've sketched out some ideas. I know that the experts out there are far better at this than me - anyway it probably is time to re-visit all the options at least.

Re: USB for HP41C - is it time?
Message #7 Posted by Meindert Kuipers on 30 July 2006, 1:37 p.m.,
in response to message #1 by mark murphy

Just check out the MLDL2000: it does add USB to the HP41 and it has the potential to make it all work, some functionality it still missing and waiting to be implemented.


Re: USB for HP41C - is it time?
Message #8 Posted by Matthias Wehrli on 30 July 2006, 4:40 p.m.,
in response to message #7 by Meindert Kuipers


Can you let us know what software update you maybe can prefent on the Allschwil meeting? Will there be any update of the M2K-Rom or of the MLDL200 interface software?


Re: USB for HP41C - is it time?
Message #9 Posted by Meindert Kuipers on 31 July 2006, 3:52 p.m.,
in response to message #8 by Matthias Wehrli

What I can finish depends on the repair of the remaining MLDL2000 units (and my spare time ....) At least I want to have some feedback on the plans, and maybe assign priorities based on this feedback.


Re: HP41 - MLDL2000 - USB - RS232 - EMU41
Message #10 Posted by Christoph Klug on 31 July 2006, 5:14 p.m.,
in response to message #9 by Meindert Kuipers

Dear HP41 enthusiasts,

As you heard the new EMU41 2006 version from Jean-Francois Garnier now includes an emulation of the HP-IL/RS232 interface HP82164A. Using this and a real HP82164A we get a new gateway connection between HP41 and EMU41 for data and programm transfer. More details about this you find on the HPCC webpage.

Furthermore it is also possible to add a RS232 to USB interface to this new gateway helpfuly for PC hardware which only support USB.

On HP41 side the MLDL2000 system from Meindert Kuipers includes an USB interface.

May be we get a firmware / mcode software tool for MLDL2000, which closes the small gap between the existing USB port and the USB / RS232 / EMU41 from this will result a great and powerfully system solution for HP41 & EMU41

Best regards Christoph Klug

Re: HP41 - MLDL2000 - USB - RS232 - EMU41
Message #11 Posted by Meindert Kuipers on 1 Aug 2006, 2:38 p.m.,
in response to message #10 by Christoph Klug

Clearly something we should talk about in Allschwill!


[ Return to Index | Top of Index ]

Go back to the main exhibit hall