This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Simple thermistor ADC reading

First off, forgive me for being a newbie at ARM programming in general. In AVR this was straight forward.

Simple thermistor

I have a circuit connected like this to the ADC (P0.01 = AnalogInput2) .

I read sensible values from the thermistor if I have this ADC setup:

NRF_ADC->INTENSET = ADC_INTENSET_END_Msk;
sd_nvic_SetPriority(ADC_IRQn, NRF_APP_PRIORITY_LOW);
sd_nvic_EnableIRQ(ADC_IRQn);

NRF_ADC->CONFIG = (ADC_CONFIG_EXTREFSEL_None << ADC_CONFIG_EXTREFSEL_Pos)
	| (ADC_CONFIG_PSEL_AnalogInput2 << ADC_CONFIG_PSEL_Pos)
	| (ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling << ADC_CONFIG_REFSEL_Pos)
	| (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling <<  ADC_CONFIG_INPSEL_Pos)
	| (ADC_CONFIG_RES_10bit << ADC_CONFIG_RES_Pos);
																				
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled;

Could someone explain me why this just works? I thought I had to use "ADC_CONFIG_REFSEL_SupplyOneHalfPrescaling" and "ADC_CONFIG_INPSEL_AnalogInputNoPrescaling", since the divider would be half of the supply since 10kohm resistor and 1kohm thermistor would divide the voltage in half.

Related