Hi,
I have a code that works great with the DS1820, however when i change to a DS18S20, the only thing that i get is 127.68ºC.
I allready made a search on the forum, however all the resaults are exactly the same as my code.
I have 2 DS18S20, and the show exactly the same value.
Can somebody help me;
Here is my code.
Code:count_remain Var Byte ' Count remaining count_per_c Var Byte ' Count per degree C temperature Var Word ' REGISTOS PINOUT 1 = IN; 0 = OUT ' =========================================================== '76543210 TRISA = %11111111 TRISB = %00001111 TRISC = %00100000 TRISD = %00000000 TRISE = %00000000 ADCON1 = %00001110 ADCON0 = %00000000 ' NOMES PINOUT ' =========================================================== LED VAR PORTC.3 DQ VAR PORTD.0 ' DEFENIÇÕES ' =========================================================== DEFINE LCD_DREG PORTB ' LCD Data bits on PORTB DEFINE LCD_DBIT 4 ' PORTB starting address DEFINE LCD_RSREG PORTB ' LCD RS bit on PORTB DEFINE LCD_RSBIT 3 ' LCD RS bit address DEFINE LCD_EREG PORTB ' LCD E bit on PORTB DEFINE LCD_EBIT 2 ' LCD E bit address DEFINE LCD_BITS 4 ' LCD in 4-bit mode DEFINE LCD_LINES 2 ' LCD has 2 rows DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us DEFINE LCD_DATAUS 50 ' Set data delay time in us ' INICIO PROGRAMA ' =========================================================== Main: gosub Read_Sensor_Amp pause 100 goto Main ' LEITURA SENSOR AMPLIFICADOR ' =========================================================== Read_Sensor_Amp: OWOut DQ,1,[$CC,$44] Waitloop: OWIn DQ,4,[count_remain] If count_remain = 0 Then Waitloop OWOut DQ,1,[$CC,$BE] OWIn DQ,0,[temperature.LOWBYTE,temperature.HIGHBYTE,Skip 4,count_remain,count_per_c] temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100)/count_per_c) Lcdout $fe, 1, " Temp. Amplificador " Lcdout $fe, $C0," ",DEC (temperature/100),".",DEC2 temperature," C" return end





). 

Bookmarks