Hi guys.
im stumpped.
i currently have my pic16f628 reading from 9 DS18b20 and outputting to the pc.
working great except its now 2000 words.
currently i query each device in turn with its hardcoded rom id.
like so.
Code:
OWOUT DQ, 1, [$55,$28,$DE,$0E,$66,$02,$00,$00,$BD,$BE]
OWIN DQ, 2, [Temp2.LOWBYTE,Temp2.HIGHBYTE]'
TEMPnow2 = Temp2 + ofst30
if Temp2 = 65535 then
Temp2 = 0
tempnow2 = 480
else
hserout ["TEMP2 Raw:= ",dec4 Temp2,13]
endif
this works perfectly for me but thast code repeats for each DS18b20
but i am trying to do something like the following
Code:
i=1
h=0
read h, id
while i<9
OWOUT DQ, 1,[$55,id,$BE]
OWIN DQ, 2, [Temps.LOWBYTE(i),Temps.LOWBYTE(i+1)]
TEMPnows[i] = Temps[i] + ofst30
if Temps[i] = 65535 then
Temps[i] = 0
tempnows[i] = 480
else
hserout ["TEMP",dec i," Raw:= ",dec4 TEMPs[i],13]
endif
i=i+1
h=h+8
wend
i have the rom id's stored in eeprom starting at 0
the above code compiles but dont work,
any ideas?
thanks.
Bookmarks