#PICAXE 08M #terminal 4800 '===-[ INPUTS ]-========================================================== symbol TempPin = B.2 ' Pin 5 to DS18B20 temperature sensor '===-[ OUTPUTS ]-========================================================== symbol DataPin = B.1 ' Pin 6 To Openlog uSD data recorder symbol LEDPin = B.4 ' Pin 3 To Openlog uSD data recorder '===-[ VARIABLES ]-========================================================== Symbol Temperature= W6 Symbol Char = B11 DO HIGH LEDPin 'Turn on convert LED ReadTemp12 TempPin, Temperature 'Read temperature IF Temperature>=4096 then 'If blow zero temperature Temperature=Temperature ^$ffff+1 'take twos complement to make +ve SerOut DataPin,T2400_4, ("-") 'Send the negative sign ENDIF Char = Temperature/16 'Calc the Integer part of temp SerOut DataPin,T2400_4, (#Char,".") 'Send the integer part Char = Temperature // 16 'calc the decimal part and round off LOOKUP Char,("0112334456678899"),Char 'convert Decimal part to a character SerOut DataPin,T2400_4, (#Char) 'Send the decimal part SerOut DataPin,T2400_4, ("C" ) 'Send Units SerOut DataPin,T2400_4, (CR,LF) 'Send Carriage Return Line Feed LOW LEDPin 'Turn off convert LED FOR B0 = 1 to 15 'WAIT 1 minute NAP 8 '4 seconds low power nap NEXT LOOP END