CAT2 Peripheral Driver Library

Functions

int32_t Cy_DSADC_GetResult (const PACSS_DCHAN_Type *base)
 Read the value in the result register of the specified channel. More...
 
int32_t Cy_DSADC_GetAccumulatorResult (const PACSS_DCHAN_Type *base)
 Read the value in the accumulated result register of the specified channel. More...
 
uint32_t Cy_DSADC_CalcMaxCount (const cy_stc_dsadc_dchan_config_t *config)
 Calculate the maximum count value of the conversion result from the passed DCHAN configuration. More...
 

Detailed Description

Function Documentation

◆ Cy_DSADC_GetResult()

int32_t Cy_DSADC_GetResult ( const PACSS_DCHAN_Type *  base)

Read the value in the result register of the specified channel.

Parameters
baseThe base address for the Digital Channel.
Returns
Conversion result

◆ Cy_DSADC_GetAccumulatorResult()

int32_t Cy_DSADC_GetAccumulatorResult ( const PACSS_DCHAN_Type *  base)

Read the value in the accumulated result register of the specified channel.

Parameters
baseThe base address for the Digital Channel.
Returns
Accumulated result

◆ Cy_DSADC_CalcMaxCount()

uint32_t Cy_DSADC_CalcMaxCount ( const cy_stc_dsadc_dchan_config_t config)

Calculate the maximum count value of the conversion result from the passed DCHAN configuration.

The calculated value is used to convert A/D conversion result in count to voltage.

Parameters
configThe configuration for the DCHAN
Returns
The maximum count value of the conversion result calculated from the passed DCHAN configuration.
Note
This function assumes sum of FIR tap coefficients equals 1. This means, FIRADJ term is omitted from the equation. When FIR is used, sum of FIR tap coefficients must be 1. Based equation is as below:
   COmax = M x U x 2^(SL + N1 log2(DR1) - SR + N2 * log2(DR2) - SRR + FIRADJ - SPP)

   = M x U x DR1^N1 x DR2^N2 x 2^(SL - SR - SRR + FIRADJ - SPP)

   = 4 x U x DR1^N1 x DR2^2  x 2^(SL - SR - SRR + 0      - SPP)

   = U x DR1^N1 x DR2^2 x 2^(2 + SL - SR - SRR - SPP)

   = U x DR2^2 x DR1^N1 x 2^(2 + SL - SR - SRR - SPP)

Where: M = Maximum modulator output. (In this driver, fixed to 4)

U = Moving-sum averaging.

SL = SHIFTL value ([0, 9])

N1 = 1st decimation filter order (3 for Sinc3, 4 for Sinc4)

DR1 = 1st decimation ratio ([2, 128])

N2 = 2nd decimation filter order (sinc2, fix 2)

DR2 = 2nd decimation ratio ([1, 32])

SR = DEC_SHIFTR value ([0, 15])

SRR = RR_SHIFTR value ([0, 15])

SPP = PP_SHIFTR value ([0, 15])

FIRADJ = log2(sum(FIRcoeff)) (assumes fix 0)