RoboteQ AX2850 user manual Temperature Conversion C Source Code

Models: AX2850

1 200
Download 200 pages 6.02 Kb
Page 69
Image 69

Temperature Conversion C Source Code

 

300

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

250

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Value

200

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Analog

150

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Reported

100

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

50

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-40

-30

-20

-10

0

10

20

30

40

50

60

70

80

90

100

110

120

130

140

150

 

 

Temperature in Degrees C

FIGURE 39. Analog reading by controller vs. internal heat sink temperature

Temperature Conversion C Source Code

The code below can be used to convert the analog reading into temperature. It is provided for reference only. Interpolation table is for the internal thermistors.

int ValToHSTemp(int AnaValue)

{

// Interpolation table. Analog readings at -40 to 150 oC, in 5o intervals

int TempTable[39] ={248, 246, 243, 240, 235, 230, 224, 217, 208, 199, 188, 177, 165, 153, 140, 128, 116, 104,93, 83, 74, 65, 58, 51, 45, 40, 35, 31, 27, 24, 21, 19, 17, 15, 13, 12, 11, 9, 8};

int LoTemp, HiTemp, lobound, hibound, temp, i;

i = 38;

while (TempTable[i] < AnaValue && i > 0) i--;

if (i < 0) i = 0;

if (i == 38) return 150;

else

{

LoTemp = i * 5 - 40;

HiTemp = LoTemp + 5; lobound = TempTable[i]; hibound = TempTable[i+1];

temp = LoTemp + (5 * ((AnaValue - lobound)*100/ (hibound - lobound)))/100; return temp;

}

}

AX2550 Motor Controller User’s Manual

69

Page 69
Image 69
RoboteQ AX2850 user manual Temperature Conversion C Source Code