DS2760 module
rePete
Posts: 18
Hi,
A propeller newbie here...
I'm getting to know the propeller with some baby steps. Right now I'm trying to read the output from the DS2760 TC module and am hoping somebody can point me in the right direction.
Very simple code but don't seem to be getting the correct results
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
debug : "FullDuplexSerialPlus"
ow : "OneWire"
PUB TwoWayCom | a, b, c, tc_volt1, tc_volt2, tc_volt
ow.start(15) ' DS2760 on pin 15
debug.start(31, 30, 0, 57600)
repeat
ow.reset
ow.writeByte($CC)
ow.writeByte($69)
ow.writeByte($18)
a := ow.readByte
b := ow.readByte
debug.dec(c)
debug.str(string(" "))
debug.dec(a)
debug.str(string(" "))
debug.dec(b)
debug.str(string(10,13))
ow.writeByte($CC)
ow.writeByte($69)
ow.writeByte($0E)
tc_volt.byte[noparse][[/noparse] 0]:=ow.readByte
tc_volt.byte[noparse][[/noparse] 1]:=ow.readByte
' tc_volt:=tc_volt >> 3
' tc_volt:=tc_volt/4000
debug.dec(tc_volt)
debug.str(string(" "))
debug.dec(tc_volt.byte[noparse][[/noparse] 0])
debug. str(string(" "))
debug.dec(tc_volt.byte[noparse][[/noparse] 1])
debug.str(string(10,13))
waitcnt(clkfreq + cnt)
The ambient temperature seems to come out OK -> 19 C
I the tc voltage comes out off scale high...
431 18 224
65535 255 255
Help?
-Pete
A propeller newbie here...
I'm getting to know the propeller with some baby steps. Right now I'm trying to read the output from the DS2760 TC module and am hoping somebody can point me in the right direction.
Very simple code but don't seem to be getting the correct results
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
OBJ
debug : "FullDuplexSerialPlus"
ow : "OneWire"
PUB TwoWayCom | a, b, c, tc_volt1, tc_volt2, tc_volt
ow.start(15) ' DS2760 on pin 15
debug.start(31, 30, 0, 57600)
repeat
ow.reset
ow.writeByte($CC)
ow.writeByte($69)
ow.writeByte($18)
a := ow.readByte
b := ow.readByte
debug.dec(c)
debug.str(string(" "))
debug.dec(a)
debug.str(string(" "))
debug.dec(b)
debug.str(string(10,13))
ow.writeByte($CC)
ow.writeByte($69)
ow.writeByte($0E)
tc_volt.byte[noparse][[/noparse] 0]:=ow.readByte
tc_volt.byte[noparse][[/noparse] 1]:=ow.readByte
' tc_volt:=tc_volt >> 3
' tc_volt:=tc_volt/4000
debug.dec(tc_volt)
debug.str(string(" "))
debug.dec(tc_volt.byte[noparse][[/noparse] 0])
debug. str(string(" "))
debug.dec(tc_volt.byte[noparse][[/noparse] 1])
debug.str(string(10,13))
waitcnt(clkfreq + cnt)
The ambient temperature seems to come out OK -> 19 C
I the tc voltage comes out off scale high...
431 18 224
65535 255 255
Help?
-Pete
Comments
I hit the TC with a butane torch (buhuhahahaha) and still nothing [noparse]:([/noparse]
Was just thinking that maybe I don't have the TC seated as well as I think. Do you know what you get out of it if it's open circuited?
have two modules - one I use with a BS2P, that I know is working fine. Same result - must be doing something silly...
Post Edited (rePete) : 4/16/2007 2:42:51 AM GMT
Example
ow.reset 'get thermocouple voltage
ow.writebyte(SkipNet)
ow.writebyte(RdReg)
ow.writebyte($0E)
tCuV.byte := ow.readbyte
ow.reset 'get thermocouple voltage
ow.writebyte(SkipNet)
ow.writebyte(RdReg)
ow.writebyte($0F)
tCuV.byte[noparse][[/noparse]0] := ow.readbyte
ow.reset
ow.writeByte($CC)
ow.writeByte($69)
ow.writeByte($0E)
tc_volt.byte[noparse][[/noparse] 1]:=ow.readByte
tc_volt.byte[noparse][[/noparse] 0]:=ow.readByte
needed the extra reset - in my hasted I had accidentally multiplied by 15.625 twice - thought I was running a fever of 111 F [noparse]:)[/noparse]
I think there are other (better) examples of using the DS2760 in the forums - but wanted to put up the start of a program that uses that module in case it is helpful. Also dropped in a small code to generate the thermocouple table.
Note my tc table is a bit odd - (farenheit-32)/15.625*1000 - looking up temperature by DS2760 units instead of microvolts
used the NIST coefficients for a ktype TC
Post Edited (rePete) : 4/16/2008 3:26:44 AM GMT