Tex4u

01-21-2007, 08:38 AM

I have a question about the conversion of the·data from the LTC1298.· I am monitoring a LM335 for temperature and have it tied to Pin 2 (channel 0) of the LTC1298.· (pin 3, channel 1, of the LTC1298·is monitoring light level with a photo resistor.)· So I am running in dual channel mode.· When I run a modified version of the code in this document: http://www.parallax.com/dl/docs/prod/appkit/ltc1298.pdf (http://www.parallax.com/dl/docs/prod/appkit/ltc1298.pdf)·

·

I get the number 2425 for·18C and 65F approximately.·

I have been working the math and I can convert the number 2425 to 20.9c easy enough with a calculator.· The question comes when I ask the BS2 to do the math.· I came up with a conversion numbers for converting the AD output to temperature.· For C·= ad/116 and F = ad/35.· I also want to display the temperatures as 20.9C and 69.2F

O.k. My question.· Someone·tell me there is an easier way to do this kind of math.· This was a simple problem and I had to jump through some hoops to keep the numbers above zero, to the left of the decimal point and below 65535.

Here is the code I came up with.

...

Again:

· For· oddSign = 0 to 1

· Gosub Convert

· Debug CRSRXY, 0, 0, "Temp "

· Debug CRSRXY, 0, 1, "Light"

· Debug CRSRXY, 6, 0 + oddSign, "- ", DEC AD, CR

· IF oddSign = 1 then goto ch1

· Tempc = (ad / 4) * 10 / 29

· Debug CRSRXY, 18, 0, "C : ", DEC Tempc / 10, ".", DEC1 Tempc

· Tempf = (ad * 10) / 5 * 10 / 8 * 10 / 88

· Debug CRSRXY, 31, 0, "F : ", DEC Tempf / 10, ".", DEC1 Tempf

· IF ad > .....··

· Several more "IF ad" statements related to temperature values.

··...

· Pause 100

Ch1:

Next

Pause 800

Goto Again

Any help you can give would be greatly appreciated.

Thanks,

Tex

·

I get the number 2425 for·18C and 65F approximately.·

I have been working the math and I can convert the number 2425 to 20.9c easy enough with a calculator.· The question comes when I ask the BS2 to do the math.· I came up with a conversion numbers for converting the AD output to temperature.· For C·= ad/116 and F = ad/35.· I also want to display the temperatures as 20.9C and 69.2F

O.k. My question.· Someone·tell me there is an easier way to do this kind of math.· This was a simple problem and I had to jump through some hoops to keep the numbers above zero, to the left of the decimal point and below 65535.

Here is the code I came up with.

...

Again:

· For· oddSign = 0 to 1

· Gosub Convert

· Debug CRSRXY, 0, 0, "Temp "

· Debug CRSRXY, 0, 1, "Light"

· Debug CRSRXY, 6, 0 + oddSign, "- ", DEC AD, CR

· IF oddSign = 1 then goto ch1

· Tempc = (ad / 4) * 10 / 29

· Debug CRSRXY, 18, 0, "C : ", DEC Tempc / 10, ".", DEC1 Tempc

· Tempf = (ad * 10) / 5 * 10 / 8 * 10 / 88

· Debug CRSRXY, 31, 0, "F : ", DEC Tempf / 10, ".", DEC1 Tempf

· IF ad > .....··

· Several more "IF ad" statements related to temperature values.

··...

· Pause 100

Ch1:

Next

Pause 800

Goto Again

Any help you can give would be greatly appreciated.

Thanks,

Tex