Interfacing the TLC548 analogue-to-digital converter - Journal of

May 1, 1989 - Bits and pieces, 40. Using the TLC548 analogue-to-digital convertor it is possible to measure the voltage output of specific ion probes,...
0 downloads 0 Views 1MB Size
Gome 1 1 0 S o c k e t

REH REIl

...."..'.'..*........."""." .............. ............ *.. -

"""

n=

*

IPN(ARIGHT1: FPAC-.25: ISTAT = 1: IF liSTUD = ARIGHT THEN RETURN

DEF PNSMREIPI

P/TL

IF FNSWRE(H1SSBD) < -C THEN RETUlUl B M E C K = &STUD amm = n i a $ j a c m x r m s T . l ) HID$lBCHECI(.FIRST,1) = HIDS(BCHECK,FIRST*I.U nro$(mrcn,rmsr*1,>) = LEFTIIA-P.~~ I F FIRST O TL THEN IF BCHECI i ARIGHT THEN RETURN

Phone /0

Jack 0

1

9376 TST&T = -1 9178 RETURN

Figure 5. Anaiogldigltai interlace circun tor use with Apple ii game port.

Figure 4. Basic pmgram fw comparison of student responses wilh accepted answers including detection of simple misspellings.

For the past few months we have been using the Texas Instrument TLC548 analogue-to-digital converter IC t o collect laboratory data. This device is sold a t Radio Shack stores and costs $6.95. The literature provided with the TLC548describes it as."a complete dataacquisition system on a single chip designed for serial interface with a micronroressor". The r.......- chin ~ ~ is built around an 8-bit switched-capacitor successive-approximationADC and includes its own system clock, which operates a t a 4 MHz. Because of the Apple IIe game port design, which includes a Dower source, annunciator outputs, push-button inputs, control inputs, and a strob;, i t is easy to interface the TLC548 with this computer. We combined the TLC548 with a 7404 inverter chip and a small software control program tu create an %bit voltage data sampler. Firmre 5 shows the interface circuit. We use the wire wraD technique for joining circuit components together. ~ h f s method allows the builder to make auick connections. The TLC548 IC and inverter wire wrap sockets are glued to a small perfboard. After wire wrapping, this assembly is housed in a plastic case. Connection with the computer's game port is by way of a ribbon cable and 16-pin socket. Holes for thissocket are drilled in the case's lid; and then the

because i t was misspelled, prompting the student that his answer is probably right, but the spelling needs checking, induces no gratitude. They seem to expect that the computer would detect spelling errors and given them the chance to make necessary corrections. A listing of the subroutine is included (Fig. 4). The author expresses appreciation for helpful comments from the reviewers.

Interfacing the TLC548 Analogue-to-Digital Converter Bruce D. Westllng John Burroughs School 755 South Price Road St. Louis, MO 6 3 1 2 4 Allan K. Seldel Lambelt-St. Louis International Airport Authority

~

.~

~~~~

~

~

Table 2. Interface Parts List Margaret E. Bahe John Burroughs School Those who have been using the Apple I1 game port as an interface with theoutside world now have the opportunity to expand the range of physical parameters that may be studied with the computer. Using the TLC548 analogue-to-digital converter (ADC) i t is possible to measure the voltage output of specific ion probes, the differential voltage output, after amplification, of Wheatstone bridge circuits, and the voltage output of curreut-to-voltage amplifiers. Analogue data collection no longer needs to be restricted to game paddle input, which requires a resistance and associated current change from the transducer circuit.

TLC548 analogtodigital converter Hex inverter 7404 Project case 2% X 4% X 1% Perfboard microminiahre Wire wrapping socket: 8 pin Wire wrapping socket: 16 pin Wire wrapping socket: 14 pin 1bPin dip jumper cable Wire-wrapping tool 30Gauge wire for wrapping Phone aids, modular jack

Radio Shack No. or other source

Cast

276-1796 276-1802 270-222 2761394 2761988 2761994 276-1993 276-1976 276-1570 278-503 Kmart

$6.95 $0.99 $2.19 $1.89 $1.39 $1.59 $1.49 $3.99 $5.95 $2.39 $1.78

Volume 66 Number 5 May 1989

409

Figure 6. Wagram for collection of data using the TLC548 chip and Apple I1 game port.

PH X-GR1D:Z.S SEC socket is glued in place. The holes are positioned accurately $:01/29/8R 09:30:04 DUR:a1.75 SEC by drilling through a template made from perfboard. TransE:01/29/88 09:30:46 T:.2 4 / 62.7 SEC ducer input is through a modular phone jack and extension cord. A source of +5 V is also provided a t this location as a Figure 7. pH test sample power supply for transducer circuits. This voltage is obtained from the game port, which provides up to 100 mA. The parts needed to build the TLC548 interface are listed in Table 2. Digitizing Circuit for Measuring Voltage with the The TLC548 chip is controlled by a three-routine, machine-laneuaee This oronram also assembles the Apple II Game Port - uroeram. . serial data into a number that & stored in memory. Basic is Tong B. Tang usedto call the routines for each A D conversion. A PEEK of Physics Department memory location 255 reveals the conversion results. The TLC548 control requirements are simple. A change of state from high to low of its Chip Select pin (CS) causes the Albert. W. M. Lee sample information to be available on its Data Out pin. In Sebadian H. T. Chan the arrangement used, the AN0 pin controls the CS pin and Chemistry Department the data are picked up with the PB2 pin of the game port. Hong Kong Baptist College The CS pin must he in the hieh state before startine a - ~ o w i o oHong ~, K O ~ silmpling'session. CA1.L 768 a&mplishes this by bring& I t is well-known that microcomputer game ports can he the AN0 pin hieh which in turn brings the C S nin hizh. used to measure resistance. However. sienals from scientific The ~ & o h & e is used to clock o G the sample data from instruments as well as household appliances come encoded the TLC548. Extracting the sample data also starts the proFor voltaee measurement there exists a wide 8 cess of taking the next sample. CALL 772 arms the ~ ~ ~ 5 as4 voltaees. variety of analog-to-d:lgital conversion (ADC) cards that chip and tosses out any data already present in the chip. may be plugged into peripheral I10 slots (10). but their costs CALL 784 causes the conversion to start, zeros the previous are relatively high. In our search for a low-cost analog interstored sample a t memory location 255, pauses a few microface to an Apple II+, we have designed and tested a 10-bit seconds for the conversion to he made, and then loads the ADC circuit that makes use of their game port and is very new conversion into memory location 255. The program listcheap. ing in Figure 6 operates the TLC548 and prints the data The heart of our circuit is a Motorola MC14447 (Fie. taken to the monitor screen. . 8). ~.. which carries out voltage-to-pulse-width conversion. The According to its specifications, the TLC548 chip makes annunciator o u t ~ u t (ANO-2) s selects a channel. The ca~acithe A D conversion in about 17 fis. When the data transfer tor C is charged to the input voltage when the ramp 'start time limits and the control time limits are included, the signal (AN3) goes low. After an adequate delay the ramp sample speed is around 40,000 samplesls. The final speed start is brought high, and then the capacitor discharges a t obtained will be greatly reduced by the interface program required for communication between the computer and the A D converter. The simple Applesoft program listed in this article only takes data a t the rate of about 38 samplesls. The GSrn, h., Cm".do. +I" sample rate will vary considerably as one increased the number of operations performed by this program between samples. 88 We tested the TLC548 by using the interface to monitor ma l5 the voltage produced by a pH meter. The pH probe was placed in a buffer of pH 4, then in a pH 7 buffer, and finally in a pH 10 buffer. Figure 7 shows the output obtained. The above example is onlv one of a vast number of possibie uses for an A D Eonverter. Like us, you probably have a need to collect data from other kinds of transducers such as potentiGNLl CUI ometers, strain gauges, phototransistors, photoresistors, REF I thermistors, and IC temperature transducers. Some of these work well when combined in a Wheatstone bridge circuit, OUTPUT CHS others require current-to-voltage conversion. In either case the output is always a voltage, and that is just the ticket for the TLC548. Detailed plans for the construction of the single channel interface are available. Send $2.00 to cover the cost of mailing and printing to the authors a t the John Burroughs Figure 8. Analag/digital converter circuit for voltage measurement with Apple School. 11.

-

-

410

Journal of Chemical Education

~