Hi Robert

There are many ways including just measuring the voltage, subtracting 500mV and then converting Celsius to Fahrenheit by multiplying by 9/5 and adding 32. There is a more direct way.

The sensor is specified from -40C to 125C and it is linear. With a bit of arithmetic it is easy to find that at -40 the readout measurement on the 10-bit ADC with a 3300mV reference will be 31 and 125 it will be (ideally) 542.5. Since the ADC does not measure fractions of a bit lets round that to 543. At -40C the temperature is also -40F and at 125C the temperature is 257 Fahrenheit.

Now we have the four points needed to use the MAP function described in the user manual on p37.

- Code: Select all
`'MCP9700 in Fahrenheit`

'MCP0700 connected to pin 10 of the EzSBC1

PINMODE 10,ADC 'Use pin 10 as ADC input

tempX= INADC( 10 )

TempF = MAP( tempX, 31, 543, -40, 257)

'Multiply by ten, truncate the decimals and divide by 10 to get one decimal

TempF = ( INT (TempF*10) )/10.0

PRINT TempF

END

Daniel