Thank you. What's funny is that I was actually looking at it and then got thrown off by the comment talking about "typical" and "datasheet". Could you elaborate on why you both have 2495mV as a default value there? I know that some (older?) vrefs are set to that instead of 2500mV, but we are all talking about precision references @2.5V here, and yet the software expects 2.495V by default?
Excuse for volume presentation, I hope that the theory will be clear!
In the program by default reference voltage for ADC 5v (external voltage on AVCC).
In case of detection on input analog-to-digitial converter(ADC) less 1v the reference switches to internal reference supply source 1.1v.
Affect on internal reference 1.1v we can't (only if to select the processor with its minimum low value).
External reference 5v on AVCC (accuracy) depends on us!
The source of sample voltage as reference supply source for ADC in this program doesn't work at PC4, and serves for correction of value of the reference voltage 5v the result of operation of ADC accepted in case of calculation. In firmwares of both authors correction is carried out on a formula:
V5_calc=v5_avcc*v25Uref_pasport/V_izm_ADC PC4, where:
- V5_calc - calculated value of reference voltage 5v the result of operation of ADC accepted in case of calculation.
- V5_avcc - value of voltage 5v on AVCC (the constant changed by the user)
- V25Uref_pasport - passport value of voltage of the REF (the constant changed by the user at Markus Reschke, at Karl-Heinz Kübbeler - in a code)
- V_izm_ADC PC4 - (real) voltage measured by ADC on PC4
where the constants V25Uref_pasport and V5_avcc are (in mV)?
At Markus Reschke in the config.h file:
#define UREF_VCC 5001
#define UREF_25 2495
At Karl-Heinz Kübbeler in the config.h files
#define U_VCC 5000
and Calibrate_UR.c (value 2495)
ADCconfig.U_AVCC = (unsigned long) (ADCconfig.U_AVCC (unsigned long) * 2495) / mv2500;
Now, taking into account constants the formula assumes an air: V5_calc=5000*2495/V_izm_ADC PC4.
From a formula it is visible that 2495/V_izm_ADC PC4 coefficient of correction of an error of operation of ADC and in case of =2495 it is equal 1.0, according to V5_calc=5000*1=5000!
If it is very simple, that, then when the REF on 2495mV and real voltage will be connected to PC4 on AVCC will be 5000mV!
PRACTICAL RECOMMENDATIONS!
- to select AVCC and REF for parameters the close to AVCC=5000mV and URef=2495mv or in case of assembly of a firmware to enter the real
values of voltage of AVCC and URef.
- in case of less exact AVCC to use more exact REF, otherwise it is no need also an ear REF, otherwise it is no need and will worsen result!
Good results with MCP1702-5002 with specification of V5_avcc without REF.