The Museum of HP Calculators

HP Forum Archive 13

[ Return to Index | Top of Index ]

Emulated HP-41 ROM pacs... at last!
Message #1 Posted by Diego Diaz on 10 Oct 2003, 7:56 p.m.

Yes, it works. A 28 pin PIC18F252 with the Stuctural Analysis module ROM image is connected to my HP-41 right now... and, of course, it's correctly recognised and fully operative.

I've used the PIC code from John Ioannidis' 18C252 PAC with almost no modifications. Great job John!!

The next step is to place the SOP version of the chip inside a standard module enclosure. It needs nothing but the PIC, one diode and a Xtal to run.

Several issues are still pending though:

1) The device needs 6.5 - 7.5mA wich is a pretty low figure, but... (this are the bad news) it keeps on running even when the calc is off... Still working on that, and have found a simple method to switch the PIC off but... (there's always a "but"... :-( paradoxically this method is only useful when the batteries are weak, as it needs a sensible voltage difference between BAT and V+ lines, and that doesn't occur with fresh batteries. Your comments or ideas are welcomed.

2) As the PIC holds 5 pages (4k words x 10 bits), the B3 and B4 lines can not be used to map the module according with the port number it is connected to. Of course you can sacrifice 3 pages and map the device into the correct port, but I think this small win shouldn't justify the loss.

3) Early 41's introduce two inverted pulses in the SYNC line at phases 49 and 53. This behavior fools the PIC code, thus it can not be used with those early machines.

4) The code is supposed to handle bankswitching between banks 1 and 2 (I haven't try this yet), so modules with pages in banks 3 and/or 4 can not be burned. IIRC only the HEPAX module uses this feature, but may be others. Nevertheless I think this could be implemented with very little code modification.

5) Last, but, again, not least, I have no other modules to cannibalize and experiment with!!

Your comments, corrections, suggestions, and support will be of great help. If you want to mail me please remove the NOSPAM garbage from my address above.

Constructive critics are also welcomed, please send the destructive critics to my ex-wife (she's an expert in that matter ;-).

Kind regards from the Canary Islands.


Edited: 10 Oct 2003, 8:06 p.m.

Re: Emulated HP-41 ROM pacs... at last!
Message #2 Posted by Hans Brueggemann [GER] on 11 Oct 2003, 2:34 a.m.,
in response to message #1 by Diego Diaz

congrats diego! if you can drop me a complete schematic of the electronics (especially interconnect between Hp-41 port and i/o of the PIC),i will be looking into possibilities of powering on/off the whole thing.

cheers, hans (send email to porkpiehat at gmx dot net)

Re: Emulated HP-41 ROM pacs... at last!
Message #3 Posted by Diego Diaz on 11 Oct 2003, 2:36 p.m.,
in response to message #2 by Hans Brueggemann [GER]

The PIC's on/off switching issue is now fixed... using my first approach: PNP transistor polarised by BAT voltage.

A simple resistor does the job!!!!

Put the blame on me: I forgot Ohms Law!!!!

Still at work, now refining PCB layout.


Re: Emulated HP-41 ROM pacs... at last!
Message #4 Posted by Pavel Korensky on 11 Oct 2003, 5:33 p.m.,
in response to message #3 by Diego Diaz

Just a question. How did you solved the power on delay ? Depending on the configuration of oscillator, there is either 72 ms (plus more if PLL is enabled) or at least 1024 Tosc clocks delay.

BTW, the pulses on SYNC line are also on my HP-41CV, so it seems that this situation is not limited to early HP-41C.

Re: Emulated HP-41 ROM pacs... at last!
Message #5 Posted by Diego Diaz on 11 Oct 2003, 6:30 p.m.,
in response to message #4 by Pavel Korensky

You're right, the pulses at SYNC line are not related with the model itself but with the date/version of miroprocessor manufacturing.

It seems like HP modified the microprocessor specs related to that issue some point in the production time line, but for now, I can not find out the exact moment.

I've got five 41's, the oldest (FullNut 41C s/n 2134S...) is the only one that produces those pulses, the next one (FullNut 41CV s/n 2427S...) does not, neither the rest three 41CX: 2502S..., 2646S... and 2819S... (last two are HalfNuts)

It may be interesting to investigate when the change happens, so anyone that can contribute with info about his/her 41's SYNC behavior will be of great help.

Regarding the power-up delay, it's fast enough to cope with the 41 needs (provided it's not a 2x modified unit). I have even try at 28.5Mhz and it still works, 24Mhz crashes the whole thing though, so the limit must be some point in between.

Cheers from Spain.


Re: Emulated HP-41 ROM pacs... at last!
Message #6 Posted by Meindert Kuipers on 13 Oct 2003, 5:33 a.m.,
in response to message #5 by Diego Diaz


Congratulations to get everything running! I would like to have the design files if possible. Your observations on the pulsing SYNC are correct. My 'old' fullnut (it has the gold ball contacts) has the pulses, my newer CX shows a stable SYNC.

About the pulses in SYNC, it should not be difficult to handle that. In my hardware MLDL (and in the classic design by Lynn Wilkins) the phase counter is reset by the first CLK02 that occurs after a SYNC occured first and after that a CLK01 occurs without SYNC (or on phase counter=55 in case no SYNC was present). This is probably easier to implement in hardware than in your software, but it does work!

This is the bit of VHDL code which does the job (this code creates two flipflops)

sync_detect: process(SYNC, CLK01, CLK02, t1_reset, t2_reset, U7, T6)

-- Generates the actual counter reset after detecting SYNC sequence

-- and on phase 67 (octal) if no SYNC is present


if (CLK01'event and CLK01 = '1') then

t1_reset <= SYNC;

t2_reset <= t1_reset or (T6 and U7);

end if;

ph_reset <= (t2_reset and CLK02 and not t1_reset);

end process;

Re: Emulated HP-41 ROM pacs... at last!
Message #7 Posted by Diego Diaz on 13 Oct 2003, 5:30 p.m.,
in response to message #6 by Meindert Kuipers

Hi Meindert,

I'll send you the files related to this design as soon as I have I have a final release (by the next weekend, hopefully) as I have a *real* job during the week... (I think you also know what I'm talking about... ;-)

For now still some difficulties with the on/off switching, and the needed lines to reprogram the device thru the module connector.

The PCB design is still pending, quite defined though. And I have no clue where can I have some PCB prototypes done.

Still the most annoying issue is the lack of modules (shells + connector) to build the first "real sized" cloned module. Some Ebay auctions are on my "Watch List"...

Regarding the "SYNC line pulses" issue, yes it's really quite more simple in HW than in SW, but for now I'll put my effort in finishing the Module's PCB and specs. As the code can be upgraded to a new version at a later time.

I live in a wonderful place, quite far away from almost everywhere though... Thus, "10Mhz SMD Xtal" might sound like "Klingong dialect" to my local components dealer's clerk (judging by the way he stared at me when I asked...), now I must wait until they make a new order to their supplier... and cross fingers in the meanwhile.

Excuse me for the "list of troubles" but it's usefull to talk about... sometimes you find solutions this way.


Re: Emulated HP-41 ROM pacs... at last!
Message #8 Posted by David Brunell on 14 Oct 2003, 10:54 p.m.,
in response to message #7 by Diego Diaz

Diego, how soon do you need the PCBs? If you can wait until the second week of November, I can get them done for you. I am too busy right now getting ready for a trade show in the UK.

Can you provide Gerber files, or do you need me to generate them?

I can round up and ship to you any small parts you may need too if you like. That I can do right away as I order parts just about every day it seems.

Best regards,


Re: Emulated HP-41 ROM pacs... at last!
Message #9 Posted by Diego Diaz on 15 Oct 2003, 6:16 a.m.,
in response to message #8 by David Brunell

Hello David,

There is no rush in this proyect, it's a hobby with no defined time line, so your offer widely fulfils my needs.

Regarding the PCB I'll try to built a prototype file this weekend, and mail it to you during the next week.

So far the only component that I cannot find locally is the SMD Xtal. I'll mail the specs this afternoon.

Apart from the Xtal, I'm still willing to buy, beg, steal, trade, borrow... are old/non-working modules to place my prototypes in... but that's another "mission impossible" story :-)

Thanks a lot for your interest in this proyect, and my best wishes from the Canaries.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall