TRIADC_001-13626.pdf

Triple Input 7- to 13-Bit Incremental ADC Datasheet TriADC V 2.20
001-13626 Rev. *I
Triple Input 7- to 13-Bit Incremental ADC
Copyright © 2001-2015 Cypress Semiconductor Corporation. All Rights Reserved.
PSoC® Blocks
Resources
CY8C29/27xxx, CY8C28x43,
CY8C28x52, CY8CLED08/16,
CY8C28x45, CY8CPLC20,
CY8CLED16P01
Digital
5
API Memory (Bytes)
Analog CT Analog SC
0
3
Flash
431
RAM
11
Pins (per
External I/O and
ADC Input)
1
See AN2239, ADC Selection Guide for other converters.
For one or more fully configured, functional example projects that use this user module go to
www.cypress.com/psocexampleprojects.
Features and Overview
„
„
„
„
„
„
Samples three inputs simultaneously
7- to 13-bit resolution, two’s complement or unsigned integers
Sample rates from 4 to greater than 10,000 sps
Maximum input range Vss to Vdd
Integrating converter provides good normal mode rejection
Internal or external clock
The TriADC is a triple input integrating ADC with an adjustable resolution between 7 and 13 bits. It can be
configured to remove unwanted high frequencies by optimizing the integrate time. Input voltage ranges,
including rail-to-rail, may be measured by configuring the proper reference voltage and analog ground.
The output is configurable two’s complement or unsigned integers based on an input voltage between –
Vref and +Vref centered at AGND.
Sample rates from 4 to 10,000 sps are achievable, depending on the selection of the resolution, Data
Clock, and CalcTime parameters.
The programming interface allows the user to specify the number of sequential samples to be converted or
to select continuous sampling.The CPU load varies with the input level. For example, when Vin = +Vref,
there are 14,972 CPU cycles (maximum 13 bit). When Vin = AGND, there are 7,868 CPU cycles (average
13 bit). When Vin = -Vref, there are 764 CPU cycles (minimum 7-13 bit).
The TriADC operates exactly like the ADCINCVR, except for two additional digital and analog SC blocks.
The three input channels are sampled at the same time and duration since they are controlled by a
common signal. Power settings, resolution, and speed are common to all three input channels.
The TriADC is ideal for applications that require simultaneous sampling of three signals, such as a three
phase voltage measurement. As with other PSoC ADCs, signals to both inputs may be multiplexed. Note
that you need to review the Parameters section prior to module placement.
Cypress Semiconductor Corporation
Document Number: 001-13626 Rev. *I
•
198 Champion Court
•
San Jose, CA 95134-1709
•
408-943-2600
Revised March 12, 2015
Triple Input 7- to 13-Bit Incremental ADC
Note
When initially selecting the TriADC, a warning may appear that states “Resource allocation prevents placement." This warning will be displayed if the original placement has two ADC blocks in
the same column. Simply move each ADC block to its own column.
Figure 1.
TriADC Block Diagram
Functional Description
The TriADC is three incrementing ADCs in a single user module. The 16-bit sample rate timer (PWM) is
shared to reduce the required digital blocks. Since all three ADCs use the same timer, the sampling is fully
synchronized. Five digital PSoC blocks and three analog switch cap PSoC blocks are required, as shown
in the following figure:
Document Number: 001-13626 Rev. *I
Page 2 of 32
Triple Input 7- to 13-Bit Incremental ADC
Figure 2.
Simplified Schematic of the TriADC
Document Number: 001-13626 Rev. *I
Page 3 of 32
Triple Input 7- to 13-Bit Incremental ADC
The three analog blocks are configured identically as resetable integrators. Depending on the output
polarity, the reference control is configured so that the reference voltage is either added or subtracted,
from the input and placed in the integrator. This reference control attempts to pull the integrator output
back towards AGND. If the integrator is operated 2Bits times and the output voltage comparator is positive
“n" of those times, the residual voltage (Vresid) at the output is:
Equation 1
Equation 2
This equation states that the range of this ADC is ± Vref, the resolution (LSB) is Vref/2Bits-1, and the voltage
on the output at the end of the computation is defined as the residue. Since Vresid is always less than Vref,
Vresid/2Bits is less than half an LSB and can be ignored. The resulting equation is listed below.
Equation 3
Example 1
For a Vref of 1.3V and a resolution of 8-bits we can easily calculate the input voltage based on the value
read from the incremental ADC at the time the data is ready. The equation which can be used would be as
follows:
Equation 4
The result of the calculation will be referenced to AGND. For a ADC data value of 200 the Voltage
measured can be calculated to be 0.73V as follows:
Equation 5
The value calculated is an ideal value and will most likely differ based on system noise and chips offsets.
Document Number: 001-13626 Rev. *I
Page 4 of 32
Triple Input 7- to 13-Bit Incremental ADC
To determine the code to be expected given a specific input voltage the equation can be rearranged to
give us:
Equation 6
Example 2
For a Vref of 1.3V and a resolution of 8-bits we can easily calculate the expected ADC code based on the
input Voltage. The equation which can be used would be as follows:
Equation 7
For an input voltage of -1V below AGND the code from the ADC can be expected to be 29.53 based on
the calculation below:
Equation 8
The value calculated is an ideal value and will most likely differ based on system noise and chips offsets.
To make the integrator function as an incremental ADC, the following digital resources are utilized:
„ An 8-bit counter to accumulate the number of cycles that the output is positive (one per channel).
„ A 16-bit PWM to time the integrate time and gate the clock into the 8-bit counter (shared between all
three channels).
A single DataClock is connected to the 8-bit counters, the 16-bit PWM, and the analog column clocks
which connect to the analog SC PSoC blocks. The analog column clock is actually two clocks, φ 1 and φ 2,
which are generated from the DataClock. These two additional clocks are exactly one-fourth the frequency
of the DataClock. This means that the PWM and counter operate 4 times faster than required and
therefore, need to accumulate N+2 bits worth of data (N equal number of bits of resolution).
Note
It is imperative, when placing this module, that you configure it with the same clock for all three
blocks. Failure to do so will cause it to operate incorrectly.
The counters are implemented with an 8-bit digital block for the LSB and a software counter for the MSB.
Each time the hardware counter overflows, an interrupt is generated and the upper MSB of the counter is
incremented. This allows the TriADC module to be implemented with only five digital blocks instead of
eight.
Equation 9
Document Number: 001-13626 Rev. *I
Page 5 of 32
Triple Input 7- to 13-Bit Incremental ADC
The sample rate is the DataClock divided by the integrate time, plus the time it takes to do the result
calculations, CalcTime. The integrate time is the period when the input signal is being sampled by the
TriADC.
The time it takes to calculate the result, CalcTime, varies inversely proportional with the CPU clock. The
CalcTime must be set to a value greater than what is required to calculate the result. The minimum
CalcTime is equivalent to 371 CPU cycles and must be expressed in terms of the DataClock. The
CalcTime may also be increased beyond the minimum to optimize the sample rate.
Note
The total of 2Bits+2 plus the CalcTime must not exceed 216-1 or 65,535.
Equation 10
The 16 bit PWM is programmed to output a high signal that is 2Bits+2 times the DataClock. For example, if
the resolution is set to 10 bits, the PWM output will remain high for 4096 (210+2) DataClock periods. The
PWM output will be low for the time it takes to do the minimum result calculations and to reset the
integrator. This period is controlled by the CalcTime parameter. The CalcTime can also be adjusted to help
provide a more exact sample rate in combination with the DataClock. The total period of the PWM is the
sum of the integrate time and the CalcTime.
Figure 3.
TriADC Timing with Respect to PWM Output
When the first reading is initiated, the PWM configuration is calculated, the integrator is reset, and the
counters are all reset to FFh. The initial delay will always be at least that of the calculation time. The PWM
is initialized only prior to the first reading. After the compare and period registers are set once, they do not
have to be re-initialized unless resolution or the calculation time is changed. When the PWM count is less
than or equal to the integrate value, the output goes high, enabling the 8-bit counters to count down. The
output of the PWM stays high until the counter reaches zero. At this point, the clock to the 8-bit counters is
disabled and the PWM interrupt is generated.
The initial value of the 8-bit software counters is set to 2Bits/64 times the most negative value. Each time
the 8-bit counters overflow, the interrupt for the 8-bit counter is executed and the software counter is
incremented by one.
When the input to the ADC is greater than or equal to the most positive value, the 8-bit counters will
increment on every positive transition of the DataClock. If the input to the ADC is less than or equal to the
most negative input value, the 8-bit counters will never decrement and therefore, never generate an
interrupt. An input near analog ground, under ideal conditions, will allow the counter to increment half the
time. It is easy to see that, depending on the input voltage level, the amount of interrupts from the 8-bit
Document Number: 001-13626 Rev. *I
Page 6 of 32
Triple Input 7- to 13-Bit Incremental ADC
counters will vary from 0 to (2Bits+2)/256. For example, if the resolution is set to 10 bits, the PWM compare
value is set to 210+2 (4096). This means that it is possible that the processor could be interrupted a
maximum of 4096/256 or 16 times during the integrate period.
With the TriADC control interrupt based and the sample time so long for a higher resolution result, it is
unreasonable to expect the processor to wait while a sample is being processed. The primary
communication between the ADC routine and the main program is a flag that may be polled. When the
most significant bit of TriADC_bfStatus has a non zero value, the new data is available in TriADC_iResultn
(n=1,2,3). APIs are available to check the data flag and retrieve data.
This data handler was designed to be poll based. If an interrupt based data handler is desired, the user
may insert his or her own data handler code into the interrupt routine TriADC_CNTn_ISR, located in the
assembly file TriADCINT.asm. The point to best insert code is clearly marked.
Channel to Channel Differences
When using the TriADC, there will be differences between channels when measuring the same input
voltage. This difference is due to the input offset variations in the switch cap block amplifiers and the
column AGND buffers. This channel to channel offset is easily compensated for by routing the same signal
into each of the ADC channels. One of the channels can be used as the reference and the difference
between subsequent channels would be subtracted after each reading.
CPU Usage
The TriADC requires CPU time to calculate the result and to increment the software counters each time
the hardware counters overflow. The CPU overhead is dependent on three variables: CPU clock,
DataClock, and input voltage. At first it may seem odd that input voltage affects the CPU overhead for an
ADC. Input voltages that are near or lower than -Vref require very little CPU overhead. Input voltages that
are near or greater than +Vref require more CPU overhead. The equations below assume the input signal
is the same for all three inputs. To calculate the CPU cycles required for a given input:
Equation 11
Equation 12
To calculate the maximum CPU cycles at 10-bits resolution, set Vin to Vref.
Equation 13
Document Number: 001-13626 Rev. *I
Page 7 of 32
Triple Input 7- to 13-Bit Incremental ADC
To calculate the percent CPU utilization of the TriADC, the following equation can be used.
Equation 14
Setting the resolution to 10 bits (as in the above example) sample rate to 1000 samples/sec, and the CPU
clock to 12 MHz, then (in the equation below) about 21 percent of the CPU is utilized.
Equation 15
The graph below shows CPU utilization for the supported sample rates and resolutions. The default CPU
speed is set to 12 MHz.
Figure 4.
CPU Utilization for Supported Sample Rates and Resolutions
Document Number: 001-13626 Rev. *I
Page 8 of 32
Triple Input 7- to 13-Bit Incremental ADC
Frequency Rejection
By selecting the proper integrate time, some noise sources may be rejected. To reject a noise source and
its harmonics, select an integrate time that is equal to an integral cycle of the noise signal. If more than
one signal is to be rejected, select an integrate time that is equal to an integral cycle of both signals.
For example, if noise caused by 50 Hz and 60 Hz signals is to be rejected, select a period that contains an
integral number of both the 50 Hz and 60 Hz signals.
Equation 16
An IntegrateTime of 100 ms will reject both 50 Hz and 60 Hz, and any harmonics of these signals. Next,
calculate the DataClock required to generate the proper IntegrateTime.
Equation 17
Notice that the CalcTime is not used in this calculation, although it affects the sample rate. The
IntegrateTime is the period when the TriADC is actually sampling the input voltage. The sample rate is
based on the IntegrateTime and the time it takes to calculate the result.
Example
An IntegrateTime of 100 ms and an A/D resolution of 13 bits are required for a given application. For a 100
ms IntegrateTime, the data clock must be:
Equation 18
The CalcTime in terms of the Data Clock, must be calculated from the DataClock and the CPU Clock. If
the CPU clock is 12 MHz, the minimum calculation time would be:
Equation 19
This CalcTime should be rounded up to the nearest whole number (in this example it is 10). Now to
determine the sample rate:
Equation 20
If a longer sample rate is desired, the CalcTime may be increased until the CalcTime + 213+2 is less than
or equal to 216 -1 (65535).
Document Number: 001-13626 Rev. *I
Page 9 of 32
Triple Input 7- to 13-Bit Incremental ADC
DC and AC Electrical Characteristics
The following values are indicative of expected performance and based on initial characterization data.
Unless otherwise specified in the table below, TA = 25C, Vdd = 5.0V, Power HIGH, Op-Amp bias LOW,
output referenced to 2.5V external Analog Ground on P2[4] with 1.25 external Vref on P2[6] and resolution
set at 13 bits.
Table 1.
5.0V TriADC DC and AC Electrical Characteristics, CY8C27/24/22xxxFamily of PSoC Devices
Parameter
Typical
Limit
Units
Conditions and Notes
Input
Input Voltage Range
---
Vss to Vdd
Input Capacitance1
3
---
pF
Input Impedance
1/(C*clk)
---
Ω
Resolution
7 to 13
Bits
Sample Rate
4 to 10,000
sps
77
---
dB
DNL
.25
---
LSB
INL
1.0
---
LSB
9
---
mV
Including Reference Gain Error
3.0
--
% FSR
Excluding Reference Gain Error2
0.1
--
% FSR
Low Power
500
---
µA
Med Power
1600
---
µA
High Power
6000
---
µA
Data Clock
---
0.125 to 8.0
MHz
SNR
Ref Mux = Vdd/2 ± Vdd/2
DC Accuracy
Offset Error
Column clock 2 MHz
Gain Error
Operating Current
Document Number: 001-13626 Rev. *I
Input to digital blocks and
analog column clock
Page 10 of 32
Triple Input 7- to 13-Bit Incremental ADC
The following values are indicative of expected performance and based on initial characterization data.
Unless otherwise specified in the table below, TA = 25C, Vdd = 3.3V, Power HIGH, Op-Amp bias LOW,
output referenced to 1.64V external Analog Ground on P2[4] with 1.25 external Vref on P2[6] and
resolution set at 13 bits.
Table 2.
3.3V TriADC DC and AC Electrical Characteristics, CY8C27/24/22xxxFamily of PSoC Devices
Parameter
Typical
Limit
Units
Conditions and Notes
Input
Input Voltage Range
---
Vss to Vdd
Input Capacitance1
3
---
Input Impedance
1/(C*clk)
---
Ref Mux = Vdd/2 ± Vdd/2
pF
Resolution
7 to 13
Bits
Sample Rate
4 to 10,000
sps
77
---
dB
DNL
.25
---
LSB
INL
1.0
---
LSB
4
---
mV
Including Reference Gain Error
3.0
--
% FSR
Excluding Reference Gain Error2
0.4
--
% FSR
Low Power
440
---
µA
Med Power
1500
---
µA
High Power
5700
---
µA
Data Clock
---
0.125 to 8.0
MHz
SNR
DC Accuracy
Offset Error
Column clock 2 MHz
Gain Error
Operating Current
Input to digital blocks and
analog column clock
Electrical Characteristics Notes
1. Includes I/O pin.
2. Reference Gain Error measured by comparing the external reference to VRefHigh and VRefLow routed
through the test mux and back out to a pin.
3. Typical values represent parametric norm at +25°C.
4. Input voltages above the maximum will generate a maximum positive reading. Input voltages below the
minimum will generate a maximum negative reading.
5. User module only, not including I/O pin.
6. The input Capacitance or impedance is only applicable when input to analog block is directly to a pin.
7. C = input Capacitance, clk = Data Clock (Analog Column Clock).
Document Number: 001-13626 Rev. *I
Page 11 of 32
Triple Input 7- to 13-Bit Incremental ADC
8. Specifications are for sample rates of 100 sps and a data clock of 8 MHz, unless otherwise noted. Sample rate is dependent on both Data Clock and resolution.
9. SNR = Ratio of power of full scale single tone divided by total noise integrated to Fsample/2.
Placement
The ADC (switch cap) blocks can be placed in any of the switched capacitor PSoC blocks. They must be
able to each exclusively drive the comparator bus for the particular column in which it is placed. In other
words, each of the three blocks must be in a different column and can not share a column with another
switch cap block that connects to the comparator bus.
The counter blocks may be placed in any available digital block, but the PWM16 may only be placed in
specific locations. In the CY8C27xxx and CY8CLED08 device families possible placements for the
PWB16 (LSB/MSB) are DBB00/DBB01, DBB01/DCB02, DBB10/DBB11, and DBB11/DCB12. In the
CY8C29/24/22xxx and CY8CLED04/16 device families the PWM16 can be placed in any two consecutive
digital blocks.
The three counter blocks and PWM block each have an interrupt service routine. It is desirable that the
counter block have a higher interrupt priority than the PWM16 block. Therefore, it is recommended that the
counter block be placed in a lower digital block position than the PWM16 block.
Note
When initially selecting the TriADC, a warning may appear that states “Resource allocation prevents placement." This warning will be displayed if the original placement has two ADC blocks in
the same column. Simply move each ADC block to its own column.
Parameters and Resources
ADC Input1, ADC Input2, ADC Input3
The selection of the input is done after the analog PSoC block has been placed. The eight switched
cap blocks have different input selections. Each can be connected to most of its neighbors, while
some can be directly connected to external input pins. Placement of the analog blocks must be done
with some consideration of how to get an input signal to it. Some placements allow inputs to be routed
directly from package pins to the input. These direct connections will allow inputs that are within 40
mV of the supply rails to be measured accurately. Signals may also be routed through one of the
column muxes, through one of the CT Block test muxes, and onto an analog column where the
TriADC can also measure signals near the power supply rails. There is one selection for each of the
three ADC inputs.
ClockPhase1, ClockPhase2, ClockPhase3
The selection of the Clock Phase is used to synchronize the output of one switched capacitor analog
PSoC block to the input of another. The switched cap analog PSoC blocks use a two-phase clock (φ 1,
φ 2) to acquire and transfer signal. Typically, the input to the TriADC is sampled on φ 1, the Normal
setting. A problem arises in that many of the user modules auto-zero their output during φ 1 and only
provide a valid output during φ 2. If such a module’s output is fed to the TriADC’s input, the TriADC
will acquire an auto-zeroed output instead of a valid signal. The Clock Phase selection allows the
phases to be swapped so that the input signal is now acquired during φ 2, the Swapped setting. There
is one selection for each of the three switch cap blocks.
ADCResolution
This selection allows the resolution of the TriADC to be set in the Device Editor. Although there is an
API routine to set or change the resolution, it is not required if set in the Device Editor. The resolution
Document Number: 001-13626 Rev. *I
Page 12 of 32
Triple Input 7- to 13-Bit Incremental ADC
can also be changed at anytime with the API call, but the TriADC will be stopped and must be
restarted. Valid resolution settings are 7 to 13 inclusive.
CalcTime
The CalcTime is the amount of time it takes the CPU to calculate intermediate integration results
before the next integrate cycle can start. The time it takes to calculate the result “CalcTime" varies
inversely proportionally with the CPU clock. This value must be in terms of the Data Clock. Minimum
CPU calculation time is 371 CPU clocks. CalcTime may also be increased to optimize the sample
rate.
Care should be taken to make sure the CalcTime + of 2Bits+2 does not exceed 216-1 or 65,535.
Note
Below is an equation to determine what the CalcTime should be set to:
Equation 21
The following table shows the ranges that may be selected for the CalcTime parameter. Use the
above equation to set the low end of the usable range for a given application.
Table 3.
CalcTime Parameter Ranges
Resolution
Integrate Time (DataClock Counts)
CalcTime Range (DataClock Counts)
7
512
1 to 65,023
8
1,024
1 to 64,511
9
2,048
1 to 63,487
10
4,096
1 to 61,439
11
8,192
1 to 57,343
12
16,384
1 to 49,151
13
32,768
1 to 32,767
For example, if the DataClock is set to 1.5 MHz and the CPU is running at 12 MHz, the CalcTime
should be set to greater than or equal to 47. See the equation below.
Equation 22
DataClock and Integrator Column Clock
The DataClock determines the sample rate and the signal sample window. This clock must be routed
to the clock input of the counter block, the 16-bit PWM block, and the column clock for the column
containing the integrator.
This parameter setting will only set the clock to the counter block and the PWM block.
Document Number: 001-13626 Rev. *I
Page 13 of 32
Triple Input 7- to 13-Bit Incremental ADC
Note
The column clocks of the integrator switch cap blocks must be manually set to the SAME clock. It
is imperative that the same clock be used for all eight blocks or this user module will not function
correctly.
This clock may be any source with a clock rate between 125 kHz and 8 MHz.
Equation 23
The graph below shows possible sample rates for each of the resolution options for the TriADC.
Figure 5.
Samples for Each Resolution Option for the TriADC
Ref Mux Global Resource
The usable input voltage range is determined by the selection of the “Ref Mux" option in the “Global
Resource" section of the Device editor. The Ref Mux selection determines the Analog ground and the
usable range of the input voltage about analog ground. For example, if “Vdd/2 ± BandGap" is
selected, and Vdd = 5 volts, the usable input range is 2.5 +/- 1.3 volts (1.2 to 3.8 volts). The following
table shows the valid ranges for a Vdd of 5 and 3.3 volts.
Table 4.
CY8C27/24/22xxxInput Voltage Ranges for Each Ref Mux Setting
RefMux Setting
Vdd = 5 Volts
Vdd = 3.3 Volts
(Vdd/2) ± BandGap
1.2 < Vin < 3.8
0.35 < Vin < 2.95
(Vdd/2) ± (Vdd/2)
0 < Vin < 5
0 < Vin < 3.3
BandGap ± BandGap
0 < Vin < 2.6
0 < Vin < 2.6
(1.6*BandGap) ± (1.6*BandGap)
0 < Vin < 4.16
NA
Document Number: 001-13626 Rev. *I
Page 14 of 32
Triple Input 7- to 13-Bit Incremental ADC
RefMux Setting
Vdd = 5 Volts
Vdd = 3.3 Volts
(2*BandGap) ± BandGap
1.3 < Vin < 3.9
NA
(2*BandGap) ± P2[6]
(2.6 - VP2[6]) < Vin < (2.6 + VP2[6])
NA
P2[4] ± BandGap
(VP2[4] - 1.3) < Vin < (VP2[4] + 1.3)
(VP2[4] - 1.3) < Vin < (VP2[4] + 1.3)
P2[4] ± P2[6]
(VP2[4]-VP2[6]) < Vin < (VP2[4]+VP2[6])
(VP2[4]-VP2[6]) < Vin < (VP2[4]+VP2[6])
DataFormat
This selection determines in what format the result will be returned. If “Signed" is selected and “N" is
the selected resolution, the result will range from 2N-1 to 2N-1-1. If “Unsigned" is selected, the result
will be between 0 and 2N-1. See the table below for result range for each Data Format and resolution.
Table 5.
Data Format Result Ranges
Resolution Setting
Signed Data Format
Unsigned Data Format
7
-64 to 63
0 to 127
8
-128 to 127
0 to 255
9
-256 to 255
0 to 511
10
-512 to 511
0 to 1023
11
-1024 to 1023
0 to 2047
12
-2048 to 2047
0 to 4095
13
-4096 to 4095
0 to 8191
Interrupt Generation Control
There following parameter is only available if the Enable interrupt generation control check box in
PSoC Designer is checked. This is available under Project > Settings > Chip Editor. Interrupt
Generation Control is important when multiple overlays are used with interrupts shared by multiple user
modules across overlays.
IntDispatchMode
The IntDispatchMode parameter is used to specify how an interrupt request is handled for interrupts
shared by multiple user modules existing in the same block but in different overlays. Selecting
“ActiveStatus" causes firmware to test which overlay is active before servicing the shared interrupt
request. This test occurs every time the shared interrupt is requested. This adds latency and also
produces a nondeterministic procedure of servicing shared interrupt requests, but does not require
any RAM. Selecting “OffsetPreCalc" causes firmware to calculate the source of a shared interrupt
request only when an overlay is initially loaded. This calculation decreases interrupt latency and
produces a deterministic procedure for servicing shared interrupt requests, but at the expense of a
byte of RAM.
Document Number: 001-13626 Rev. *I
Page 15 of 32
Triple Input 7- to 13-Bit Incremental ADC
Application Programming Interface
The Application Programming Interface (API) routines are provided as part of the user module to allow the
designer to deal with the module at a higher level. This section specifies the interface to each function
together with related constants provided by the “include" files.
Note
In this, as in all user module APIs, the values of the A and X register may be altered by calling an API
function. It is the responsibility of the calling function to preserve the values of A and X before the call if
those values are required after the call. This “registers are volatile" policy was selected for efficiency
reasons and has been in force since version 1.0 of PSoC Designer. The C compiler automatically takes
care of this requirement. Assembly language programmers must ensure their code observes the policy,
too. Though some user module API function may leave A and X unchanged, there is no guarantee they
will do so in the future.
For Large Memory Model devices, it is also the caller's responsibility to preserve any value in the
CUR_PP, IDX_PP, MVR_PP, and MVW_PP registers. Even though some of these registers may not be
modified now, there is no guarantee that will remain the case in future releases.
API routines can initialize, configure, start sampling, stop, and read the resultant data from the ADC. In all
cases the “instance name" of the module will replace the “TriADC" prefix shown in the following entry
points.
TriADC_Start
Description:
Performs all required initialization for this user module and sets the power level for the switched
capacitor PSoC block.
C Prototype:
void
TriADC_Start (BYTE bPowerSetting)
Assembly:
mov
A, TriADC_HIGHPOWER
lcall TriADC_Start
Parameters:
PowerSetting: One byte that specifies the power level. Following reset and configuration, the analog
PSoC block assigned to TriADC is powered down. Symbolic names, provided in C and assembly, and
their associated values, are given in the following table.
Symbolic Name
Value
TriADC_OFF
0
TriADC_LOWPOWER
1
TriADC_MEDPOWER
2
TriADC_HIGHPOWER
3
Power level will have an effect on analog performance. The correct power setting is sensitive to the
sample rate of the data clock and has to be determined for each application. It is recommended that
Document Number: 001-13626 Rev. *I
Page 16 of 32
Triple Input 7- to 13-Bit Incremental ADC
you start your development with full power selected. Testing can later be done to determine how low
you can set the power setting.
Return Value:
None
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_SetPower
Description:
Sets the power level for the switched capacitor PSoC block.
C Prototype:
void
TriADC_SetPower (BYTE bPowerSetting)
Assembly:
mov
A, [bPowerSetting]
lcall TriADC_SetPower
Parameters:
PowerSetting: Same as the PowerSetting parameter used for the "Start" API routine above. Allows
the user to change the power level while operating the ADC.
Return Value:
None
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_SetResolution
Description:
Sets the resolution of the A/D converter.
C Prototype:
void
TriADC_SetResolution (BYTE bResolution)
Assembly:
mov
A, [bResolution]
lcall TriADC_SetResolution
Parameters:
Resolution: The resolution of the A/D converter may be set either in the device editor, or in the user
firmware. If not set in the firmware, the ADC will use the resolution set in the Device Editor by default.
Values for resolution may be set between 7 and 13 bits.
Document Number: 001-13626 Rev. *I
Page 17 of 32
Triple Input 7- to 13-Bit Incremental ADC
Return Value:
None
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_Stop
Description:
Sets the power level on the switched capacitor integrator block to Off. This is done when the TriADC
in not being used and the user wishes to save power. This routine powers down the analog switch
capacitor block and disables the digital blocks. To achieve the lowest power level, the clock should
be removed from the digital blocks as well.
C Prototype:
void
TriADC_Stop()
Assembly:
lcall
TriADC_Stop
Parameters:
None
Return Value:
None
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions.
TriADC_GetSamples
Description:
Initializes and starts the ADC algorithm to collect the specified number of samples. REMEMBER to
enable global interrupts by calling the M8C_EnableGInt macro call in M8C.inc or M8C.h.
C Prototype:
void
TriADC_GetSamples (BYTE bNumSamples)
Assembly:
mov
A, [bNumSamples]
lcall TriADC_GetSamples
Parameters:
NumSamples: An 8-bit value that sets the number of samples to be retrieved. A value of ‘0‘ causes
the ADC to run continuously.
Document Number: 001-13626 Rev. *I
Page 18 of 32
Triple Input 7- to 13-Bit Incremental ADC
Return Value:
None
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_StopAD
Description:
Immediately halts the ADC.
C Prototype:
void
TriADC_StopAD()
Assembly:
lcall
TriADC_StopAD
Parameters:
None
Return Value:
None
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions.
TriADC_fIsDataAvailable, fIsData
Description:
Returns non-zero when a data conversion has been completed and data is available for reading.
C Prototype:
CHAR
CHAR
TriADC_fIsDataAvailable()
TriADC_fIsData()
Assembly:
lcall
TriADC_fIsDataAvailable
Parameters:
None
Return Value:
Returns non-zero when data is available.
Document Number: 001-13626 Rev. *I
Page 19 of 32
Triple Input 7- to 13-Bit Incremental ADC
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_iGetData1
Description:
Returns last converted data for ADC Input1. fIsDataAvailable() should be called prior to getting the
data, to ensure that the data is valid. Data must be retrieved before the next conversion cycle is
completed or else the data will be overwritten. There is a possibility that the returned data will be
corrupted if the call to this function is done exactly at the end of an integration period. It is therefore
highly recommended that the data retrieval be done at a higher frequency than the sampling rate, or
if that cannot be guaranteed that interrupts be turned off before calling this function.
C Prototype:
INT
TriADC_iGetData1()
Assembly:
lcall
TriADC_iGetData1
Parameters:
None
Return Value:
Converted integer value is returned. In assembler, the MSB is returned in the X register and the LSB
in the accumulator.
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_iGetData2
Description:
Returns last converted data for ADC Input2. fIsDataAvailable() should be called prior to getting the
data, to ensure that the data is valid. Data must be retrieved before the next conversion cycle is
completed or else the data will be overwritten. There is a possibility that the returned data will be
corrupted if the call to this function is done exactly at the end of an integration period. It is therefore
highly recommended that the data retrieval be done at a higher frequency than the sampling rate, or
if that cannot be guaranteed that interrupts be turned off before calling this function.
C Prototype:
INT
TriADC_iGetData2()
Assembly:
lcall
TriADC_iGetData2
Document Number: 001-13626 Rev. *I
Page 20 of 32
Triple Input 7- to 13-Bit Incremental ADC
Parameters:
None
Return Value:
Converted integer value is returned. In assembler, the MSB is returned in the X register and the LSB
in the accumulator.
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_iGetData3
Description:
Returns last converted data for ADC Input3. fIsDataAvailable() should be called prior to getting the
data, to ensure that the data is valid. Data must be retrieved before the next conversion cycle is
completed or else the data will be overwritten. There is a possibility that the returned data will be
corrupted if the call to this function is done exactly at the end of an integration period. It is therefore
highly recommended that the data retrieval be done at a higher frequency than the sampling rate, or
if that cannot be guaranteed that interrupts be turned off before calling this function.
C Prototype:
INT
TriADC_iGetData3()
Assembly:
lcall
TriADC_iGetData3
Parameters:
None
Return Value:
Converted integer value is returned. In assembler, the MSB is returned in the X register and the LSB
in the accumulator.
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_ClearFlag
Description:
Clears Data Available flag.
C Prototype:
void
TriADC_ClearFlag()
Assembly:
lcall
TriADC_ClearFlag
Document Number: 001-13626 Rev. *I
Page 21 of 32
Triple Input 7- to 13-Bit Incremental ADC
Parameters:
None
Return Value:
None
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_iGetData1ClearFlag
Description:
Returns last converted data for ADC Input1 and clears the Data Available flag. fIsDataAvailable()
should be called prior to getting the data, to ensure that the data is valid. Data must be retrieved before
the next conversion cycle is completed or else the data will be overwritten. There is a possibility that
the returned data will be corrupted if the call to this function is done exactly at the end of an integration
period. It is therefore highly recommended that the data retrieval be done at a higher frequency than
the sampling rate, or if that cannot be guaranteed that interrupts be turned off before calling this function.
C Prototype:
INT
TriADC_iGetData1ClearFlag()
Assembly:
lcall
TriADC_iGetData1ClearFlag
Parameters:
None
Return Value:
Converted integer value is returned. In assembler, the MSB is returned in the X register and the LSB
in the accumulator.
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_iGetData2ClearFlag
Description:
Returns last converted data for ADC Input2 and clears the Data Available flag. fIsDataAvailable()
should be called prior to getting the data, to ensure that the data is valid. Data must be retrieved before
the next conversion cycle is completed or else the data will be overwritten. There is a possibility that
the returned data will be corrupted if the call to this function is done exactly at the end of an integration
period. It is therefore highly recommended that the data retrieval be done at a higher frequency than
the sampling rate, or if that cannot be guaranteed that interrupts be turned off before calling this function.
Document Number: 001-13626 Rev. *I
Page 22 of 32
Triple Input 7- to 13-Bit Incremental ADC
C Prototype:
INT
TriADC_iGetData2ClearFlag()
Assembly:
lcall
TriADC_iGetData2ClearFlag
Parameters:
None
Return Value:
Converted integer value is returned. In assembler, the MSB is returned in the X register and the LSB
in the accumulator.
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
TriADC_iGetData3ClearFlag
Description:
Returns last converted data for ADC Input3 and clears the Data Available flag. fIsDataAvailable()
should be called prior to getting the data, to ensure that the data is valid. Data must be retrieved before
the next conversion cycle is completed or else the data will be overwritten. There is a possibility that
the returned data will be corrupted if the call to this function is done exactly at the end of an integration
period. It is therefore highly recommended that the data retrieval be done at a higher frequency than
the sampling rate, or if that cannot be guaranteed that interrupts be turned off before calling this function.
C Prototype:
INT
TriADC_iGetData3ClearFlag()
Assembly:
lcall
TriADC_iGetData3ClearFlag
Parameters:
None
Return Value:
Converted integer value is returned. In assembler, the MSB is returned in the X register and the LSB
in the Accumulator.
Note
The functions ClearFlag, iGetData1ClearFlag, iGetData2ClearFlag, and iGetData3ClearFlag all
clear the same flag. They are included to provide the greatest amount of flexibility when clearing
the conversion complete flag. When the A/D conversion is complete, the user may choose to
ignore the result of one or both channels and simply clear the flag without retrieving the data.
Side Effects:
The A and X registers may be modified by this or future implementations of this function. The same
is true for all RAM page pointer registers in the Large Memory Model (CY8C29xxx and CY8CLED16).
Document Number: 001-13626 Rev. *I
Page 23 of 32
Triple Input 7- to 13-Bit Incremental ADC
When necessary, it is the calling function's responsibility to preserve the values across calls to
fastcall16 functions. Currently, only the CUR_PP page pointer register is modified.
Sample Firmware Source Code
This sample code starts a continuous conversion, polls the data available flag, and sends the converted
byte to a user function.
;;; Sample Code for the TRIADC
;;; Continuously Sample and call a user routine with the converted
;;; data sample.
;;;
;;; NOTE: The User Routine must complete operation within one
;;; conversion cycle in order to retrieve the next converted sample
;;; data.
;;;
include "m8c.inc"
; part specific constants and macros
include "PSoCAPI.inc"
; PSoC API definitions for all User Modules
export _main
_main:
M8C_EnableGInt
;Enable interrupts
mov
a, 10
;Set resolution to 10 Bits
call TRIADC_SetResolution
mov
a, TRIADC_HIGHPOWER ;Set Power and Enable A/D
call TRIADC_Start
mov
a, 00h
;Start A/D in continuous sampling mode
call TRIADC_GetSamples
;A/D conversion loop
loop1:
wait:
;Poll until data is complete
call TRIADC_fIsDataAvailable
jz
wait
call TRIADC_ClearFlag
;Reset flag
call TRIADC_iGetData1
;Get Data - X=MSB A=LSB
call User_Function
;Call user routine to use data from
;ADC Input1
call TRIADC_iGetData2
;Get Data - X=MSB A=LSB
call User_Function
;Call user routine to use data
;ADC Input2
call TRIADC_iGetData3
;Get Data - X=MSB A=LSB
call User_Function
;Call user routine to use data
;ADC Input3
jmp
loop1
A sample project written in C:
//--------------------------------------------------------------------// Sample C Code for the TriADC
// Continuously Sample and call a user function with the data.
// This example differs from the ASM example, in that the DataAvailable
// flag is automatically cleared when the third value is read instead
// of clearing the flag prior to reading the data.
//
//---------------------------------------------------------------------
Document Number: 001-13626 Rev. *I
Page 24 of 32
Triple Input 7- to 13-Bit Incremental ADC
#include <m8c.h>
#include "PSoCAPI.h"
// part specific constants and macros
// PSoC API definitions for all User Modules
extern void User_Function(int iResult1, int iResult2, int iResult3);
void main(void)
{
int iResult1, iResult2, iResult3;
M8C_EnableGInt;
// Enable global interrupts
TRIADC_Start(TRIADC_HIGHPOWER); // Turn on Analog section
TRIADC_SetResolution(10);
// Set resolution to 10 Bits
TRIADC_GetSamples(0);
// Start ADC to read continuously
for(;;)
{
while(TRIADC_fIsDataAvailable() == 0); // Wait for data to be ready
iResult1 = TRIADC_iGetData1();
// Get Data from ADC Input1
iResult2 = TRIADC_iGetData2();
// Get Data from ADC Input2
iResult3 = TRIADC_iGetData3ClearFlag(); // Get Data from ADC Input3
// and clear data ready flag
User_Function(iResult1,iResult2,iResult3); // User function to use
// data
}
}
Configuration Registers
These registers are configured by the initialization and API library. The user does not have to change or
read these registers directly. This section is supplied as a reference.
The ADC is a switched capacitor PSoC block. It is configured to make an analog modulator. To build the
modulator, the block is configured to be an integrator with reference feedback that converts the input value
into a digital pulse stream. The input multiplexer determines what signal is digitized.
Table 6.
Block ADC1: Register CR0
Bit
Value
Table 7.
7
1
0
5
0
4
1
3
0
2
0
1
0
0
0
Block ADC1: Register CR1
Bit
Value
6
7
6
5
ACMux, AMux
4
0
3
0
2
0
1
0
0
0
ACMux is used when the block is placed in a type “A" block. Field value depends on how the user
connects the input. AMux is used when the block is placed in a type “B" block. Field value depends on how
the user connects the input.
Table 8.
Block ADC1: Register CR2
Bit
Value
7
0
6
1
Document Number: 001-13626 Rev. *I
5
1
4
0
3
0
2
0
1
0
0
0
Page 25 of 32
Triple Input 7- to 13-Bit Incremental ADC
Table 9.
Block ADC1: Register CR3
Bit
Value
7
1
6
1
5
1
4
FSW0
3
0
2
0
1
0
0
0
FSW0 is used by the PWM interrupt handler and various APIs. A ‘0‘ value causes the ADC to be a
disabled integrator. A ‘1‘ value causes the ADC to be an enabled integrator.
Table 10.
Block ADC2: Register CR0
Bit
Value
Table 11.
7
1
0
5
0
4
1
3
0
2
0
1
0
0
0
Block ADC2: Register CR1
Bit
Value
6
7
6
5
ACMux, AMux
4
0
3
0
2
0
1
0
0
0
ACMux is used when the block is placed in a type “A" block. Field value depends on how the user
connects the input. AMux is used when the block is placed in a type “B" block. Field value depends on how
the user connects the input.
Table 12.
Block ADC2: Register CR2
Bit
Value
Table 13.
7
0
1
5
1
4
0
3
0
2
0
1
0
0
0
Block ADC2: Register CR3
Bit
Value
6
7
1
6
1
5
1
4
FSW0
3
0
2
0
1
0
0
0
FSW0 is used by the PWM interrupt handler and various APIs. A ‘0‘ value causes the ADC to be a
disabled integrator. A ‘1‘ value causes the ADC to be an enabled integrator.
Table 14.
Block ADC3: Register CR0
Bit
Value
Table 15.
7
1
0
5
0
4
1
3
0
2
0
1
0
0
0
Block ADC3: Register CR1
Bit
Value
6
7
6
5
ACMux, AMux
4
0
3
0
2
0
1
0
0
0
ACMux is used when the block is placed in a type “A" block. Field value depends on how the user
connects the input. AMux is used when the block is placed in a type “B" block. Field value depends on how
the user connects the input.
Table 16.
Block ADC3: Register CR2
Bit
Value
Table 17.
7
0
1
5
1
4
0
3
0
2
0
1
0
0
0
Block ADC3: Register CR3
Bit
Value
6
7
1
6
1
Document Number: 001-13626 Rev. *I
5
1
4
FSW0
3
0
2
0
1
0
0
0
Page 26 of 32
Triple Input 7- to 13-Bit Incremental ADC
FSW0 is used by the PWM interrupt handler and various APIs. A ‘0‘ value causes the ADC to be a
disabled integrator. A ‘1‘ value causes the ADC to be an enabled integrator.
The PWM16 is a digital PsoC block that is used to control the integration time of the ADC. The compare
value is set to 2Bits+2, and the period is set to the CalcTime plus the compare value.
Table 18.
Block PWM16_MSB: Register Function
Bit
Value
7
0
6
0
5
1
4
Compare
Type
3
Interrupt
Type
2
0
1
0
0
1
Compare Type is a flag that indicates whether the capture comparison is “equal to or less than" or “less
than." Interrupt Type is a flag that indicates whether to trigger the interrupt on the capture event or the
terminal condition. Both parameters are set in the Device Editor.
Table 19.
Block PWM16_LSB: Register Function
Bit
Value
7
0
6
0
5
0
4
Compare
Type
3
0
2
0
1
0
0
1
Compare Type is a flag that indicates whether the compare function is set to “equal to or less than" or “less
than." This parameter is set in the Device Editor.
Table 20.
Block PWM16_MSB: Register Input
Bit
Value
7
0
6
0
5
1
4
1
3
2
1
0
Clock
Clock selects clock input from one of 16 sources. This parameter is set in the Device Editor.
Table 21.
Block PWM16_LSB: Register Input
Bit
Value
7
6
5
4
Enable
3
2
1
0
Clock
Enable selects data input from one of 16 sources and Clock selects clock input from one of 16 sources.
Both parameters are set in the Device Editor.
Table 22.
Block PWM16_MSB: Register Output
Bit
Value
7
0
6
0
5
0
4
0
3
0
2
Output
Enable
1
0
Output Sel
Output Enable is the flag that indicates the output is enabled. Output Sel is the flag that indicates where
the output of the PWM16 will be routed. Both parameters are set in the Device Editor.
Table 23.
Block PWM16_LSB: Register Output
Bit
Value
Table 24.
Bit
Value
7
0
6
0
5
0
4
0
3
0
2
0
1
0
0
0
Block PWM16_MSB: Count Register DR0
7
6
5
4
3
2
1
0
Count(MSB)
Document Number: 001-13626 Rev. *I
Page 27 of 32
Triple Input 7- to 13-Bit Incremental ADC
Count: PWM16 MSB down PWM. It can be read using the PWM16 API.
Table 25.
Block PWM16_LSB: Count Register DR0
Bit
Value
7
6
5
4
3
2
1
0
2
1
0
Count(LSB)
Count: PWM16 LSB down PWM. It can be read using the PWM16 API.
Table 26.
Block PWM16_MSB: Period Register DR1
Bit
Value
7
6
5
4
3
Period(MSB)
Period holds the MSB of the period value that is loaded into the Counter register, upon enable or terminal
count condition. It Can be set by the Device Editor and the PWM16 API.
Table 27.
Block PWM16_LSB: Period Register DR1
Bit
Value
7
6
5
4
3
2
1
0
Period(LSB)
Period holds the LSB of the period value that is loaded into the Counter register, upon enable or terminal
count condition. It can be set by the Device Editor and the PWM16 API.
Table 28.
Block PWM16_MSB: Pulse Width Register DR2
Bit
Value
7
6
5
4
3
2
1
0
Pulse Width(MSB)
PulseWidth holds the MSB of the pulse width value used to generate the compare event. It can be set by
the Device Editor and the PWM16 API.
Table 29.
Block PWM16_LSB: Pulse Width Register DR2
Bit
Value
7
6
5
4
3
2
1
0
Pulse Width(LSB)
PulseWidth holds the LSB of the pulse width value used to generate the compare event. It can be set by
the Device Editor and the PWM16 API.
Table 30.
Block PWM16_MSB: Control Register CR0
Bit
Value
7
0
6
0
5
0
4
0
3
0
2
0
1
0
0
Start/
Stop(0)
Start/Stop is controlled by the LSB control register value, set to zero.
Table 31.
Bit
Block PWM16_LSB: Control Register CR0
7
6
Value
5
4
3
2
1
0
Start/ Stop
Start/Stop, when set, indicates that the PWM16 is enabled. It is modified by using the PWM16 API.
Document Number: 001-13626 Rev. *I
Page 28 of 32
Triple Input 7- to 13-Bit Incremental ADC
The CNT is a digital PSoC block configured as a counter. When the value in DR0 counts down to terminal
count, an interrupt is called to decrement a higher value software counter and CNT reloads from DR1. The
data is outputted through DR2.
Table 32.
Block CNT1: Register Function
Bit
Value
Table 33.
7
0
0
5
1
4
0
3
0
2
0
1
0
0
1
Block CNT1: Register Input
Bit
Value
6
7
6
5
4
Data
3
2
1
0
Clock
Data selects the column comparator where the ADC block has been placed. Clock selects clock input from
one of 16 sources and is set in the Device Editor.
Table 34.
Block CNT1: Register Output
Bit
Value
Table 35.
7
0
Table 36.
7
Table 37.
0
3
0
2
0
1
0
0
0
6
5
4
3
2
1
0
5
4
3
2
1
0
Block CNT1: Register DR1
7
1
6
1
1
1
1
1
1
1
Block CNT1: Register DR2
Bit
Value
0
4
Count Value
Bit
Value
0
5
Block CNT1: Register DR0
Bit
Value
6
7
6
5
4
3
2
1
0
3
2
1
0
Data Out
Data Out is used by the API to get the counter value.
Table 38.
Block CNT1: Register CR0
Bit
Value
7
0
6
0
5
0
4
0
0
0
0
Enable
When Enable is set, CNT is enabled. It is modified and controlled by the TriADC API
Document Number: 001-13626 Rev. *I
Page 29 of 32
Triple Input 7- to 13-Bit Incremental ADC
Table 39.
Block CNT2: Register Function
Bit
Value
Table 40.
7
0
0
5
1
4
0
3
0
2
0
1
0
0
1
Block CNT2: Register Input
Bit
Value
6
7
6
5
4
Data
3
2
1
0
Clock
Data selects the column comparator where the ADC block has been placed. Clock selects clock input from
one of 16 sources and is set in the Device Editor.
Table 41.
Block CNT2: Register Output
Bit
Value
Table 42.
7
0
Table 43.
7
Table 44.
0
3
0
2
0
1
0
0
0
6
5
4
3
2
1
0
5
4
3
2
1
0
Block CNT2: Register DR1
7
1
6
1
1
1
1
1
1
1
Block CNT2: Register DR2
Bit
Value
0
4
Count Value
Bit
Value
0
5
Block CNT2: Register DR0
Bit
Value
6
7
6
5
4
3
2
1
0
3
2
1
0
Data Out
Data Out is used by the API to get the counter value.
Table 45.
Block CNT2: Register CR0
Bit
Value
7
0
6
0
5
0
4
0
0
0
0
Enable
When Enable is set, CNT is enabled. It is modified and controlled by the TriADC API.
Table 46.
Block CNT3: Register Function
Bit
Value
7
0
6
0
Document Number: 001-13626 Rev. *I
5
1
4
0
3
0
2
0
1
0
0
1
Page 30 of 32
Triple Input 7- to 13-Bit Incremental ADC
Table 47.
Block CNT3: Register Input
Bit
Value
7
6
5
4
Data
3
2
1
0
Clock
Data selects the column comparator where the ADC block has been placed. Clock selects clock input from
one of 16 sources and is set in the Device Editor.
Table 48.
Block CNT3: Register Output
Bit
Value
Table 49.
7
0
Table 50.
7
Table 51.
0
3
0
2
0
1
0
0
0
6
5
4
3
2
1
0
5
4
3
2
1
0
Block CNT3: Register DR1
7
1
6
1
1
1
1
1
1
1
Block CNT3: Register DR2
Bit
Value
0
4
Count Value
Bit
Value
0
5
Block CNT3: Register DR0
Bit
Value
6
7
6
5
4
3
2
1
0
3
2
1
0
Data Out
Data Out is used by the API to get the counter value.
Table 52.
Block CNT3: Register CR0
Bit
Value
7
0
6
0
5
0
4
0
0
0
0
Enable
When Enable is set, CNT is enabled. It is modified and controlled by the TriADC API.
Table 53.
Bit
Register INT_MSK1
7
6
5
4
3
2
1
0
Value
The mask bits corresponding to the PWM block and CNT block are set here to enable their respective
interrupts. The actual mask values are determined by the placement position of each block.
Document Number: 001-13626 Rev. *I
Page 31 of 32
Triple Input 7- to 13-Bit Incremental ADC
Version History
Version
2.1
Originator
DHA
Description
Added DRC to check if:
1. The source clock is different in digital and analog resources.
2. The ADC Clock is higher than CPU Clock.
2.20
DHA
Restored VC3 as the source for the data clock
2.20.b
MYKZ
Added design rules check for the situation when ADC clock is faster than 8MHz.
Note
PSoC Designer 5.1 introduces a Version History in all user module datasheets. This section documents high level descriptions of the differences between the current and previous user module versions.
Document Number: 001-13626 Rev. *I
Revised March 12, 2015
Page 32 of 32
Copyright © 2001-2015 Cypress Semiconductor Corporation. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility
for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended
to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its
products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products
in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
PSoC Designer™ and Programmable System-on-Chip™ are trademarks and PSoC® is a registered trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks
referenced herein are property of the respective corporations.
Any Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign),
United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works
of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with
a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is
prohibited without the express written permission of Cypress.
Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not
assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems
where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress' product in a life-support systems application implies that the manufacturer
assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.