an1228r2.pdf

(160 KB) Pobierz
Order this document
by AN1228/D
Rev. 2.0
Motorola Semiconductor Application Note
AN1228
Interfacing the M68HC05 MCU
to the MC145051 A/D Converter
By Mark Glenewinkel
CSIC Applications
Austin, Texas
Introduction
This application note describes the interface between Motorola's
M68HC05 Family of microcontrollers and Motorola's MC145051 analog-
to-digital converter (ADC). The MC145051 is a 10-bit, 11-channel, serial
interface ADC. The microcontroller unit (MCU) interface must be able to
"talk" to the MC145051 using a serial communication link. One of the
most popular hardware modules available in the M68HC05 Family is the
serial peripheral interface (SPI). This application note provides the
hardware and software design to link the SPI module on the
MC68HC705C8 MCU to the MC145051.
Not all M68HC05 Family members have SPI modules. An M68HC05
MCU without an SPI must interface to the MC145051 using a software
driver. This method "bit bangs" a port of the MCU to communicate with
the MC145051. Although not as efficient as the hardware SPI method, it
provides MCUs without an SPI a means to retrieve data from the
MC145051. This application note will utilize the MC68HC705K1 MCU to
demonstrate the software driver routine.
© Motorola, Inc., 1995; Revised 1997
AN1228 — Rev. 2.0
Application Note
MC145051 ADC
The MC145051 is a ratiometric 10-bit ADC providing 11 analog channels
of conversion with an internal sample-and-hold. The MC145051 has an
internal resistor capacitor (RC) clock oscillator to run its internal digital
circuitry. The maximum conversion time for the MC145051 is 44
µs
with
a maximum sample rate of 21.4 ksamples/s. If faster conversion time is
needed, an MC145050 can be used that is the same as the MC145051
except it requires an external clock. With a 2.1-MHz clock, the
MC145050 provides a 21
µs
conversion time and a maximum sample
rate of 38 ksamples/s. The MC145051 operates with a single voltage
supply between 4.5 and 5.5 volts. A serial interface is used to receive the
channel address to convert and transmit converted values to the outside
world.
Successive
Approximation
The MC145051 utilizes successive approximation to convert the analog
input signal to a digital value. This technique consists of comparing the
unknown analog input to a known analog voltage created by a digital-to-
analog converter (DAC). The digital number given to the DAC is the
number that will eventually be the result of the ADC's output. This
process of "guessing" the analog input voltage is similar to weighing with
a balance. If you had three weights consisting of 1/2, 1/4, and 1/8 of a
gram, you could measure something up to 1 gram within
±1/16
gram of
the weight. One side of the scale would hold the unknown and the other
side would contain various weights "guessing" at the weighted value of
the unknown.
Consider how a 3-bit A/D converter would convert an unknown signal.
Figure 1
shows the block diagram of a very simple 3-bit A/D converter.
A digital number is fed into the DAC and the DAC converts this to an
analog voltage for the comparator to use. If the input analog voltage is
larger than the DAC's output voltage, a 1 is the result of the comparison.
If the input analog voltage is smaller than the DAC's output, a 0 is the
result of the comparison. The result of the comparison is fed back into
the successive approximation register. The control logic adds a smaller
digitally "weighted" value to the DAC to "guess" at the input analog
AN1228 — Rev. 2.0
2
MOTOROLA
Application Note
MC145051 ADC
voltage. This sequence continues until the smallest digital "weight" is
used to guess at the input voltage.
Figure 2
illustrates this
COMPARATOR
ANALOG INPUT
+
ANALOG REFERENCE
3-BIT DAC
DIGITAL OUTPUT
START CONVERSION
CLOCK
SHIFT REGISTER
CONTROL LOGIC
OUTPUT REGISTER
CONVERSION OUTPUT
Figure 1. Simple 3-Bit A/D Converter
1
7/8
DIGITAL OUTPUT
BINARY AND FRACTIONAL
6/8
5/8
4/8
3/8
2/8
1/8
0
111
110
101
100
011
010
001
0
000
TEST
MSB
MSB
ANSWER
TEST
BIT 1
BIT 1
ANSWER
TEST
LSB
LSB
ANSWER
1
1
TIME
ANALOG INPUT VOLTAGE
a
Figure 2. 3-Bit A/D Weighing Sequence
AN1228 — Rev. 2.0
MOTOROLA
3
Application Note
process with a graph that depicts the testing of a signal of magnitude
between 3/8 and 4/8 of the full scale analog reference voltage. After the
guesswork is done, the binary answer of 011 is written to an output
register for further processing.
In this example, the input voltage does not change over the entire
conversion process. We have assumed that the signal does not change
and there is no noise to change the input voltage. In most cases a
sample-and-hold circuit is used to sample a voltage signal and hold it for
a specific length of time until the conversion process is complete.
The accuracy, linearity, and speed of the successive approximating A/D
converter are dependent on the properties of the DAC and the
comparator. The settling time of the DAC and the speed of the
comparator determine the speed of the conversion process. Likewise, if
the conversion demands more resolution, the time to convert will be
lengthened. The DAC's non-linearity will result in non-linearities within
the ADC. All of these factors affect the digital output result of the ADC.
Inside the
MC145051
As stated earlier, the MC145051 will convert one of the 11 analog inputs
into a 10-bit digital representation of the analog signal. The 10-bit digital
value is transmitted to the outside world via a serial bus.
Figure 3
shows
a block diagram of the MC145051. The sequence of starting a
conversion, converting the voltage, and transmitting the result is:
1. The CS signal is driven low to initialize the serial port that a 4-bit
address is going to be received and the previous 10-bit digital
result will be transmitted.
2. After the 4-bit mux address is received in the mux address
register, one of the analog inputs is selected from the analog
multiplexer. This signal is sent to the sample-and-hold to start the
10-bit conversion process.
3. While the 4-bit address is received, the 10-bit previously
converted value is sent out on the D
OUT
pin.
4. The internal clock drives the digital control circuitry, which in turn
manipulates the successive approximation register until the 10-bit
conversion is complete.
AN1228 — Rev. 2.0
4
MOTOROLA
Application Note
MC145051 ADC
5. Once the conversion is complete, the final value of the successive
approximation register is written to the data register. The 10-bit
result will stay here until it is queued to be sent out on the D
OUT
pin
on the next serial transmission. Also, the MC145051 will signal the
ending of a conversion by driving the end-of-conversion (EOC) pin
high. In some transmission scenarios, the CS pin must be negated
high before another transmission and conversion can occur.
AN0
AN1
AN2
AN3
AN4
AN5
AN6
AN7
AN8
AN9
AN10
V
REF
V
AG
+
COMPARATOR
& SAMPLE/HOLD
ANALOG
MUX
10-BIT DAC
SUCCESSIVE
APPROXIMATION
REGISTER
MUX ADDRESS
REGISTER
DATA REGISTER
D
OUT
D
IN
CS
INTERNAL RC
CLOCK OSC
DIGITAL
CONTROL
(MC145051 ONLY)
(MC145050 ONLY)
SCLK
EOC
ADCLK
Figure 3. MC145051 Block Diagram
AN1228 — Rev. 2.0
MOTOROLA
5
Zgłoś jeśli naruszono regulamin