Professional Documents
Culture Documents
Adc
Adc
Terminology
analog: continuously valued signal, such as temperature or
speed, with infinite possible values in between
a / Vmax = d / M 0V 0..0 = 0
Resolution
Let n = 2
Vmax 3=11
M = 2n – 1 r
M = 2n 2=10
DAC: x0
x1
n digital inputs for digital encoding d DAC
…
analog input for Vmax Xn-1
a
analog output a
ADC:
Given a Vmax analog input and an analog input a, how does the
converter know what binary value to assign to d in order to
satisfy the ratio?
– may use DAC to generate analog values for comparison with a
– ADC “guesses” an encoding d, then checks its guess by inputting d
into the DAC and comparing the generated analog output a’ with
original analog input a
– How does the ADC guess the correct encoding?
ADC: Digital Encoding
Guessing the encoding is similar to finding an item in a list.
Analog State
input machine
Timing
control
Vmax SAR
DAC
Vmin BUF Digital
output
Comparator SAR
SAR: Successive
approximation register
Bit Weight
Notice the concept of bit weight Digital Bit Bit Weight (V)
in the last example:
bit 7 = 7.5 V = 15/2 7 10/2 = 5
bit 6 = 3.75 V = 15/4
6 10/4 = 2.5
Each bit is weighted with an 5 10/8 = 1.25
analog value, such that a 1 in that
bit position adds its analog value 4 10/16 = 0.625
to the total analog value
3 10/32 = 0.313
represented by the digital
encoding. 2 10/64 = 0.157
Span (or Range): difference between maximum and minimum analog values
Max - Min
n: number of bits in digital code (sometimes referred to as n-bit resolution)
Step Size (or Resolution): smallest analog change resulting from changing one
bit in the digital number, or the analog difference between two consecutive
digital numbers; also the bit weight of the
Span / 2n (Assume M = 2n)
• Converts voltage to an
integer value (0-1023)
• Programmable channels
AN0-ANx
MPC555 QADC64
MPC555 QADC64
CCW Table
CCW0 A CCW tells the ADC
CCW1 which channel to
AN0 scan and how long to
… sample the signal.
AN1
CCW63
AN2
AN3 ADC
QACR1: start a scan by setting SSE bit
Result Table
Result0 A Result is stored for
Result1 each scan of a channel
when the conversion is
… complete.
Result63
Scan Sequence and Conversion
• After the ADC is initialized, a sequence of scans is set up as a “queue”
in the CCW Table.
• Each channel to be scanned is added to the queue at successive
positions 0, 1, 2, etc. For example: CCW0, CCW1, CCW2, CCW3.
– An end-of-queue marker should be added at the next position.
• The ADC starts the scan and conversion when it is triggered by the
enable bit.
• The ADC reads the CCWs, one after another until end-of-queue is
reached, and for each CCW, it converts the signal on the specified
channel.
– A conversion on a channel stores a result in the respective position of the
Result Table, e.g., the result for CCW0 is stored at Result0, etc.
• When the scan and conversion is complete for all CCWs, then the ADC
sets the completion flag to 1. Now all digital results are available to be
read from the Result Table.
QADC Interface
• Programmability using a queue
– Scan a few channels quickly
– Scan a channel multiple times
– Scan large number of channels
• QACR1 – QADC64 Control Register 1
o 16 bit register at 0x30480C
o SSE1 – bit 2 – Single Scan enable (bit 0 is MSb)
o MQ1 – bits 3-7
o Set to binary 00001 to identify Queue 1
• QASR0 – QADC64 Status Register 0
o 16 bit register at 0x304810
o ADC sets a flag when the conversion is done
o CF1 – bit 0 – Conversion Complete flag (bit 0 is MSb)
QADC Interface
• CCW Table
o table of Conversion Command Words, where each command word specifies how
to perform a scan/conversion operation for an input channel
o CCW: 16 bit command word, starting at address 0x304A00
o A queue is a scan sequence of one or more input channels.
o A queue is started by a trigger event, which is a way to cause the QADC64 to
begin executing the command words.
o Each CCW requests the conversion of an analog channel to a digital result. The
CCW specifies the analog channel number, the input sample time, and whether
the queue is to pause after the current CCW.
CCW Table
16 bits
Entry
00 Begin Queue 1 0x304A00
0 5 6 7 8 9 10 15
Reserved P BYP IST CHAN
MSB LSB
n End Queue 1
QADC Interface
• Total conversion time: initial sample time, final sample time, and resolution
time
o Initial sample time – time during which the selected input channel is driven by
the buffer amplifier onto the sample capacitor (disabled by means of the BYP bit
in the CCW)
o Final sampling period – time to set up DAC array
o Resolution period – time to convert voltage in the DAC array to a digital value
QADC Interface
• Result Word Table
o table of Result Words, where each result word is the digital result of a
conversion
o Results from a sequence of conversions are placed in the Result Word
Table.
o RW: 16 bit result word, starting at address 0x304A80
CCW Format: 6 7 8 9 10 11 12 12 14 15
P BYP IST CHAN
void QADCR64_Reset()
{
g_nNumChannels = 0;
QADCR64_SetQueue(0, QADCR64_END_QUEUE,
QADCR64_QCKL_MAX);
}