Hello,
I'm trying to get the serial number from a DS18B20 connected to a 12F675 without any success.
There is a 4.7K between VCC and DQ.
Here is the data I get as an output:
Ser# = 000000000000h
CRC Value = 00h
Read ROM...
Read 64-bit device data into the 8-byte array
Family code00h
Ser# = 000000000000h
CRC Value = 00h
I am sure of the DS18B20 (it is working).
Here is the code:
----------------------------------------------------
DEFINE OSC 4
SO CON 0 ' GPIO.0 (Pin7) Serial out
DQ CON 1 ' GPIO.1 (Pin7) one wire data pin "DQ"
SEARCH_ROM CON $F0
ID VAR BYTE[8] ' Array storage variable for 64-bit ROM code
ANSEL=0
OUTPUT DQ
SEROUT2 SO,16468,[13, 10, "1-wire Device Search", 10,13,10,13]
start:
SEROUT2 SO,16468,[ "Read ROM...",10,13]
OWOUT DQ, 1, [$33] ' Issue Read ROM command
SEROUT2 SO,16468,[ "Read 64-bit device data...",10,13]
OWIN DQ, 0, [STR ID\8]' Read 64-bit device data into the 8-byte array "ID"
SEROUT2 SO, 16468,["Family code",HEX2 ID[0],"h", 10, 13]
SEROUT2 SO, 16468,["Ser# = ",HEX2 ID[1],HEX2 ID[2],HEX2 ID[3],HEX2 ID[4],HEX2 ID[5],HEX2 ID[6],"h", 10,13]
SEROUT2 SO, 16468,["CRC Value = ",HEX2 ID[7],"h", 10, 13]
pause 2000
GOTO start
END
----------------------------------------------------
Any idea about why it is not working ?
Thanks,
Fabien
Bookmarks