Hi Henrik,

my PBP is 2,60C and the code is:

Code:
TMPaddr  CON %1001110  ' the address to TMP100
LCDaddr  con $20       ' the address to LCD 
cont     con $A0       ' for I2C READ and WRITE, NOT for any other use
TRUE     con 1         ' or HIGH
FAlSE    con 0         ' or LO 
                       'LCD 
firstL   con $80       ' LCD first (1) line  (page 107 PICBASIC PRO book)
secondL  con $C0       ' LCD second (2) line
thirdL   con $94       ' LCD third (3) line
fouthL   con $D4       ' LCD fourth (4) line
home     con $02       ' LCD return home
clearD   con $01       ' LCD clear display 
offC     con $0C       ' LCD cursor off
                       'PORTA.x
dataPort var PORTA.0   ' I2C data port
clkPort  var PORTA.1   ' I2C clock port
RELE     var PORTA.2   ' OUT- RELE, or TIP120 (darlington) that drives the rele
LEDs     VAR PORTA.3   ' OUT- Lo (GREEN) Hi (RED)
goDOWN   var PORTA.4   ' IN- or SET DOWN one step (target)
goUP     var PORTA.5   ' IN- SET the temperature UP (target)
                       'TEMP and TIME
changeTEMP var byte    ' how much TEMPERATURE (TARGET)
changeTIME var byte    ' how much TIME (TARGET) 
changeTEorTI   var bit ' is there a need to change TIME or TEMPERATURE (TARGET)
nowTEMPERATURE var byte' update TEMPERATURE only NOT TIME 
nowTIME   var byte     ' ready to change TIME not TEMPERATURE
tempREAD  var byte     ' the real water temperature
tempSET   Var byte     ' the temperature goal or set temperature
                       'FALSE is the active state for the nexts command flags:
markUP    var bit      ' temporary mark remembers wich one is active
markDOWN  var bit      ' temporary mark
b         var byte     ' general index
temp      var byte     ' temperary variable
                       'Next LCD stuff, here under, 4 lines
tempData  var word     ' Temperature data
timeData  var word     ' Time data 
hour      var byte
minut     var byte
second    Var byte    ' Define display hour variable
minute    Var byte    ' Define minute variable
ticks     Var byte    ' Define pieces of seconds variable
update    Var byte    ' Define variable to indicate update of LCD

'12345678901234567890'    LCD has 20 places for characters
INTCON = $a0     ' Enable TMR0 interrupts
'-------------------------------------------------------------------------------
writeLCD         ' general write to LCD
  i2cwrite dataPort, clkPort, cont, $FE, secondL, tempdata' the real temperature
  i2cwrite dataPort, clkPort, cont, $FE, thirdl,  timedata' write the real time 
return ' writeLCD 
'-------------------------------------------------------------------------------
 writeFirstLineLCD           ' when the user has changed from TEMP to TIME or vs
   if nowTIME = true then    ' first line tells wich will change TEMP or TIME
     i2cwrite dataPort, clkPort, cont, $FE, firstl, "       Time         "
   else' nowTEMPERATURE
     i2cwrite dataPort, clkPort, cont, $FE, firstl, "    Temperature     "
   endif
 return  ' writeFirstLineLCD 
'-------------------------------------------------------------------------------
'======================end=LCD==================================================

Debounce
   For b = 1 To 100     ' Debounce and delay for 100ms
     Pause 1 ' 1ms at a time so no interrupts are lost
   Next b
return
'-------------------------------------------------------------------------------
SET                     ' set a TARGET for TIME or TEMPERATURE 
  if nowTIME = true then                   ' is the time or perhps not?
        if goUP = true then                '
          changetime = changetime + 1      ' increase the time with one
          markup = true : markdown = false '
        else                               '                                       
          changetime = changetime - 1      ' decrease the time with one 
          markDOWN = true : markup = false '
        endif                              '
        nowTIME = true : nowTEMPERATURE = false ' use TIME                                       
  else ' nowTEMPERATURE                    ' if not TIME then TEMPERATURE          
        if goUP = true then                '                                       
          changeTEMP = changeTEMP + 1      ' increase the temp with one 
          markup = true : markdown = false '                
        else                               '
          changeTEMP = changeTEMP - 1      ' decrease the temp with one 
          markdown = true : markup = false '              
        endif                              '
        nowTEMPERATURE = true : nowTIME = false ' use TEMPERATURE
  endif
return 'SET 
'-------------------------------------------------------------------------------

' this is like an interrupt routine, however, it is not an interrupt routine,    
' so it is just a normal sub routine                                              
longPress ' if up/down is pressed for about 5 sec change from TEMP to TIME or vs 
                                                                                  
 ' First we have to decice is UP or DOWN pressed                                 
   if (goUP = true) and (goDOWN = true) then return ' NOT pressed anything
                                                    ' not UP or DOWN 
   if goUP = false then         ' IF upwards is active   
     gosub Debounce
     for b = 1 to 5             ' every round takes 1 second
       if goUP = true then return    ' end if not pressed anymore                
       pause 1000            ' wait for 1000 ms and the total will be 5 seconds
       markup = true : markdown = false ' also mark it UP 
     next b   
   else                           ' IF downward is active    
     gosub Debounce
     if goDOWN = true then return ' it is not time to change the TIME or TEMP    
     for b = 1 to 5                  ' the total will be 5 seconds
       if goDOWN = true then return  ' end if not pressed anymore
       pause 1000                    ' wait for 1000 ms 
       markdown = true : markup = false ' also mark it DOWN 
     next b
   endif
                  ' FALSE is active state, i.e. button pressed UP 
       if (markup = true) and (b = 5) then 
          changetime = changetime - 1   ' compensate the UP press
       endif    ' FALSE is active state, i.e. button pressed DOWN 
   if (markdown = true) and (b = 5) then
     changetime = changetime + 1    ' compensata the DOWN press (possible long) 
   endif     
                 ' if b=5 then we will change from TEMP to TIME or TIME to TEMP 
                 ' time has elapsed for 5 seconds
   if b = 5 then toggle changeteorti 'do the change from TEMP to TIME or vs
   gosub SET ' change (TIME to TEMP) or (TEMP to TIME)
   gosub writeFirstLineLCD
return ' longPress                                                       ' L378A
'======================end=longPress============================================

checkIFpressed        ' check if pressed and also mark if it is UP or DOWN               
                      ' and act to that 
  if goup = true then                      ' first check UP 
    markup = true  : high rele : high leds ' and act to that
  else                                     ' else it is false
    markup = false : low rele : low leds   ' and act to that
  endif               

return ' chekIFpressed                     now we know if it is UP or DOWN also
'-------------------------------------------------------------------------------

readTEMP              ' Read the REAL water temp to readTEMP 
  i2cread dataPort, clkPort, cont, TMPaddr, tempRead  
                          
  if tempRead < tempSet then   ' Check where the real temperature is
    changeTeorti = true        ' set the heat ON
  else 
    changeTeorti = FALSE       ' or OFF. But not here, IT HAPPENS LATER 
  endif
                          
return 'readTEMP               ' now we know, shall we HEAT or NOT HEAT
'-------------------------------------------------------------------------------

input  PORTA.5   :  input PORTA.4  ' UP and DOWN, the only button
output PORTA.3   : output PORTA.2  ' 3=LEDs (green and red), 2=TIP120-> RELE
changetime = 60  : changetemp = 60 ' initial values for TIME and TEMP (60 & 60)
   Pause 500                       ' Wait for LCD to startup
   hour = 0                        ' Set initial time to 00:00:00
  minute = 0
  second = 0
                                                               
mLoop: ' the main Loop                                                           writeLCD                            
      markup = false : markdown = false   ' mark them FALSE for next round       writeToLCD  
  changeTEMP = false                      ' Let's assume it is not pressed       Debounce
  changetime = false                      ' and this also                        SET 
                                          '                                      longPress
  gosub readTEMP   ' read the temp and check if the SET temperature has changed  checkIFpressed
  gosub checkIFpressed  ' the changeTEorTI will perhaps have a value             readTEMP  
                    ' next we do a fake interrupt call                            
  gosub longPress   ' check if there is a need to change from TEMP to TIME of vs

'  i2cwrite dataPort, clkPort, cont, lcdaddr, temp    ' write the LCD

goto mloop ' keep on looping
end
the processor is PIC12LF1552 but I don't have it yet, and the program is far from ready
and it is not so nice to have a warning like floating around, it could be a symptom of something
more problematic.

keymuu