An ADC (ADS1015 with n=12 bit resolution) is connected to 5V DC power supply. So its V_ref=5V.
However, if I set gain=16, then full-scale-range = +/-0.256V i.e peak to peak voltage= V_pp=2*0.256=0.512V (as given in data sheet Pg 10, Table 3: Reference https://cdn-shop.adafruit.com/datasheets/ads1015.pdf )
In such a scenario, which formula out of the two mentioned below should be used to convert raw data from ADC into equivalent voltage:
(1) V_in = (Raw data from ADC) * (V_ref/2^n) = (Raw data from ADC) * (5/4096)
(2) V_in = (Raw data from ADC) * (V_pp/2^n) = (Raw data from ADC) * (0.512/4096)
Also, in the above two formula, where do we substitute "gain=16" factor?
If somebody could please explain this I would be very much appreciative.