Shop OBEX P1 Docs P2 Docs Learn Events
DS2760 module — Parallax Forums

DS2760 module

rePeterePete Posts: 18
edited 2009-04-05 14:01 in Propeller 1
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

Comments

  • lyons5959lyons5959 Posts: 13
    edited 2007-04-16 02:07
    I haved worked with this module on another project and found the same. The problem is caused because of the way a thermocouple works. The high numbers you are seeing are actually negative numbers meaning that the thermocouple junction is actually cooler than the chip itself. Try pinching the tip of the thermocouple between your fingers, it should read atleast a positive voltage, though probably not that high.
  • rePeterePete Posts: 18
    edited 2007-04-16 02:22
    Thanks Lyons,

    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
  • rePeterePete Posts: 18
    edited 2007-04-16 02:52
    do I need to call ow.reset in between each series of writeByte(XX) calls?
  • Mike GreenMike Green Posts: 23,101
    edited 2007-04-16 03:32
    I believe you do have to call ow.reset before each command sequence so there would need to be one before the second ow.writeByte($CC).
  • lyons5959lyons5959 Posts: 13
    edited 2007-04-17 00:05
    Mike is right. You only need to call a reset for every set of commands.

    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
  • T ChapT Chap Posts: 4,223
    edited 2007-04-17 01:15
    Here is some 2760 SX code Bean put together and I might have only slightly altered, maybe you can get some info from it, it works great btw. This code should read the temp and output a string with the temp once per sec.
  • rePeterePete Posts: 18
    edited 2007-04-17 02:45
    Thanks all - got it working

    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]
  • rePeterePete Posts: 18
    edited 2007-04-24 01:34
    for what it's worth

    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
  • rePeterePete Posts: 18
    edited 2009-04-05 14:01
    Coffee roaster code for Siri
Sign In or Register to comment.