Thanks for even more great ideas.
Maths is not my strong suit but i am getting a handle on how it works.
I worked for years using an external reference and a 12F683 calculating it's own VDD for my BMS.
What is confusing me is why we have an EXT variable and then this huge formula in assembly. Why?
Preumably because it can't fit into 16 bit integer maths even with DIV32
In assembler on the 12F1822 do we have 32 bit maths?
Code:
Vref_AD5 CON EXT ; Calculate FVref A/D reading when VDD = VDD_Nom
@Vref_AD5 = (_FVrefMV*100000) / (VDD_Nom*1000000/(1023 << (_VDD_Res-10)))
I appreciate the accuracy will vary over the VDD range i'm more interested in how it changes with temperature for now.
I suppose I could calculate the vref for each chip at various temps from 0-40C at 5C intervals then use a lookup table to pick the right one to use based on the chips own internal temp reading taken just prior to reading the VDD.
All good stuff. I'm going to be doing some bench testing very shortly to see how it works in practise.
I'm very disapointed you won't let me use my $5 multimeter with dying battery to calibrate my whole system 
If you had a very accurate calibrated computer controlled psu you could do calibration at any voltage you wanted. But as you say the VDD is already in the maths so why not just calibrate at a nominal 5v and at 3V using a lithium button cell or something as the supply. Then work out the relationship or slope changes between them both.
In practical terms my program might need to do a few things.
1) Have a 3.3v calculated constant vref in eprom. (I'll probably use 3.3v based constant as that's where the cells spend most of the time)
2) Get it's own temp prior to measuring it's own VDD and compensate according to prev temp variation data points.
3) Measure it's own VDD using the 3.3V constant. V = 1.039 or whatever
4) Use the measured VDD to load a new constant value if reqd due to change in VDD. Say cell is at 3.65V in this example
5) Finally use the new constant to read it's own vref again to have a final value VDD
I will be happy with ACTUAL in use accuracy to within +/- 25mv as that's about what I manage at present.
Bookmarks