I've tried using the parasite power option and can not seem to get it to work at all. Is there something I'm missing from my code? It works fine using three wire but not two.
Code:
read_temp:
owout portb.7,1,[$CC, $44] ' Send start temperature conversion
owout portb.7,1,[$CC, $BE] ' Send read scratchpad command
for x = 0 to 8 ' Process all 9 bytes
owin portb.7,0,[i] ' Read the scratch pad
dq[x] = i ' Place read byte into the array
next x ' Do again until all 9 bytes are processed
temp.Byte0 = dq[0] : temp.byte1 = dq[1] ' Store bytes 0 and 1 in the temp word variable
if temp.8 = 1 then ' If bit8 of temperature is set then its negative
sign = "-" ' Indicate temperature is NEGATIVE
temp.lowbyte = temp.lowbyte ^ 255 ' Reverse the bits of the lowbyte of TEMP
sign = " " ' Indicate temperature is POSITIVE
endif
half = temp.0
temp = ((temp.lowbyte) >> 1) * 10 ' Shift the lowbyte of the result right 1 place
temp = temp + (half * 5) ' Strip off bit 0 (0.5 degree) and add it to DEC
Bookmarks