Monday, October 14, 2019

EP-102 to M-32TL Glue logic

I decided to spend some time this weekend moving the interface to the Epson M-32TL printer forward.

The Busicom 141-PF calculator had a Shinshu Seiki (the predecessor of Epson) Model 102 drum printer. A drum printer has a cylinder (or drum) with rows of characters embossed across its width. The drum spins at relatively high speed, while a set of hammers on the other side of the paper presses the paper against the drum's surface at the right moment to print the desired characters. A full revolution of the drum is required to print all the characters on the line.

Here's a picture of a Shinshu Seiki Model 102 printer:


Since this printer can print 18 columns, it has 18 separate print hammers. Thus the i4004 software generates 18 signals in parallel using a pair of i4003 shift registers to activate the correct hammers at the correct time.

The Epson M-32TL printer, on the other hand, prints one character at a time by moving the print mechanism across the paper from right to left. Obviously some translation is required.

I'd already written and tested a PIC program to drive the M-32TL printer, but my P170-DH replacement is based on an FPGA without a general purpose CPU. I'd coded and tested in simulation a Verilog module to duplicate the PIC program, but I hadn't tackled the conversion from parallel to sequential printing.

This weekend I implemented a Verilog module to manage this conversion. It simulates the rotation of the drum and provides the i4004 CPU with the signals it requires: a sector index and a start-of-rotation index. When the program activates the print hammers, the serializer module records what character would be printed and which columns were activated. When the entire line has been printed and the paper advance signal received, the serializer dumps this record into a buffer which the printer driver can read one column at a time as the print head moves across the paper.

A drum printer prints at a consistent speed, as it requires a full rotation of the drum to print an entire line whether there it prints just one column or all of them. The drum in the Model 102 rotates at about 165 RPM, or about 370 milliseconds per line. In contrast, the M-32TL requires about 75 milliseconds to print a single character, so it's slower if it has to print more than 5 characters on a line. Since the first three columns are special symbols, merely printing "0." requires printing 5 characters. Thus some significant buffering appears needed to avoid falling behind the CPU.

I've never seen a Busicom 141-PF in operation, so I don't know if it prints multiple lines as part of an operation. This led me to implement a FIFO capable of storing 128 characters, or about 7 full lines. As I was working on this I remembered that one of my goals is to be able to use the Canon calculator as an I/O device for my discrete component i4004 CPU via a serial link. By placing a FIFO on each side of the serial link I can isolate the operation of the serializer and printer with no change in logic.

I have the serializer, the FIFO buffer, and the printer driver working in simulation. All I need to do is code a test top module and it'll be ready to drive the real M-32TL printer. But first I need to clear my lab desk and wire the driver circuit to mate the printer to my Lattice iCEblink FPGA board.

There will be pictures!

No comments:

Post a Comment