Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SAADC changing value range (signed to unsigned)

Hello Nordic Support,

I am using SAADC on nRF52840 with nRF5_SDK_15.3.0_59ac345

I use the following configurations:

{ 
    .resolution         = (nrf_saadc_resolution_t)NRFX_SAADC_CONFIG_RESOLUTION, // 12 bits
    .oversample         = (nrf_saadc_oversample_t)NRFX_SAADC_CONFIG_OVERSAMPLE, // 0
    .interrupt_priority = NRFX_SAADC_CONFIG_IRQ_PRIORITY,                       // 5
    .low_power_mode     = NRFX_SAADC_CONFIG_LP_MODE                             // 0
}


{                                                   
    .resistor_p = NRF_SAADC_RESISTOR_DISABLED,      
    .resistor_n = NRF_SAADC_RESISTOR_DISABLED,      
    .gain       = NRF_SAADC_GAIN1_6,                
    .reference  = NRF_SAADC_REFERENCE_INTERNAL,     
    .acq_time   = NRF_SAADC_ACQTIME_10US,           
    .mode       = NRF_SAADC_MODE_SINGLE_ENDED,      
    .burst      = NRF_SAADC_BURST_DISABLED,         
    .pin_p      = (nrf_saadc_input_t)(NRF_SAADC_INPUT_AIN1),       
    .pin_n      = NRF_SAADC_INPUT_DISABLED          
}

The SAADC value, as I have been using is signed. I wonder if Nordic will later support unsigned value, or you will not? Or are there any ways to convert from signed SAADC to unsigned SAADC?

Thank you and best regards,

           Duy

Parents Reply
  • Duy said:
    In my case, I can only use 11 bits if the output of my device is 0V -> 1.9V. Is it right? 

     I'm not sure I understand you correctly, the result is stored as an 16 bit int. The number of bits you use is dependent on the chosen resolution. All bits will be set to 1's when you've reached the reference/gain. The reference/gain value should be set to the maximum voltage that you would want to measure. 

Children
Related