No, but you can simulate it at the transmitter end with a loop instead of reading the temp sensor....duh!!!
Just set up the transmitter to send out a slowly changing temperature that goes up the scale, resets to the low end, climbs back up again, whatever works for you.
Or do it at the receiver end, put a couple of buttons in there, one button-temp goes up, another button-temp goes down.
ok , I get that now,
I want to concentrate on the cold but not that cold part for now.. the sensor is sticking outsid now, its about -11C
I wanted to see what was behing calculated..
The 2's compliment, the binary value gives me a good degree (tempc)
when I put it in the equation it then screws up, I think the 2 byte count_per_c AND count_remain and different since it is in negative mode... hummm
Nothing is siad about this in the specsheet either, and the program on Rentron does not use that part.
here is the code:
Zerotemp: '------------- cases when zero celcius and positive Fahrenheit
temp1 = temperature
temperature = ( ~ temperature ) + 1 '----- do this later, right before displaying it
tempc =temperature
temperature = ((( temperature ) *100)- 25) + (((count_per_c - count_remain) * 100) / count_per_c)
tempF = ((temperature /5) * 9) + 3200
if tempF <= 0 then goto ZeroF
lcdout $FE,1, dec temp1 , ".", dec temperature ," ",$DF,"C"
lcdout $FE,$C0, dec temperature, dec tempc , ".", dec tempc/2 ," ",$DF,"F"
temperature," ",$DF,"C"
goto loop
putting the 2,s compliment just befire works best:
but the temperature seems to cut in half,, showing -5C when it is -10C
Just getting +655 when I get to zero degrees.
loop:
'23
waitfor55:
serin portb.2 , n2400 , temp : if temp <> $55 then goto waitfor55
waitforaa:
serin portb.2 , n2400 , temp : if temp <> $aa then goto waitforaa
serin portb.2, n2400, encoded11.HighBYTE : serin portb.2, n2400, encoded11.LowBYTE
serin portb.2, n2400, encoded22.HighBYTE : serin portb.2, n2400, encoded22.LowBYTE
serin portb.2, n2400, encoded33.HighBYTE : serin portb.2, n2400, encoded33.LowBYTE
serin portb.2, n2400, encoded44.HighBYTE : serin portb.2, n2400, encoded44.LowBYTE
For counter=0 TO 7 'decoding
encoded1.0[counter]=encoded11.0[counter*2] : encoded2.0[counter]=encoded22.0[counter*2]
encoded3.0[counter]=encoded33.0[counter*2] : encoded4.0[counter]=encoded44.0[counter*2]
Next counter
'41
temperature= encoded1 ' putting back together as the original temperature
For counter=0 TO 7
temperature.0[counter+8]=encoded2.0[counter+8]
Next counter
temperature.LowBYTE = encoded1
temperature.HighBYTE = encoded2
count_remain = encoded3
count_per_c = encoded4
IF temperature.11 = 1 Then goto Zerotemp
temperature = ((( temperature >> 1) *100)- 25) + (((count_per_c - count_remain) * 100) / count_per_c)
tempF = (((temperature /5) *9 ) + 3200)
lcdout $FE,1, "TempC: ", "+", dec (temperature / 100) , ".", dec2 temperature," ",$DF,"C"
lcdout $FE,$C0, "TempF: ", "+", dec2 (tempF / 100) , ".", dec2 (tempF // 100)," ",$DF,"F"
goto loop
Zerotemp: '------------- cases when zero celcius and positive Fahrenheit
temp1 = temperature
temperature = ((( temperature >>1 ) *100)- 25) + (((count_per_c - count_remain) * 100) / count_per_c)
if tempF <= 0 then goto ZeroF
temperature = ( ~ temperature ) + 1 ': tempf = ( ~ tempF ) + 1 ' added this
tempF = 3200 - ((temperature /5) * 9)
lcdout $FE,1, "TempC: ", "-", dec (temperature / 100) , ".", dec2 temperature," ",$DF,"C"
lcdout $FE,$C0, "TempF: ", dec (tempF / 100) , ".", dec2 tempF ," ",$DF,"F"
goto loop
ZeroF: '---------------- cases when zero celcius and 0 Fahrenheit
tempF = 3200 - ((temperature /5) * 9)
lcdout $FE,1, "TempC: ", "-", dec (temperature / 100) , ".", dec2 temperature," ",$DF,"C"
lcdout $FE,$C0, "TempF: ", "-", dec (tempF / 100) , ".", dec2 tempF ," ",$DF,"F"
goto loop
end
Last edited by lerameur; - 30th December 2006 at 01:57.
simple I need to take the difference. I believe pic basic pro can only handle unsigned numbers. So but keeking the original forula we get negative number for zero temperature. So by putting the 3200 in front , we get a positive number and add a minus sign.
for -15 degrees celcius
we have 15*100 =1500 in the euqation
=3200 - (1500/5*9) = 500
= 500/100 ------divide by hundred caus ewe multiplied by a 100 initially
=5
= -5 ----- here we just add the minus
but anyway , remember when i said my decimal values was going reverse. I was thinking and that is similar from doing 2,s compliment . so i decided to do 2,s compliment on everything..
Zerotemp: '------------- cases when zero celcius and positive Fahrenheit
temperature = ( ~ temperature ) + 1
count_per_c = ( ~ count_per_c) + 1
count_remain= ( ~count_remain) + 1
temp1 = temperature
temperature = ((( temperature >>1 ) *100)- 25) + (((count_per_c - count_remain) * 100) / count_per_c)
if tempF <= 0 then goto ZeroF
': tempf = ( ~ tempF ) + 1 ' added this
tempF = (((temperature /5) *9 ) + 3200)
lcdout $FE,1, "TempC: ", "-", dec (temperature / 100) , ".", dec2 temperature," ",$DF,"C"
lcdout $FE,$C0, "TempF: ", dec (tempF / 100) , ".", dec2 tempF ," ",$DF,"F"
goto loop
ZeroF: '---------------- cases when zero celcius and 0 Fahrenheit
tempF = 3200 - ((temperature /5) * 9)
lcdout $FE,1, "TempC: ", "-", dec (temperature / 100) , ".", dec2 temperature," ",$DF,"C"
lcdout $FE,$C0, "TempF: ", "-", dec (tempF / 100) , ".", dec2 tempF ," ",$DF,"F"
goto loop
end
Last edited by lerameur; - 30th December 2006 at 18:35.
Bookmarks