In this post, you will learn how to capture data from Tektronix 1230 Logic Analyzer by emulating a Parallel Port Printer.
As a fan of vintage test equipments such as oscilloscopes and logic analyzers, I sometimes encounter the problem of extracting data from these machines onto external devices for storage or further analysis. While some of these old devices allow saving data to floppy drives or feature serial or GPIO ports and associated protocols to communicate with PCs or other devices in order to extract measurement data or capture screenshots, many other devices only support printing data in hard-copy to parallel or serial printers, which are hard to find nowadays. Recently, while working with an old Tektronix 1230 logic analyzer, I spent some time tackling this problem and this article will share some of the achievements I have made and other interesting findings.
The Device
I acquired this Tektronix 1230 from eBay, a vintage logic analyzer in the 1980s but still useful for troubleshooting old 8-bit designs. The following photos show the logic analyzer, with a Centronics parallel port and a DB25 RS-232 port at the back:
A word of warning here for those intending to collect this vintage equipment. Make sure that your 1230 comes with probes (also known as pods) – you will want the P6444 or P6443 16-channel probe. Probes can be hard or expensive to purchase separately. It should also preferably come with RS-232 or Centronics ports for data output.
The Challenge: Transferring Captured Data
My challenge came when I wanted to export the capture data from this logic analyzer. Although it has a RS-232 port supporting up to 9600bps, communication with the device requires the S43R101 1230/PC application software made by Tektronix. During my research, a serial protocol for custom-made application to work with the logic analyzer via the serial port seems to be available and documented in the manual. Unfortunately, I could never locate a copy of the manual or the application software for this device available for download, apart from this information sheet. There is, however, plenty of information on the Internet for the Tektronix 1240, a later model. Extracting data via the serial port therefore seems infeasible.
The only other way is to print data via the Centronics parallel port. Although I do not have any parallel port printer nowadays, a thought suddenly came across my mind that I might be able to program a PIC microcontroller to act as a parallel port printer and save the output data to an SD-card for further actions. Well, as they say, thoughts are dangerous and within minutes, I found myself soldering wires to a DB25 parallel connector to interface the logic analyzer with a PIC24FJ64GA002 microcontroller.
The Centronics Printer Protocol
This is the Centronics parallel port pinout:
Attempting this project requires knowledge of the Centronics protocol used for communication with parallel port printers, described in detail on this page. For our purposes of emulating the parallel port printer. we will only need to care about the ACK, STROBE, BUSY signals and the D0-D7 lines. In the simpler polled mode of the Centronics protocol on a standard parallel port, the host (referring to the logic analyzer in our case) would send a pulse on the STROBE line to indicate it’s going to send printing data. After that, the printer (or the PIC microcontroller in our scenario) will need to set the BUSY line high while at the same time reading for an input byte from the D0-D7 lines. When processing is completed, the printer will send a pulse on the ACK line and set the BUSY line low, indicating it is ready for the next command. The process is illustrated in the following timing diagram:
To indicate that the emulated printer is available and ready for printing, Paper End (pin 12) should be connected to GND while Error (pin 15) and Select (pin 13) should be connected to 5V.
Result: a PIC-based Virtual Parallel Port Printer
Using the ST7735 1.8″ color LCD (see my previous post) and the Microchip SD card library, I was able to build a working virtual printer. The device would listen for data being sent from the parallel port and save the print job to a .PRN file on the SD card. The following photos show the printer in action:
The 1.8″ LCD shows the SD card volume label, file system type, total capacity and free space. The name of the file containing the last print job is also displayed on the LCD.
As the PIC does not understand the data being sent and simply writes the data received on the SD card, there is an issue of telling when the print job finishes in order to start a new output file. On a real printer, the printer would detect the paper feed command and eject the page when a page has finished printing. In my case, I have chosen a simplified approach – assume that printing has ended and close the output file if no data is received after a certain period, e.g., 5 seconds. This would be sufficient for most purposes.
Reading the Printer Output
This emulated printer should work well with any application expecting a generic parallel port printer. It may not work if the application is expecting a specific modern parallel port printer model, in which case customized identification data might be sent via the parallel port in ECP or EPP mode to communicate with the application. For a simple test, executing the DOS command DIR > LPT1 or DIR > PRN with the printer connected to the LPT1 port should result in a .PRN file containing the list of files and sub-directories in the current directory being written to the SD card.
On the Tektronix 1230, printing can be done by double-pressing the NOTES key (to print a screen capture) or by pressing the D key (to print memory contents), as described in the help screen:
While pressing D will print the memory contents in text format, double-pressing the NOTES key (supported only on Epson-compatible printer) will print a graphics representation of the current screen. Although printing of memory contents will not hang the logic analyzer and the printer status will be displayed as “Printing”, the logic analyzer will stop responding while the screen is being printed. Also during my experiment, if the status lines on the Centronics parallel port report conflicting information, the logic analyzer will refuse to boot up with the POWER indicator turned off, making it seem as if the device is dead. Removing the parallel cable and the unit will power on just fine. This seems to be a bug in the device firmware.
The screen print output, as captured by my virtual printer, is in binary format and contains Epson escape codes. A quick inspection of the output file and comparison with the Epson escape codes documentation shows that only 4 escape codes are used:
- ESC 65 and ESC 50 – set line spacing
- ESC 108 – set left margin
- ESC 42 – select bit image for graphics printing
I quickly managed to write a tool which converts the output escape codes back to a 450×250 bitmap file:
A check-box “optimize for printing” is provided. If checked, the output will be black-on-white (instead of green-on-black) and can be printed using a normal printer. The printout after conversion looks like below:
With the virtual PIC-based printer and the escape code converter tool, I am able to copy data from the logic analyzer to my PC for other purposes.
Replacing the RTC Batteries
As with other old electronics equipments, I needed to replace the 3V batteries which keeps the device clock and settings. The 1230 is using two CR2330 3V batteries for this purpose:
The notice near the batteries reads, ‘CAUTION: REFER BATTERY REPLACEMENT TO QUALIFIED TECHNICIAN’. Am I a qualified technician? Well, at least not from the administrative perspective – I am not certified by Tektronix to open up this device! Would there be any implications if I am not? Are there any specific instructions to be performed before the battery is replaced or must the batteries be replaced in a specific order to avoid loss of data? Unable to find any information on this on the Internet, I proceeded to replace nevertheless and the logic analyzer still seems to be working well ever since.
Interestingly, although the time settings on this device allow years between 1900-2099, the year would jump back to 1914 even if 2014 is selected after a reboot, indicating some sort of Y2K issues. The rest of the date and time remains correct. The day of week also needs to be selected manually and is not calculated automatically like many other devices. This was probably done to save precious code space for other stuff, or perhaps the algorithm is too complicated to be implemented on a Z80 processor (used by most Tektronix logic analyzers of this generation) efficiently.
Downloads
The source code of the printer and the bitmap converter tool can be downloaded here:
Read my other article for a full review of the Tektronix 1230: