08m code optimising

kevrus

New Member
Just playing around with a bit of code for an 08m, 2 x ds18b20 and a 2x 16 lcd display.
My code is 26 bytes too long and I can't seem to reduce it any more, any suggestions would be appreciated.
(I am a bit dense when it comes to writing code..still learning!)

start:
pause 200
serout 0,t2400,(254,1,12)
serout 0,t2400,(254,128," PC TEMPERATURE ",254,192," MONITOR " )
pause 9000

main:
readtemp12 1,w0
gosub temp_calc
serout 0,t2400,(254,128,"CPU temp = ",#b0,".",#b1,"C")
if b0 >= 55 then goto overtemp
pause 250
readtemp12 2,w0
gosub temp_calc
serout 0,t2400,(254,192,"int temp = ",#b0,".",#b1, "C")
pause 8000
serout 0,t2400,(254,128," UPDATING ",254,192," READINGS ")
pause 2000
goto main

temp_calc:
w1=w0*10
w2=w1/16
b0=w2/10
b1=w2//10
return


overtemp:
serout 0,t2400,(254,192," OVERTEMP!! ")
high 4
pause 500
low 4
pause 500
goto main
 

kevrus

New Member
many thanks Michael,
sometimes the obvious escapes me. Ive changed the "UPDATING READINGS"on two lines to "UPDATING TEMP" on one line after clearing the screen and i'm now down to 254 bytes.
 
Top