Design Ideas: April 25, 1996
Multichannel, 12-bit interface connects to PC
Dhananjay Gadre,
IUCAA Instrumentation Lab, Pune, India
The circuit in
Figure 1a connects a multichannel,
12-bit precision ADC to an IBM PC or compatible. The low-power consumption of the 12-bit
serial ADC, IC1, makes it a suitable candidate for connection to the PC through
the parallel printer port. The circuit uses the PC's serial port (COM2) to supply the
necessary 5V (Figure 1b). In this application, you
program the serial port to provide the ±VCC for other associated components.
An LM336 5V reference zener diode generates 5V for the ADC.
The C program in
Listing 1 reads channel 0 in
single-ended mode and prints the converted data on the screen. (Click here to download DI_SIG #1858.) You can easily
modify the program to read other channels and select other ADC input modes.
In the timing diagram for a typical acquisition cycle, a logic analyzer records at the
pins of IC1. IC1 operates in external clock mode. The PC generates
the SCLK signal on the D0 bit of the DATA PORT of the parallel-printer adapter.
The PC programs IC1 by sending a control byte to the DIN input. In
Figure 2, this byte is 8F hex, which programs IC1 to convert
the analog signal on channel 0 in single-ended mode. IC1 responds by pulsing
the SSTRB signal for one clock cycle at the falling edge of the eighth clock signal. The
PC subsequently generates 16 clock pulses and reads the DOUT signal from IC1
at the S7 signal pin of the printer adapter. The PC discards the bit read
during the SCLK pulse 9 (see figure)and discards the
last three bits at pulses 22, 23, and 24.
On a 66-MHz 486 PC, each clock pulse is about 6 µsec. Each conversion takes about 180
µsec. This time includes that necessary to unscramble the 12 data bits into an
"unsigned int" variable. The data sheet for IC1 suggests a duty cycle
of 45 to 55% for the SCLK signal. To achieve this duty-cycle range, Listing 1's program includes dummy "outportb"
instructions. (DI #1858)
| EDN Access | feedback | subscribe to EDN!
|
| design features | out in front | design ideas | departments | products | columnist |
Copyright © 1996 EDN Magazine. EDN
is a registered trademark of Reed Properties Inc, used under license.