static void adc_init(void)
{
/* Enable interrupt on ADC sample ready event*/
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_Disabled << ADC_CONFIG_PSEL_Pos)
| (ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling << ADC_CONFIG_REFSEL_Pos)
| (ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling << ADC_CONFIG_INPSEL_Pos)
| (ADC_CONFIG_RES_8bit << ADC_CONFIG_RES_Pos);
/* Enable ADC*/
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled;
}
void ADC_IRQHandler(void)
{
uint8_t adc_result;
NRF_ADC->EVENTS_END = 0;
ADC_Value = (NRF_ADC->RESULT)/255*100;
NRF_ADC->TASKS_STOP = 1;
sd_clock_hfclk_release();
}
The result of this source is always 100.
The amount of the battery is falling but 100.
What is the problem?
I have connected the battery to the VTG and GND.
What part did wrong?