Hi all, I'm probably overlooking something simple I missed but I just can't seem to figure it out. I was messing around with a DS18B20 and a 12f683 and copied some simple code to read the DS and display the temperature from it on an LCD screen. So far so good all of that works. I tried to add what I thought was going to be a simpe IF statement to check the temperature and turn an LED on but this is turning out to be difficult for me. What is happening is the temp displays just fine on the LCD but my LED never comes on or at best it blinks on ever so slightly. I've tried a bunch of different combinations hooking the LED up so that low LED will turn it on instead of high LED and different combinations of using a pull up or down depending on what high or low I was trying but nothing seems to work. Below is the program I am using. I am used the U2 programmer from MELABS. If anyone could shed some light on this I would appreciate it. Just to make sure I am using the correct low/high syntax I have my code toggling the LED before I get into the main loop and the LED in fact works like a charm it just breaks when I get into mainloop.
Thanks
David

Include "modedefs.bas" ' Mode definitions for Serout

LCD Var GPIO.1 ' LCD TX pin
DQ VAR GPIO.4 'pin 3 One-wire Data-Pin "DQ"
C VAR BYTE 'Status of I/O port bit
R_Temp VAR WORD 'RAW Temperature readings
C_neg VAR BIT '=1 if cold bit for C set
NEGPOS VAR BYTE 'Sign char "-" or "+"
C_Temp VAR WORD 'Celsius Temperature
F_Temp VAR WORD 'Fahrenheit Temperature
maxT var word
LED CON 2 ' pin 5 for led indicator

ANSEL = 0 ' Set all digital
CMCON0 = 7 ' Analog comparators off
Pause 500 ' Wait .5 second for LCD to init
low led
pause 1000
high led
pause 1000
mainloop:
gosub start_Convert
goto mainloop
Start_Convert:
OWOUT DQ, 1, [$CC,$44] 'Send calculate temperature command
REPEAT
PAUSEUS 25 'Waiting loop until reading complete
OWIN DQ, 4, [C] 'Monitor for pin high transition ...
UNTIL C <> 0 ' ... reading complete
OWOUT DQ, 1, [$CC, $BE] 'Send read scratchpad command
OWIN DQ, 2, [R_Temp.LowByte,R_Temp.HighByte] 'get temperature
IF R_Temp.11 = 1 THEN 'check below zero bit
C_neg=1
NEGPOS = "-"
R_Temp = ~R_Temp + 1
ELSE
NEGPOS = "+"
C_neg=0
ENDIF
C_Temp = R_Temp >> 3 'Get whole # of degrees & first decimal bit
'SEROUT LCD , n2400,[$fe, 1,"C = ",NEGPOS,#C_Temp/2," deg. C",10,13]
F_Temp = C_Temp * 9
F_Temp = F_Temp / 5
F_Temp=F_Temp/2 'remove decimal bit
IF NEGPOS="+" THEN
F_Temp = F_Temp + 32
ENDIF
IF NEGPOS ="-" AND C_Temp <= 36 THEN 'was 18 - caused error!
F_Temp = 32 - F_Temp
NEGPOS = "+"
ENDIF
IF NEGPOS="-" AND C_Temp > 36 THEN 'was 18 - caused error!
F_Temp = F_Temp - 32
ENDIF
SEROUT LCD , n2400,[$fe, 1,"F = ",NEGPOS,#F_Temp," deg.F",10,13]
C_Temp = C_Temp/2
if F_temp =>70 then
low LED
else
high LED
endif
return
end