Hello !
I try to build one volt/termometer with 16F684 and 2x8 characters display. I wrote the code, all works ...fine, the "IN" temperature is shown for 8 seconds, the "OUT" temperature for next 8 seconds, and so on, and so on (the voltage is on second line permanent)....
BUT : sometimes, the value of temperature "jump" to "0.0 'C", especially when the temperature decreases ?! I really don't understand why . I made many changes in "pause", in "Define LCD_COMMANDUS 2000" and "Define LCD_DATAUS 50" , I added/removed " WaitLoop1: While not DQ1 : Wend" , but without results...
Any clue ? Thanks in advance !
This is "the big part" of my code :
Code:
Main :
Gosub Get_Vbatt                           ' make a new measure
            TmpW = Vbatt * Vfs                    ' AD * 20480
          TmpW = Div32 1024                     '(AD * 20480) / 1024       
Gosub char_batt 
        LcdOut $FE, $c0, symb ," ", dec TmpW dig 4,dec TmpW dig 3,",",dec TmpW dig 2, " V" 

Gosub StartTimer
While seconds =< 8
Part1:
    ' Start temp.conv.Sensor1
     OWOut DQ1, 1, [$CC, $44] 
     OWOut DQ1, 1, [$CC, $BE]
       OWIn  DQ1, 2, [temperature1.byte0, temperature1.byte1]  
    
        If Temperature1.15 then       
              Temperature1= ~Temperature1 +1
              Twist1 = 1
        Endif
 
    Dummy1 = 625 * Temperature1
    TempC1 = DIV32 10 
    TempC1 = (Temperature1 & $7FF) >> 4
    Float1 = ((Temperature1.Lowbyte & $0F ) * 25 )>>2
    Temperature1 = TempC1*100 + Float1

        If Twist1 then
                V1= 10000 - Temperature1                 
              Twist1 = 0
         else
              V1= 10000 + Temperature1
        EndIf

        If V1 >= 10000 then                           
              Temperature1=V1-10000                   
         else                                   
              Temperature1=10000-V1                    
        EndIf

    GoSub SelectSign
           If (temperature1/100) =>10 then
                LcdOut $FE, $80, "I:", Sign1, DEC (Temperature1 / 100), ".", DEC Temperature1 dig 1, 0
            else
                LcdOut $FE, $80, "I:", Sign1, $14, DEC (Temperature1 / 100), ".", DEC Temperature1 dig 1, 0
            Endif
      Pause 500
Wend
'===================================================================================================================
While seconds >= 9 and seconds =< 17 
Part2 :    
      ' Start temp.conv.Sensor1
     OWOut DQ2, 1, [$CC, $44] 
     OWOut DQ2, 1, [$CC, $BE]
      OWIn  DQ2, 2, [temperature2.byte0, temperature2.byte1]  

        If Temperature2.15 then       
          Temperature2= ~Temperature2 +1
          Twist2 = 1
        Endif
 
    Dummy2 = 625 * Temperature2
    TempC2 = DIV32 10 
    TempC2 = (Temperature2 & $7FF) >> 4
    Float2 = ((Temperature2.Lowbyte & $0F ) * 25 )>>2
    Temperature2 = TempC2*100 + Float2

        If Twist2 then
              V2= 10000 - Temperature2               
              Twist2 = 0
         else
              V2= 10000 + Temperature2
        EndIf

        If V2 >= 10000 then                           
              Temperature2=V2-10000                   
         else                                   
              Temperature2=10000-V2                   
        EndIf

    GoSub SelectSign
            If (temperature2/100) =>10 then
                LcdOut $FE, $80, "O:", Sign2, DEC (Temperature2 / 100), ".", DEC Temperature2 dig 1, 0
            else
                LcdOut $FE, $80, "O:", Sign2, $14, DEC (Temperature2 / 100), ".", DEC Temperature2 dig 1, 0
            Endif
      Pause 500
Wend
Gosub ResetTime
Goto Main
I have in code "include elapsed.bas" of course...The internal osc is set to 4 MHz.