398
CY8C28xxx PSoC Programmable System-on-Chip TRM, Document No. 001-52594 Rev. *G
Analog Interface
The programming for the DAC6 block is as follows:
CR0: mov reg[ASC10CR0], a0h
// Full Feedback, ACap Value = >
// Start with Sign = 1
CR1: mov reg[ASC10CR1], 40h
// Select REFHI for DAC function
CR2: mov reg[ASC10CR2], a0h
// OBUS ON, Auto-Zero ON
CR3: mov reg[ASC10CR3], 33h
// Feedback ON, Power ON
The programming for the SUMMING/COMPARATOR block
is as follows:
CR0: mov reg[ASD20CR0], bfh
// Full Feedback, Sign = 1, ACap = 31
CR1: mov reg[ASC20CR1], 3fh
// A Input = P2_3, BCap = 31
CR2: mov reg[ASC20CR2], 60h
// Cmp Bus ON, Auto Zero ON
CR3: mov reg[ASC20CR3], 17h
// Feedback OFF, B Input = North
Firmware Support Examples
In addition to the use of the OR instruction to sequence the
algorithm, there are some minimal setup requirements. The
SAR control bits are in the ASY_CR register. The definition
of these bits as related to the SAR are as follows.
Bits [2:1] Column Select for the SAR Comparator Input
The DAC portion of the SAR can reside in any of the appro-
priate positions in the analog PSOC block array. However,
when the COMPARATOR block is positioned (and it is possi-
ble to have the DAC and COMPARATOR in the same block),
this should be the column selected.
Bit [3]
Sign Selection
This bit optionally inverts the comparator input to the SAR
accelerator. It must be set based on the type of PSOC block
configuration selected. Some typical examples are listed in
Bits [6:4] SAR Count Value
These three bits are used to initialize a 3-bit counter to
sequence the 6 bits of the SAR algorithm. Typically, the user
initializes this register to ‘6’. When these bits are any value
other than ‘0’, an IOR command to an SC block is assumed
to be part of a SAR sequence.
Assuming the comparator bus output is programmed for col-
umn 0, a typical firmware sequence is as follows.
mov reg[ASY_CR], 60h // SAR count value=6,
// Sign=0, Col=0
or reg[ASC10CR0], 0 // Check sign, set bit 4
or reg[ASC10CR0], 0 // Check bit 4, set bit 3
or reg[ASC10CR0], 0 // Check bit 3, set bit 2
or reg[ASC10CR0], 0 // Check bit 2, set bit 1
or reg[ASC10CR0], 0 // Check bit 1, set bit 0
or reg[ASC10CR0], 0 // Check bit 0
SAR6 Calculation Example
This example assumes an input voltage level (VIn) of 3.0 V
on the PSoC input pin. The selection is made of +/- VREF
for the DAC references. Assuming VREF = 1.25, the input
range will be from 1.25 to 3.75 volts. The 6-bit DAC will yield
a sign magnitude result with 64 discrete values, thus giving
39 mV of resolution over the input range.
With 3.0 V input, the expected magnitude of the result is
(3.0-2.5)/1.25 * 32 = 12.8. The expected sign of the result is
‘0’, meaning positive; therefore, the result is Sign=0, Magni-
tude=12 or 13. The error in this basic SAR algorithm is
always less than one LSb in the final result.
shows the sequence of calculations which corre-
spond to the six OR instructions.
The final result of the computation is:
Sign = 1 and Magnitude = 011000 or 12.
To represent the true sign of the input voltage, you must
invert the sign of the result from the DAC register. Therefore
the result becomes Sign = 0, Magnitude = 12 which is (3.75
– 2.5)/32 * 12 + 2.5 = 2.96875. The error is 31.25 mV, or less
that one LSb of 39 mV.
Table 18-3. Example SAR Configuration
Configuration
Description
Sign
SAR6 – 2 block
1 DAC6, 1 COMP (can be CT)
0
SAR6 – 1 block
1 for both DAC6 and COMP
1
MS SAR10 –3 blocks
1 DAC9, 1 COMP (can be CT)
(when processing MS DAC block)
0
LS SAR10 – 3 blocks
1 DAC9, 1 COMP (can be CT)
(when processing LS DAC block)
1
Содержание CY8C28 series
Страница 65: ...64 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G RAM Paging ...
Страница 85: ...84 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Internal Main Oscillator IMO ...
Страница 93: ...92 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G External Crystal Oscillator ECO ...
Страница 97: ...96 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Phase Locked Loop PLL ...
Страница 125: ...124 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Страница 311: ...310 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G IDAC_CR0 1 FDh ...
Страница 317: ...316 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Страница 393: ...392 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Страница 425: ...424 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Analog Reference ...
Страница 461: ...460 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Two Column Limited Analog System ...
Страница 477: ...476 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Digital Clocks ...
Страница 483: ...482 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Multiply Accumulate MAC ...
Страница 513: ...512 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Internal Voltage Reference ...
Страница 523: ...522 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Switch Mode Pump SMP ...
Страница 533: ...532 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G I O Analog Multiplexer ...
Страница 537: ...536 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Real Time Clock RTC ...
Страница 561: ...560 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...