RoboteQ AX500 manual Temperature Conversion C Source Code

Models: AX500

1 154
Download 154 pages 41.77 Kb
Page 60
Image 60

Connecting Sensors and Actuators to Input/Outputs

using the ?m query, or during data logging (see “Analog and R/C Modes Data Logging String Format” on page 126)

The analog value that is reported will range from 0 (warmest) to 255 (coldest). Because of the non-linear characteristics of NTC thermistors, the conversion from measured value to temperature must be done using the correction curve below.

It should be noted that the temperature is measured inside the controller and that it may be temporarily be different than the temperature measured outside the case.

 

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 34. 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;

60

AX500 Motor Controller User’s Manual

Version 1.9b. June 1, 2007

Page 60
Image 60
RoboteQ AX500 manual Temperature Conversion C Source Code