SBOU024C august 2004 – july 2023 PGA309
The resolution for the Temp ADC in Internal Temperature Mode is 0.0625°C/count.
For positive temperatures (for example, 20°C):
(20°C)/(0.0625°C/count) = 320 → 140h → 0001 0100 0000
Twos Complement is not performed on positive numbers. Simply convert the number to binary code with 16-bit, right-justified format, and MSB = ‘0’ to denote a positive sign. Extend the sign to the upper 4 bits.
20°C will be read by the Temp ADC as 0000 0001 0100 0000 → 140h
For negative temperatures (that is, −20°C):
(|−20|)/(0.0625°C/count) = 320 → 140h → 0001 0100 0000
Generate the Twos Complement of a negative number by complementing the absolute value binary number and adding 1. Extend the sign, denoting a negative number by MSB = ‘1’. Extend the sign to the upper 4 bits to form the 16-bit word.
−20°C will be read by the Temp ADC as 1111 1110 1100 0000 → FEC0h.
Step 2:
Calculate Gain DAC temperature coefficients using Table 3-3.
For the Gain DAC desired counts (that is, G3 = 0.4):
Gx = (GainDESIRED − 1/3)(3/2)(65536)
G3 = (0.4 − 1/3)〈3/2)(65536) = 6553.6
0 ≤ Gx ≤ 65535
0.3333333 ≤ Gain DAC ≤
0.9999898
For positive slopes (that is, GM5):
GM5 = [(G5 − G4)/(T5 − T4)][256]
GM5 = [(26214 − 7537)/(160 − 0)][256] = 29883.2
Integer [29883.2] = 29883
GM5 =29883 →
74BBh → 0111 0100 1101 1101
The allowed range for GM is: -32768 ≤ GM ≤ +32767 (16 bit signed integer)
For negative slopes (that is, GM2):
GM2 = [(G2 − G1)/(T2 − T1)][256]
GM2 = [(36044.8 − 55706)/(−320 − {−480})][256] = −31457.28
Integer [−31457.9] = −31457
Generate the Twos Complement of −31458:
GM2 = 851Eh → 1000 0101 0001 1110
The allowed range for GM is: -32768 ≤ GM ≤ +32767 (16 bit signed integer)
If the Gain DAC slope computes to a count > 65535, there is a problem. The Temp ADC must be reconfigured for lower resolution or the number of points in the Lookup Table must be increased to bring the slopes within the PGA309 computation region.
Temp (°C) |
Temp Index | Temp ADC (Counts) |
Gain DAC Desired Value | Gain DAC Desired Index | Gain DAC Desired (Counts) |
Gain DAC Slope | Gain DAC Slope Formula | Gain DAC Slope(1) (Counts) |
Gain DAC Slope (Hex) |
---|---|---|---|---|---|---|---|---|---|
−40 | T0 | −640 | 1 | G0 | 65535 | G0 | G0 = G0 | 65535 | FFFF |
−30 | T1 | −480 | 0.9 | G1 |
55706 |
GM1 | GM1 = [(G1 − G0)/T1 − T0)][256] |
-15726 |
C292 |
−20 | T2 | −320 | 0.7 | G2 |
36045 |
GM2 | GM2 = [(G2 − G1)/T2 − T1)][256] |
-31458 |
851E |
−10 | T3 | −160 | 0.55 | G3 |
21299 |
GM3 | GM3 = [(G3 − G2)/T3 − T2)][256] |
-23594 |
A3D6 |
0 | T4 | 0 | 0.41 | G4 |
7537 |
GM4 | GM4 = [(G4 − G3)/T4 − T3)][256] |
-22019 |
A9FD |
10 | T5 | 160 | 0.6 | G5 |
26214 |
GM5 | GM5 = [(G5 − G4)/T5 − T4)][256] |
29883 |
74BB |
20 | T6 | 320 | 0.4756 | G6 |
13985 |
GM6 | GM6 = [(G6 − G5)/T6 − T5)][256] |
-19566 |
B392 |
30 | T7 | 480 | 0.6543 | G7 |
31552 |
GM7 | GM7 = [(G7 − G6)/T7 − T6)][256] |
28107 |
6DCB |
Step 3:
Calculate Zero DAC temperature Coefficients using Table 3-4.
For the Zero DAC desired counts (for example, Z5 = 1.5):
Zx = (VZDESIRED/VREF)(65536)
Z5 = (1.5/5)(65536) = 19660.8
0 ≤ Zx ≤ 65535
0.1V ≤ Zero DAC Analog Range
≤ (VSA − 0.1V)
0V ≤ Zero DAC Programming Range ≤ VREF
For positive slopes (for example, ZM4):
ZM4 = [(Z4 − Z3)/(T4 − T3)][256]
ZM4 = [(26214.4 − 13107.2)/(0 − {−160})][256] = 20971.52
Integer [20971.52] = 20972
ZM4 =
20972 → 51ECh → 0101 0001 1110 1101
The allowed range for ZM is: -32768 ≤ ZM ≤ +32767 (16 bit signed integer)
For negative slopes (for example, ZM6):
ZM6 = [(Z6 − Z5)/(T6 − T5)][256]
ZM6 = [(13107.2 − 19660.8)/(320 − 160)][256] = −10485.76
Integer [−10485.76] = −10486
Generate the Twos Complement of −10486:
ZM6 = D70Ah → 1101 0111 0000 1010
The allowed range for ZM is: -32768 ≤ ZM ≤ +32767 (16 bit signed integer)
If the Zero DAC slope computes to a count outside the range -32768 < ZM < +32767, there is a problem. The Temp ADC must be reconfigured for lower resolution or the number of points in the Lookup Table must be increased to bring the slopes within the PGA309 computation region.
Temp (°C) |
Temp Index |
Temp ADC (Counts) |
Zero DAC Desired Value | Zero DAC Desired Index | Zero DAC Desired (Counts) |
Zero DAC Slope | Zero DAC Slope Formula | Zero DAC Slope(1) (Counts) |
Zero DAC Slope (Hex) |
---|---|---|---|---|---|---|---|---|---|
−40 | T0 | −640 | 0.1 | Z0 | 1310.7 | Z0 | Z0 = Z0 | 1311 | 051E |
−30 | T1 | −480 | 0.2 | Z1 | 2621.4 | ZM1 | ZM1 = [(Z1 − Z0)/T1 − T0)][256] | 2097 | 0831 |
−20 | T2 | −320 | 1 | Z2 | 13107.2 | ZM2 | ZM2 = [(Z2 − Z1)/T2 − T1)][256] | 16777 | 4189 |
−10 | T3 | −160 | 1 | Z3 | 13107.2 | ZM3 | ZM3 = [(Z3 − Z2)/T3 − T2)][256] | 0 | 0000 |
0 | T4 | 0 | 2 | Z4 | 26214.4 | ZM4 | ZM4 = [(Z4 − Z3)/T4 − T3)][256] | 20972 | 51EC |
10 | T5 | 160 | 1.5 | Z5 | 19660.8 | ZM5 | ZM5 = [(Z5 − Z4)/T5 − T4)][256] | −10486 |
D70A |
20 | T6 | 320 | 1 | Z6 | 13107.2 | ZM6 | ZM6 = [(Z6 − Z5)/T6 − T5)][256] | −10486 |
D70A |
30 | T7 | 480 | 2 | Z7 | 26214.4 | ZM7 | ZM7 = [(Z7 − Z6)/T7 − T6)][256] | 20972 | 51EC |
Step 4:
Assemble the Lookup Table, as shown in Table 3-5.
Temp (°C) |
Temp Index |
Zero DAC Slope |
Gain DAC Slope |
EEPROM Tx (Hex) |
EEPROM ZMi (Hex) |
EEPROM GMi (Hex) |
---|---|---|---|---|---|---|
−40 | T0 | Z0 | G0 | FD80 | 051E | FFFF |
−30 | T1 | ZM1 | GM1 | FE20 | 0831 | C292 |
−20 | T2 | ZM2 | GM2 | FEC0 | 4189 | 851E |
−10 | T3 | ZM3 | GM3 | FF60 | 0000 | A3D6 |
0 | T4 | ZM4 | GM4 | 0000 | 51EC | A9FD |
10 | T5 | ZM5 | GM5 | 00A0 | D70A | 74BB |
20 | T6 | ZM6 | GM6 | 0140 | D70A | B392 |
30 | T7 | ZM7 | GM7 | 01E0 | 51EC | 6DCB |
— | TEND | ZMEND | GMEND | 7FFF | 0000 | B5D8 |
Use the calculated values from Step 2 and Step 3.
Set TMEND to 7FFFh to indicate the end of the Lookup Table.
Set ZMEND to 0000h.
Calculate GMEND as Checksum2 (truncate results above 16-bit):
GMEND = Checksum2 = FFFFh − sum(Hex values of all entries in the Lookup Table except GMEND)
GMEND = FFFFh − C49DDh
GMEND = FFFFF4B622h
GMEND = Checksum2 = B622h
Step 5:
Calculate Ideal value for Gain DAC at TREAD = +25°C using Table 3-6.
Tx | Temp (°C) | Gx | Gain DAC |
---|---|---|---|
T0 | −40 | G0 | 1 |
T1 | −30 | G1 | 0.9 |
T2 | −20 | G2 | 0.7 |
T3 | −10 | G3 | 0.4 |
T4 | 0 | G4 | 0.3333 |
T5 | 10 | G5 | 0.6 |
T6 | 20 | G6 | 0.4756 |
TREAD | 25 | GREAD | Calculated |
T7 | 30 | G7 | 0.6543 |
Linear Interpolation for Gain DAC (TREAD = 25°C):
GREAD = {[(G7 − G6)/(T7 − T6)] [TREAD − T6]} + G6
GREAD = {[(0.6543 − 0.4756)/(30 − 20)] [25 − 20]} +0.4756
GREAD = 0.56495
Step 6:
Reference calculation algorithm for Gain DAC using Lookup Table.
Table 3-7 outlines the calculation algorithm used inside the PGA309 for linear interpolation and calculation of the Gain DAC setting for TREAD = 25°C. From Table 3-3 the computations for GM1-GM7 at T1-T7, for given values at G1-G7, are known. In addition, the starting values (T0 and G0) were defined. Step 5 shows the Actual Gain DAC value for TREAD = 25°C should be 0.56495 V/V if the linear interpolation part of the calculation algorithm is working properly.
Temp (°C) |
Tx | Temp ADC (Counts) |
GMi | Gain DAC Slope(1) (Counts) |
GAC Calculation | Running GAC Value(1) (Counts) |
Actual Gain DAC (V/V) |
---|---|---|---|---|---|---|---|
−40 | T0 | −640 | G0 | 65535 | GAC0 = G0 | 65535 | 0.9999898 |
−30 | T1 | −480 | GM1 | −15727 | GAC1 = GAC0 + [GM1(T1 − T0)/256] | 55706 | 0.9000041 |
−20 | T2 | −320 | GM2 | −31457 | GAC2 = GAC1 + [GM2(T2 − T1)/256] | 36045 | 0.7000020 |
−10 | T3 | −160 | GM3 | −47104 | GAC3 = GAC2 + [GM3(T3 − T2)/256] | 6605 | 0.4005229 |
0 | T4 | 0 | GM4 | −10496 | GAC4 = GAC3 + [GM4(T4 − T3)/256] | 45 | 0.3337911 |
10 | T5 | 160 | GM5 | 41943 | GAC5 = GAC4 + [GM5(T5 − T4)/256] | 26259 | 0.6004537 |
20 | T6 | 320 | GM6 | −19566 | GAC6 = GAC5 + [GM6(T6 − T5)/256] | 14030 | 0.4760539 |
30 | T7 | 480 | GM7 | 28107 | T7 > TREAD → YES! | — | — |
25 | TREAD | 400 | — | — | GAC_TREAD = GAC6 + [GM7(TREAD − T6)/256] | 22813 | 0.565399169 |
— | TEND | 32767 (7FFFh) | — | — | The Lookup Table is read to the end to verify Checksum2 | — | — |
Each time the Temp ADC does a conversion, it reads the entire external EEPROM. The first part of the EEPROM is dedicated to fixed setup parameters for the PGA309 that do not change with temperature. As the PGA309 reads the second half of the EEPROM, it begins a running calculation of the Gain DAC setting with temperature (the PGA309 runs a similar calculation for the Zero DAC setting). The model in Table 3-7 includes an accumulator named GAC (G Accumulator). When the PGA309 reads T0, the initial Gain DAC setting (G0) is stored in GAC0 (GAC at T0READ). Next, T1 is read and slope GM1 is multiplied by the difference between T1 and T0 (a scale divisor of 256 is used to convert back to decimal counts for our model) and added to GAC0 to form the new accumulator value, GAC1 (GAC at T1READ). This process continues in a sequential fashion as the PGA309 reads through the entire Lookup Table. As each temperature index value (Tx) is read, it is compared against TREAD, the current Temp ADC conversion result. If Tx > TREAD, it is known that TREAD is between Tx and T(x − 1). In this example, it occurs after T7 is read. The accumulator contents, GAC6 (GAC at T6), are modified by the addition of (TREAD − T6)(GM7). The resulting GAC_TREAD is the linearly interpolated setting for the Gain DAC at TREAD = 25°C. The actual Gain DAC value is slightly different than the theoretical value calculated in Step 5 due to Gain DAC resolution and computation rounding. The rest of the EEPROM is read through TEND for error checking with Checksum2 at the end of the Lookup Table. If Checksum2 is valid then the Gain DAC is updated with the computed value GAC_TREAD = 0.565399169.
GAC Calculation (for example, GAC2):
GAC1 = 55706; GM2 = −31457; T2 = −320; T1 = −480
GAC2 = GAC1 + [GM2(T2 − T1)/256]
GAC2 = 55706 + [−31457(−320−{−480})/256] = 36045.375
Integer [GAC2] = Integer [36045.375] = 36045
GAC2 = 36045
Actual Gain DAC (for example, GAC2):
GAC2 = 36045
Gain DAC = [(GACx/65536)(2/3)] + 1/3
Gain DAC = [(36045 / 65536)(2/3)] + 1/3 = 0.7000020
Gain DAC at GAC2 =
0.7000020