Code:
'*****************************************************************************
SensID:' Sensor Identification
'*****************************************************************************
OWOUT DQ, 1, [ $33 ] ' Read Chip Family code
OWIN DQ, 2, [ FAM,ID[6],ID[5],ID[4],ID[3],ID[2],ID[1],CRC]
' PAR Device ???
OWOut DQ, 1, [$55, FAM,ID[6],ID[5],ID[4],ID[3],ID[2],ID[1],CRC, $44 ]
OWOut DQ, 1, [ $55, FAM,ID[6],ID[5],ID[4],ID[3],ID[2],ID[1],CRC, $BE ]
PAUSE 750
OWIN DQ, 2, [R_Temp.Lowbyte, R_Temp.Highbyte] ' Read two bytes
IF FAM != $FF THEN
IF R_Temp = $0550 OR R_Temp = $AA THEN
PAR = 1
ELSE
PAR = 0
ENDIF
ELSE
LCDOUT $FE,$80, "NO SENSOR "
LCDOUT $FE,$C0, "Chk Sens & Reset"
STOP
ENDIF
IF FAM = $05 THEN
LCDOUT $FE,$80, "DS 2405 "
PAUSE 1000
LCDOUT $FE,$80, " CRC: ",HEX2 CRC," FAM: ", HEX2 FAM
ENDIF
IF FAM = $10 THEN
LCDOUT $FE,$80, "DS 18S20/1820"
IF PAR THEN LCDOUT $FE,$88," PAR " : PAUSE 1000
Tempo = 250
PAUSE 1000
LCDOUT $FE,$80, " CRC: ",HEX2 CRC," FAM: ", HEX2 FAM
ENDIF
IF FAM = $22 THEN
LCDOUT $FE,$80, "DS 1822 "
IF PAR THEN LCDOUT $FE,$88," PAR " : PAUSE 1000
OWOUT DQ, 1, [$CC, $4E, 0, 0, DS18B20_bit] 'Skip ROM search and write N_bits
' resolution to scratch pad
PAUSE 1000
LCDOUT $FE,$80, " CRC: ",HEX2 CRC," FAM: ", HEX2 FAM
ENDIF
IF FAM = $28 THEN
LCDOUT $FE,$80, "DS 18B20 "
IF PAR THEN LCDOUT $FE,$88," PAR " : PAUSE 1000
OWOUT DQ, 1, [$CC, $4E, 0, 0, DS18B20_bit] 'Skip ROM search and write N_bits
' resolution to scratch pad
PAUSE 1000
LCDOUT $FE,$80, " CRC: ",HEX2 CRC," FAM: ", HEX2 FAM
ENDIF
LCDOUT $FE,$C0," ID:",HEX2 ID[1],HEX2 ID[2],HEX2 ID[3],HEX2 ID[4],HEX2 ID[5],HEX2 ID[6]
Alain
Bookmarks