Hi,
I want to get Battery ADC Value.
So. I simply used nrf_drv_saadc_sample_convert() function.
At first I thought it was the right value,
Later, I found that the wrong value was coming out.
If you supply 1.5v, the value should be over 400, but less than 100.
CODE:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// ADC setting
void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
{
//ret_code_t err_code;
//err_code = nrf_drv_saadc_sample_convert(0, &m_battery);
//APP_ERROR_CHECK(err_code);
}
static void bat_timeout_handler(void * p_context)
{
UNUSED_PARAMETER(p_context);
ret_code_t err_code;
// get ADV value
err_code = nrf_drv_saadc_sample_convert(0, &m_battery);
APP_ERROR_CHECK(err_code);
// (%)percent change formula
uint8_t percent = ((m_battery-MIN_ADC)/DIF_ADC)*100;
if(percent >= 100)
{
percent = 100;
Let me know what's wrong.
Thank you.
(softdevice Ver : 6.1.1, SDK Ver : 15.2.0, Testboard : nRF52-DK)