SLUUDD1 August 2025
Page 1 of the AFE20408 contains ADC configuration registers. The file contains variables for the registers and specific data combinations. You are required to write 0x0001 to the PAGE register before writing or reading from any register on this page.
This page contains the following registers:
| Register | Description |
|---|---|
| ADC_GEN_CFG | Contains False Alarm configurations, ADC Auto/direct mode, and Shunt Range |
| ADC_CONV_CFG_0 | Contains conversion rate configurations |
| ADC_CONV_CFG_1 | Contains sample size configurations |
| ADC_HYST_0 | |
| ADC_HYST_1 | |
| SENSE0_UP_THRESH | |
| SENSE0_LO_THRESH | |
| SENSE1_UP_THRESH | |
| SENSE1_LO_THRESH | |
| ADC0_UP_THRESH | |
| ADC0_LO_THRESH | |
| ADC1_UP_THRESH | |
| ADC1_LO_THRESH | |
| TMP_UP_THRESH |
Example:
#Example: Configure ADC
ftdiObject.spiWrite(PAGE_ADDRESS, PAGE_ADC_CONFIG) #Set ADC page
#Set the following parameters:
#ADC False Alarm = 16
#Sense False Alarm = 32
#Temp False Alarm = 4
#ADC in automode
#Shunt range 163.84mV
ftdiObject.spiWrite(ADC_GEN_CFG_ADDRESS, ADC_GEN_CFG_FALR_ADC_16 + ADC_GEN_CFG_FALR_SENSE_32 + ADC_GEN_CFG_FALR_TMP_4 + ADC_GEN_CFG_AUTOMODE_Automode + ADC_GEN_CFG_SHUNT_RANGE_163p84mVrange)
#Set the following parameters in the ADC_CONV_CFG_0 register:
#ADC Conversion rate = 152us
#SENSE Conversion rate = 282us
#Temperature conversion rate = 4122us
ftdiObject.spiWrite(ADC_CONV_CFG_0_ADDRESS, ADC_CONV_CFG_0_CONV_RATE_ADC_152us + ADC_CONV_CFG_0_CONV_RATE_SENSE_282us + ADC_CONV_CFG_0_CONV_RATE_TMP_4122us)
#Set the following parameters in the ADC_CONV_CFG_1 register:
#ADC Samples = 16
#SENSE Samples = 4
#Temperature Samples = 1
ftdiObject.spiWrite(ADC_CONV_CFG_1_ADDRESS, ADC_CONV_CFG_1_AVG_ADC_16samples + ADC_CONV_CFG_1_AVG_SENSE_4samples + ADC_CONV_CFG_1_AVG_TMP_1sample)