CY8C28xxx PSoC Programmable System-on-Chip TRM, Document No. 001-52594 Rev. *G
399
Analog Interface
Notes
1. VSum is the voltage at the summing node, that is, the input to the comparator.
2. VDac is the voltage generated by the DAC block from the ACap value.
3. When VSum > AGND, CMP = 0; when VSum < AGND, CMP = 1.
4. CMP = 0 means keep the bit (undershoot); CMP = 1 means clear the bit (overshoot).
5. Start with Sign = 1 (configuration programming), equivalent to setting that bit to test.
As shown in
, the value of the result from Step 5,
Magnitude = 13, is closer to the actual value of 12.8. This
demonstrates that even though it is possible that the result-
ing code can be closer to the actual value, in the SAR algo-
rithm there is no provision to detect this. The result is a
maximum theoretical error of less than one LSb.
Implementing Higher Resolution SARs
It is straightforward to implement higher resolution SARs
using the SAR hardware accelerator. For example, to create
an 11-bit SAR, 3 blocks are allocated: 2 SC blocks to make
a DAC9 and one SC or CT block for summing and compare.
To get the results of the most significant (MS) block, which is
the first 6 bits (Sign and 5 bits of Magnitude), the firmware
sequencing will proceed exactly as in the previous SAR6
example.
The trick with the least significant (LS) block of the DAC9 is
to get the sign right. For the output to be correct, the sign of
the LS block of a DAC9 should be opposite to that of the MS
block (because it is connected through an inverting input to
the MS block).
There are two possible ways to handle this.
1. In firmware, one can manually compute what the sign bit
should be from the result in the MS block and write it to
the LS block. Then the SAR count value should be set to
5 instead of 6 to skip the sign bit check.
2. An interesting property of the SAR algorithm is that the
resulting voltage at the summing node after the first 6
steps (MS block processing) is going to be the same
polarity (above or below AGND) as the input voltage.
The reason for this is that, by definition, if the polarity of
the summing voltage is opposite to that of the input volt-
age, this triggers a Clear of the previous bit set. By defi-
nition, the final result of the summing voltage is less than
one LSb from AGND; therefore, clearing the LSb will
result in a summing voltage of the same polarity as the
input voltage.
According to number 2 above, the sign bit of the LS block
can be handled exactly as the sign bit of the MS block, just
another OR instruction. This sequence is then appended on
the above MS processing sequence (substituting the LS
DAC block address for <LS_CR0>). Note that the meaning
of the comparator is inverted by setting the SIGN bit in the
ASYNC Control register. This is because the LS block is
inverted with respect to the MS block.
mov reg[ASY_CR], 68h // SAR count value=6,
// Sign=1, Col=0
or reg[<LS_CR0>], 0
// Check sign, set bit 4
or reg[<LS_CR0>], 0
// Check bit 4, set bit 3
or reg[<LS_CR0>], 0
// Check bit 3, set bit 2
or reg[<LS_CR0>], 0
// Check bit 2, set bit 1
or reg[<LS_CR0>], 0
// Check bit 1, set bit 0
or reg[<LS_CR0>], 0
// Check bit 0
18.2.1.3
SAR Timing
Another important function of the SAR hardware is to syn-
chronize the I/O 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
clocks cycle into the instruction and 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 I/O Read completes and is immediately fol-
lowed by an I/O write. In this sequence of events, the DAC
Table 18-4. SAR Sequence Example
Step
Current ACap
VIn
VDac
VSum
Comparator
Bus (CMP)
New ACap
Comment
1
100000
3.0
2.5
2.75
0
110000
Keep
the sign bit and set bit 4.
2
110000
3.0
1.875
2.4375
1
101000
Overshoot
, clear bit 4, set bit 3.
3
101000
3.0
2.1875
2.59375
0
101100
Keep
bit 3, and set bit 2.
4
101100
3.0
2.03125
2.515625
0
101110
Keep
bit 2, and set bit 1.
5
101110
3.0
1.953125
2.4765625
1
101101
Overshoot
, clear bit 1, set bit 0.
6
101101
3.0
1.992188
2.496094
1
101100
Overshoot
, clear bit 0
101100
3.0
2.03125
2.515625
0
101100
Final Result
Summary of Contents for CY8C28 series
Page 65: ...64 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G RAM Paging ...
Page 125: ...124 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 311: ...310 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G IDAC_CR0 1 FDh ...
Page 317: ...316 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 393: ...392 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 477: ...476 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Digital Clocks ...
Page 561: ...560 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...