Energy Meter IC Family Software Instruction Manual

71M652X Software User’s Guide
Revision 1.7 TERIDIAN Proprietary 61 of 138
© Copyright 2005-2007 TERIDIAN Semiconductor Corporation
set_tc1_tc2()
END
fppmc1 = ppmc1 from CE
fppmc2 = ppmc2 from CE
tn = calibration temperature
from CE
tppmc1 = 0;
tppmc2 = 0;
tn==0?
a calibration temperature
exists?
trimbgb = Read_Trim
(_TRIMBGB)
tppmc1 == 0L &&
tppmc2 == 0L
constants are not set?
a = -6680; b = -341000
trimbgb == 0
trimm = Read_Trim
(_TRIMM);
trimbga = Read_Trim
(_TRIMBGA); // -128..127
#ifdef M6511
td = ((tn * 27L) + 64L) / 128L;
th = ((S32)trimbga) * -500;
tj = th - 370000L;
tf = td + tj;
c = (tf + 5L)/9L;
td = ((S32)trimbgb) * 100L;
th = (((S32)trimm) * 100L) + 50L;
tj = ((th * 14L) + 5L)/10L;
d = td - tj;
td = -28L * c;
tf = (td + (330000L + 5L))/10L;
th = ((tf * d) + 5000L)/10000L;
tl = ((33L * c) + 50L)/100L;
tn = tl + 790L;
a = th + tn;
td = -2L * c;
tf = td + 20000L;
th = ((tf * d) + 500L)/1000L;
b = th - 460000L;
Write values to CE:
ppmc1 = tppmc1;
ppmc2 = tppmc2;
Y
tppmc1 = ((22463L * a) +
50000L) /100000L;
tppmc2 = ((1150L * b) +
500000L) /1000000L;
temperature compensation for adc
no temperature
compensation
N
untrimmed?
untrimmed?
read a trim value
d = (bgb /10) - [(m +
0.5)*0.14]
a = (-0.28c+33)d +
0.33c+7.9
b = (-0.0002c+0.02)d-0.46
c = [(temp_nom/2) - (bga *
500) - 370000]/900
c = [(temp_nom/4.74074) -
(bga * 500) - 370000]/900
Figure 5-16: Calibration, continued