EDN logo


Design Feature: June 22, 1995

Parallel-printer adapters find new use as instrument interfaces

Dhananjay V Gadre,
Inter-University Centre for Astronomy & Astrophysics


The venerable parallel-printer adapter has found many uses during its long lifetime. Now, you can use the port as an instrument interface-for connecting a photometer and a PC, for example.


Designers of the Centronics, or parallel, printer adapter intended it as a way to connect printers and computers. However, the adapter's uses go far beyond simple peripheral connection. PC manufacturers have adapted the port for various applications on PCs, and, with decreasing hardware costs, PCs often have two or more parallel-printer adapters. In addition, the PC operating system, MS DOS, supports four printer adapters.

OEMs and instrument designers have also used the adapter for connecting devices other than printers to the PC (Ref 1). The adapter has enough I/O lines to be a fast communications channel between PCs and application hardware. Applications for the adapter include tape-backup systems, PROM programmers, ROM emulators, data-acquisition systems, and security locks. The parallel-printer adapter gives at least an order of magnitude improvement over the data-transfer rates you can achieve with the RS-232C port; the enhanced parallel-printer adapter does even better (Ref 2).

The adapter also helps avoid the problem of overcrowding motherboards with ISA/EISA add-on cards. Consider whether using the ISA or EISA bus in an instrument is overdesign. A printer adapter may work in these designs if other aspects, such as speed, are not a consideration. In addition, users cannot access the ISA bus in laptops, leaving the parallel-printer and PCMCIA adapters as the only available high-speed communication channels.( Ref 2).

Also competing with the parallel-printer adapter, the Enhanced Capabilities Port (ECP) and Extended Parallel Port (EPP) are beginning to appear on the market. However, the large user base of the standard parallel-printer adapter suggests that applications designed with it would have wider portability than that of ECP and EPP. An IEEE committee is now examining the parallel-printer adapter standard to compare its capabilities vs the ECP and the EPP (Ref 2).

The printer adapter has three independent, TTL-compatible ports: an 8-bit output-data port, a 4-bit output-control port with open-collector drivers, and a 5-bit input-status port. The two output ports have input registers at identical addresses. You can read these registers to get the latched value. The control-port outputs have open-collector drivers with typically 4.7-kOhms pull-up resistors. The control port can also be used as an input port, by writing ones to the control register and then performing a read operation.

The control register lets you connect one of the status-port pins to one of the PC interrupt-request lines. The data RAM of the PC stores the port addresses. Tables 1, 2, and 3 show the pin position of the three ports of the adapter on the 36-pin Centronics connector on the printer end and the DB-25 connector on the PC end. They also show the corresponding bit locations in a bytewide register and the logic relationship between the register contents and the output pin. A true relation means that if the register contains a logic one, the output pin is also at a logic one. An invert relation indicates that, if the register bit contains a logic one, the output pin is at a logic zero.

Table 1-Pin connections for the status port
BitCentronics pinDB-25 pinBit-to-pin relation
71111Invert
61010True
51212True
41313True
33215True
2------
1------

Table 2-Pin connections for the control port
BitCentronics pinDB-25 pinBit-to-pin relation
7------
6------
5------
4------
33617Invert
23116True
11414Invert

Table 3-Pin connections for the data port
BitCentronics pinDB-25 pinBit-to-pin relation
799True
688True
577True
466True
355True
244True
133True


Use the interface for a photometer

As an example of using a printer adapter port as an instrument interface, consider an application in which a computer interface for a photometer will perform photometric observations. The photometer produces low-pulse-width pulses whose frequency is proportional to the incident light intensity. Photometric observations involve accumulating the pulses for a required time period. You can achieve this task by gating a counter with a preset timer. The program in Listing 1 demonstrates the workings of the photometer interface through the parallel-printer adapter.

If you want many computers to share the photometer, use the printer adapter to connect the photometer to a PC. This approach avoids removing the computer interface from the computer and also works well if you plan to use a laptop computer. However, this approach can mean adding an extra power supply for the circuit. To address this penalty, you can use the RS-232C signal lines to power the low current requirements of the interface circuit.


Acquisition follows a series of events

Fig 1 shows how the parallel-adapter interface circuit operates. The digital multiplexer selects one of eight time periods. A binary counter divides down a 32.768-kHz crystal oscillator to set the gating periods from 0.125 to 16 sec in steps of 0.125 multiplied by powers of 2. A chain of binary counters count the incoming pulses for the duration of one gate period. One cycle of acquisition begins by selecting the required gate period and then resets the accumulating counters. The subsequent rising edge of the gate signal routes the incoming pulses to the counters. The falling edge of the gate period disables the AND gate, which freezes the accumulated count in the counters. The program now reads the counter contents, 4 bits at a time. Following this operation, another measurement cycle begins.

Fig 2 shows the acquisition circuit, which uses CMOS or 74HC components to keep the current consumption small enough for RS-232C signal lines to power the circuit. Fig 3 depicts the circuit's associated power supply. The PC drives the RS-232C lines to VCC, which passes through a 78L05 regulator to produce the 5V the interface circuit needs. IC1, 74HC4060, uses a 32.768-kHz crystal to generate the gating signal of <1/8>, <1/4>, and <1/2> Hz. IC2, 74HC4024, further divides this signal to generate the rest of the five periods. These eight gating signals drive IC3, 74HC151, a one-of-eight digital multiplexer. The lower 3 bits of the printer-adapter data port act as the select input of this multiplexer. The output of the multiplexer drives IC4, 74HC74, a D-type flip-flop in a divide-by-two mode, to generate signals with ON time from 0.125 to 16 sec. The output of the flip-flop gates the input pulses through the AND gates, IC5B and IC5C, to the counter chain.

During each acquisition cycle, the control-port bit, C0, resets flip-flop IC4 and binary counters IC6 and IC7. A rising edge of the gate signal sets IC4, enabling the incoming pulses to reach the binary-counter chain, IC6 and IC7, which are 12-bit binary counters. At the end of the gate period, the clock line to IC4 freezes the accumulated count in the counters. The program can read only 16 bits (four nibbles) of the 24 bits output of these counters. IC8 and IC9, 74HC244, multiplexes the 16 bits to generate 4 bits. IC10, 74HC138, decides which one of the four nibbles routes to the status port. The program reads the output of counters IC6 and IC7 4 bits at a time by reading the status port and manipulating the four nibbles to form a 16-bit integer.

The control program prompts the user to enter the required gate period and then starts acquiring data. The circuit stores the data as ASCII numbers in a user-defined output file at the end of the acquisition period. A suitable cable connects the photometer generating TTL-level pulses to the interface. The interface connects to the printer adapter through the 36-pin Centronics connector, J3, by the standard printer cable.


Author's biography

Dhananjay V Gadre is a scientific and technical officer for the Instrumentation Laboratory at the Inter-University Centre for Astronomy & Astrophysics in Pune, India, where he has worked for two years. He currently designs electronic instrumentation for use in astronomy. He is currently working on a controller for a low-noise (<5-ev) CCD camera. He is also helping in the development of a network of computer-controlled instruments on a client/server model. He has an MS in electronics from the University of Delhi in India and is a licensed radio amateur.


References

  1. Gadre, Dhananjay V, Pramod K Upadhyay, and Vijaya S Varma, "Catching the right bus," Part 2: "Using a parallel-printer adapter as an inexpensive interface," Computers in Physics, January/February 1994.
  2. Tracht, Allen E, "Adapting laptops to data acquisition," IEEE Spectrum, October 1993.




| EDN Access | feedback | subscribe to EDN! |
| design features | design ideas |


Copyright © 1995 EDN Magazine. EDN is a registered trademark of Reed Properties Inc, used under license.