Friday, April 15, 2016

M-32TL operation notes

I took a brief look at the M-32TL printer in my Canon P170-DH calculator. I haven't figured out all the details, but here's what I've learned so far.

Wednesday, April 13, 2016

A VFD module for the calculator?

One of the problems with converting a stock calculator to emulate a Busicom PF-141 is that most calculators these days max out at 12 digits, while the PF-141 was a 15-digit calculator. The example Tim McNerney gives in his PIC-based printer emulator test data is:
//                   111111 1 1
//          123456789012345 7 8
/* ============================= */
/*          3.1415926535897 x    */
/*                        2 =    */
/*          6.2831853071794   *  */
/*                               */
/*                     -456 /    */
/*                     2.37 =    */
/*         -192.40506329113   *  */
/*                               */
/* ============================= */
Thus it's not as simple as dropping a couple of digits to truncate the output to 12 digits. Nor would that account for the two special characters that appear in columns 17 and 18. One way I'm considering handling this is to replace the P170-DH's fluorescent display with an LCD module.

One I'm considering is the CFAH2002A-TMI-JT module from Crystalfontz, a company I've bought from before. This module is a negative transmissive LCD with a blue foreground and white LED backlit characters. This is important because the P170-DH has a blue-colored plastic bezel, and I think this combination is most easily viewable compared to a the typical yellow-green transflective display. It displays two lines of 20 characters each, so I could either show the last two lines printed or display status on the second line. It's fairly inexpensive at about $15, but presents some mounting challenges.

Still, the idea of using a Vacuum Fluorescent Display module has stuck in my head. Most of the VFDs I've found haven't been suitable, but I just came across the DS2029H from Noritake-Itron. Not only does this module appear to be an almost perfect fit for the P170-DH, it's less than $30 in sample quantities from the manufacturer.

Of course VFDs require some strange power supplies (+5Vdc and +35Vdc in this case) but that's manageable. This module includes a controller that looks much the same as those found in LCD modules so I don't need to deal with segment drivers and the like. They also sell VFD modules that look just like LCD modules (including one they're discontinuing that is being sold at only $18), but like the LCD modules they wouldn't fit as well.

Edited to add: I ordered a DS2029H Vacuum Fluorescent Display from Noritake-Itron Wednesday. It just shipped, so I should have something to play with next week.

Tuesday, April 12, 2016

Another reminder to myself

I was reading some old posts to this blog when I came across a good idea that I'd since forgotten: separate the external I/O driver Vdd from the internal logic Vdd. This would allow the external I/Os to be driven to 3.3V instead of 5V, easing the interface to modern electronic components such as FPGAs. I haven't tested this idea on a breadboard yet, but it seems like it ought to work. I'm writing this posting so I don't forget the idea again.

And what about the EP-102? I got it working, mostly. There's a weird hiccup that causes additional lines to be "printed" to the serial port, but I suspect that's a glitch in the test module and not the printer emulation.

I also looked at some LCD and OLED character modules. I'm torn between 20x1, 20x2, and 16x2 modules. The 20x1 would be most readable, but might not fit in the space available. A second line would allow me to display other info like the OVR indicator, along with the characters that should be in columns 17 and 18 in the case of a 16x2. I'm also somewhat constrained by the blue-colored window in the calculator's case.

Saturday, April 2, 2016

EP-102 emulation

One of my goals, like so many i4004 hobbyists, is to recreate the Busicom PF-141 calculator. This was a printing calculator, using one of the earliest small digital printers from the company that became Epson. Some have done it with a compatible printer while others have used microprocessors to scan the hammer driver outputs and convert the results to ASCII.

I'm a professional software engineer, and have been writing software since learning Fortran in 1977. While I've written a fair amount of code for hobby projects it's not something that excites me anymore. Verilog and VHDL, on the other hand, are interesting to me because they require a different mindset and I love learning new things.

So I set out to develop an EP-102 emulator that would print on the Epson M-32TL printer in the Canon P170-DH calculator that I planned to cannibalize. Since I've been unable to find a datasheet for the M-32TL, I decided to put that off a bit and generate ASCII output on a serial interface. I can also emulate the keyboard with a serial interface, allowing me to run the real PF-141 firmware in an FPGA emulating the entire system while using a PC for input and output.

There are a lot of UART implementations available in VHDL and Verilog, but I wanted to write my own. Since I'm not looking for a full 16550 emulation it only took a few evenings to code and debug, including testing it on a Spartan-6 reference board. I'd hoped to test it on the Lattice iCE40-HX8 breakout board, but I'm having a minor but blocking issue with USB configurations (udev rules to disconnect one of the FT2232H interfaces from the serial driver, if you're curious).

Then I turned to emulating the EP-102. This is a tiny drum printer with 18 columns and 13 sectors per column. From the left, the first 15 columns can print the digits 0 to 9, a decimal separator (period or "full-stop"), or a "minus" sign. The 16th column is non-printing, and the 17th and 18th columns have various special characters. (This raises a problem with my plan to use the P170-DH, as it has a 12-digit printer. Maybe I'll replace the 12-digit VFD with a 20-character LCD or LED instead.)

When Tim McNerney analyzed the PF-141 for the i4004's 35th Anniversary he included notes on the operation of the EP-102. From these I constructed a Verilog module that looks like an EP-102 on one side and outputs a stream of ASCII characters when the "paper" is advanced on the other. This took another few evenings. I still have a bug in the synchronization of the sector timing (e.g. when I try to print 1s ASCII 2s are generated) but it's getting close.

I'm thinking it might be fun to create a "PF-141 on a board" using the iCE40-HX8K breakout board, so I decided to build it for the iCE40 to see how big it is. Including the EP-102 emulation, UART transmitter, and a simple test "top" module I'm using 458 of the 7680 logic cells, or about 6%. To create a full system I'll need to add a 4004 CPU, 5 4001 ROMs, 2 i4002 RAMs, 3 4003 shift registers, the UART receiver, and the as-yet unwritten ASCII-to-keyboard converter. Will it fit? Stay tuned!