Hi all:
My first proyect was to send text from 16f84 to my LCD 16x2. It´s Done thanks to people who helped me here!.
Now i want to use the ds18s20 temp sensor...i wrote a code in basic. I want show the temp in the lcd.
IT showed 54.71..and then 16.23, and so ..with big differences between them.I´ve connected the sensor using the 3 pins..not in parasite mode. I connected the DQ to PORTAB.7..with a 4.7k resistor and to vdd
TRISB.7 = 1
Temp1 Var PORTB.7 ' Temperature storage
Countr Var Byte ' Count remaining
Countc Var Byte ' Count per degree C
DS18S20 VAR WORD
c0 VAR WORD
c1 VAR WORD
c2 VAR WORD
c3 VAR WORD
Pause 500
Lcdout $FE, 1
Lcdout "La temperatura:"
start:
'START TEMP READING
OWOUT TEMP1, 1, [$CC, $44] ' $CC-SKIP SEARCHING FOR MULTIPLE DS18S20, $44-START
WAITF:
OWIN TEMP1, 4, [COUNTR] 'CHECK FOR STILL BUSY CONVERTING SIGNAL
IF COUNTR=0 THEN WAITF
OWOUT TEMP1, 1, [$CC, $BE] 'READ THE TEMPERATURE
OWIN TEMP1, 0, [DS18S20.LOWBYTE, DS18S20.HIGHBYTE, SKIP 4, COUNTR, COUNTC]
DS18S20=((DS18S20>>1*100)-25)+(((COUNTC-COUNTR)*100)/COUNTC)
c0 = DS18S20 dig 3
c1 = DS18S20 dig 2
c2 = DS18S20 dig 1
c3 = DS18S20 dig 0
Lcdout $FE, $C0, #c0,#c1,".",#c2,#c3," C"
pause 1000
goto start
end
Thanks in advance!!
My first proyect was to send text from 16f84 to my LCD 16x2. It´s Done thanks to people who helped me here!.
Now i want to use the ds18s20 temp sensor...i wrote a code in basic. I want show the temp in the lcd.
IT showed 54.71..and then 16.23, and so ..with big differences between them.I´ve connected the sensor using the 3 pins..not in parasite mode. I connected the DQ to PORTAB.7..with a 4.7k resistor and to vdd
TRISB.7 = 1
Temp1 Var PORTB.7 ' Temperature storage
Countr Var Byte ' Count remaining
Countc Var Byte ' Count per degree C
DS18S20 VAR WORD
c0 VAR WORD
c1 VAR WORD
c2 VAR WORD
c3 VAR WORD
Pause 500
Lcdout $FE, 1
Lcdout "La temperatura:"
start:
'START TEMP READING
OWOUT TEMP1, 1, [$CC, $44] ' $CC-SKIP SEARCHING FOR MULTIPLE DS18S20, $44-START
WAITF:
OWIN TEMP1, 4, [COUNTR] 'CHECK FOR STILL BUSY CONVERTING SIGNAL
IF COUNTR=0 THEN WAITF
OWOUT TEMP1, 1, [$CC, $BE] 'READ THE TEMPERATURE
OWIN TEMP1, 0, [DS18S20.LOWBYTE, DS18S20.HIGHBYTE, SKIP 4, COUNTR, COUNTC]
DS18S20=((DS18S20>>1*100)-25)+(((COUNTC-COUNTR)*100)/COUNTC)
c0 = DS18S20 dig 3
c1 = DS18S20 dig 2
c2 = DS18S20 dig 1
c3 = DS18S20 dig 0
Lcdout $FE, $C0, #c0,#c1,".",#c2,#c3," C"
pause 1000
goto start
end
Thanks in advance!!
Last edited: