How can you get the DS1820 and LCD to display actual 10ths of a degree?
My code I use for displaying the results of the conversion is
	Code:
	 LCDOUT $FE,$C0,"Temp", $fe, $C7, dec (temp >> 1), ".", dec (temp.0 * 5), $DF, "C"
  but it only seems to measure in 0.5degree steps not 0.1 degree steps
so it will never show room temperature as 19.7șC it will instead show 19.5șC  is there a way to fix this?
Rest of the conversion code is 
	Code:
	' Initialize DS1820 and check to see IF I was stupid enough to forget the DS1820
init1820:
        Low DQ                  ' Set the data pin low to init
        Pauseus 500             ' Wait > 500us
        DQ_DIR = 1              ' Release data pin (set to input for high)
        Pauseus 100             ' Wait > 100us
        If DQ = 1 Then
                Lcdout $fe, 1, "DS1820 not present"
                Pause 500
                Goto mainloop   ' Try again
        Endif
        Pauseus 400             ' Wait for end of presence pulse
        Return
' Write "command" byte to the DS1820
write1820:
        For i = 1 to 8          ' 8 bits to a byte
                If command.0 = 0 Then
                        Gosub write0    ' Write a 0 bit
                Else
                        Gosub write1    ' Write a 1 bit
                Endif
                command = command >> 1  ' Shift to next bit
        Next i
        Return
' Write a 0 bit to the DS1820
write0:
        Low DQ
        Pauseus 60              ' Low for > 60us for 0
        DQ_DIR = 1              ' Release data pin (set to input for high)
        Return
' Write a 1 bit to the DS1820
write1:
        Low DQ                  ' Low for < 15us for 1
@       nop                     ' Delay 1us at 4MHz
        DQ_DIR = 1              ' Release data pin (set to input for high)
        Pauseus 60              ' Use up rest of time slot
        Return
' Read temperature from the DS1820
read1820:
        For i = 1 to 16         ' 16 bits to a word
                temp = temp >> 1        ' Shift down bits
                Gosub readbit   ' Get the bit to the top of temp
        Next i
        Return
' Read a bit from the DS1820
readbit:
        temp.15 = 1             ' Preset read bit to 1
        Low DQ                  ' Start the time slot
@       nop                     ' Delay 1us at 4MHz
        DQ_DIR = 1              ' Release data pin (set to input for high)
        If DQ = 0 Then
                temp.15 = 0     ' Set bit to 0
        Endif
        Pauseus 60              ' Wait out rest of time slot
 Also:
How can you use 2 DS1820's and have them display the results on 2 different lines of the LCD, I know they are 1wire and should work fine, but how do you talk to each one individually and get the results from each one?
	
		
			
			
				
					
 Originally Posted by 
gimo
					
				 
				hi!!!
  im new in pic programming.. please give me sample codes for a circuit that counts from 0 - 99 (2 seven segment display) when a sensor is triggered. and alarms if the sensor is not triggered or idle for about 10 seconds.. thanks!!
			
		 
	 
  I'm a newbie just teaching myself about Pic's and programming, mainly by using snippets of other people's code and changing a few things to see what happens and try and figure out how to make it work
but the request you made can be found in numerous places, loads of sample codes contain that, and come on, its not that hard to work out, even for a wanna be blonde!
				
			
Bookmarks