December 22, 2003
Document No. 38-12011 Rev. *E
237
CY8C24xxx Preliminary Data Sheet
Analog Interface
the value that produces an output voltage closest to the
input voltage. This code should be within 1 lsb of the input
voltage.
The successive approximation A/D algorithm requires the
following building blocks: A DAC, a comparator, and a
method or apparatus to sequence successive writes to the
DAC based on the comparator output. The SAR hardware
accelerator represents a trade off between a fully automatic
hardware sequencing approach and a pure firmware
approach.
18.1.7.1
Architectural Description
Figure 18-5. SAR Hardware Accelerator
As shown in
Figure 18-5
, the SAR accelerator hardware is
interfaced to the analog array through the comparator output
and the analog array data bus. To create DAC output, val-
ues are written directly to the ACAP field in the DAC regis-
ter. To facilitate the sequencing of the DAC writes in the SAR
algorithm, the M8C is programmed to do a sequence of
READ, MODIFY, and WRITE instructions. This is an atomic
operation that consists of an IO read (IOR) followed closely
by an IO write (IOW). One example of an assembly level
instruction is as follows.
OR reg[DAC_REG],0
The effect of this instruction is to read the DAC register, and
follow it closely in time by a write back. The OR instruction
does not modify the read data (it is OR’ed with ‘0’). The CPU
does not need to do any additional computation in conjunc-
tion with this procedure. The SAR hardware transparently
does the data modification during the read portion of the
cycle. The only purpose for executing this instruction is to
initiate a read that is modified by the SAR hardware, then to
follow up with a write that transfers the data back to the DAC
register.
During each IO read operation, the SAR hardware overrides
two bits of the data:
To correct the previous bit guess based on the current
comparator value.
I
To set the next guess (next least significant bit).
I
The CPU latches this SAR modified data, OR’s it with 0 (no
CPU modification), and writes it back to the DAC register. A
counter in the SAR hardware is used to decode which bits
are being operated on in each cycle. In this way, the capa-
bility of the CPU and the IOR/IOW control lines are used to
implement the read and write. However, use the SAR accel-
erator hardware to make the decisions and to control the
values written, achieving the optimal level of performance
for the current system.
The SAR hardware is designed to process 6 bits of a result
in a given sequence. A higher resolution SAR is imple-
mented with multiple passes.
18.1.7.2
SAR Timing
Another important function of the SAR hardware is to syn-
chronize the IO Read (the point at which the comparator
value is used to make the SAR decision) to when the analog
comparator bus is valid. Under normal conditions, this point
is at the rising edge of PHI1 for the previous compute cycle.
When the OR instruction is executed in the CPU, a few CPU
clock cycles into the instruction, an IOR signal is asserted to
initiate a read of the DAC register. The SAR hardware then
stalls the CPU clock, for one 24 MHz clock cycle after the
rising edge of PHI1. When the stall is released, the IO Read
completes and is immediately followed by an IO Write. In
this sequence of events, the DAC register is written with the
new value within a few CPU clocks after PHI1.
The rising edge of PHI1 is also the optimal time to write the
DAC register for maximum settling time. The timing from the
positive edge of PHI1 to the start of the IO Write is 4.5
clocks, which at 24 MHz, is 189 ns. If the analog clock is
running at one MHz, this allows over 300 ns for the DAC
output and comparator to settle.
DAC Register
Analog Data Bus
Analog
Input
System
Data Bus
SAR
Accelerator
M8C
Micro
DAC
CMP
Latch
CBUS
Driver
PHI1 or PHI2
SAR Accelerator
Input Mux
Comparator
Bus Outputs
from Other
Columns
Switched Capacitor Block
DB
Read