MAX 31850 on one wire bus with DS18B20

in Propeller 1
Can these work on the same bus? I can get the DS18b20 to read but not the thermocouple amp.
Thanks
Aaron
Thanks
Aaron
Comments
In the adafruit site is says it is not a drop in.
I'm hoping someone has some code that works with this
Aaron
Is there a way to modify the output of the one or both to work together?
Thanks
Aaron
CON _clkmode = xtal1 + pll16x '80 MHz system clock needed for TV _xinfreq = 5_000_000 {{ 3.3v 3.0 - 5.5v │ ┌───┐ │ 4k7 │ │ │ 'for long wires use 1k pull up │ └┬┬┬┘ │ │ ││└──┘ 1W pin ─────┻──┼┻────── more sensors │ }} OBJ ow : "spinonewire" tv : "tv_text" VAR long addrs0[2],addrs1[2],addrs2[2],addrs3[2] '64 bit sensor addresses long A_temp,B_temp,C_temp,D_temp 'designation of various sensors long firstSens,secondSens,thirdSens,thermocouple,degF PUB init ''start objects and define 1wire addresses waitcnt(clkfreq*2+cnt) '2 seconds for TV to come on tv.start(0) ow.start(10) 'define device addresses of temp sensors 'use spin_onewire_test to determine addresses of devices addrs0[0]:=$3e676928 'least significant long of 64 bit address shop addrs0[1]:=$87000006 'most significant long of 64 bit address A_temp := @addrs0 ' the memory location of complete 64 bit address value 'other sensors addrs1[0] :=$3F560228 addrs1[1] :=$7A000006 ' coop B_temp := @addrs1 addrs2[0] :=$70056F28 addrs2[1] :=$7F011431 'boiler C_temp := @addrs2 addrs3[0] :=$182CAA3B addrs3[1] :=$CC000000 'chimney D_temp := @addrs3 'thermocouple, { 'setconfig(12,0,0) 'leave commented out unless you want to change the ' resolution of all the devices } main PUB main ''loop repeat firstSens:=readTemperature(A_temp) waitcnt(clkfreq/10+cnt) secondSens:=readTemperature(B_temp) waitcnt(clkfreq/10+cnt) thirdSens:=readTemperature(C_temp) waitcnt(clkfreq/10+cnt) thermocouple:=readT_couple(D_temp) 'read device waitcnt(clkfreq/10+cnt) tv.home tv.str(string("Shop temp = ")) 'may read 7403°F or very close to 32 if no sensor showf(firstSens,0) tv.str(string(13,13,"Coop temp = ")) showf(secondSens,0) tv.str(string(13,13,"Boiler Temp = ")) showf(thirdSens,0) tv.str(string(13,13,"Chimney Temp = ")) PrintF(thermocouple) PUB readTemperature(addr) | temp,dsOut '' Read the temperature from a DSxxxxx sensor, and return it. ' Blocks while the conversion is taking place. ow.reset ow.writeByte(ow#MATCH_ROM) ow.writeAddress(addr) '64 bit address of device being addressed ow.writeByte(ow#CONVERT_T) ' Wait for the conversion repeat waitcnt(clkfreq/100 + cnt) if ow.readBits(1) 'we Have a reading! Read it from the scratchpad. ow.reset ow.writeByte(ow#MATCH_ROM) ow.writeAddress(addr) '64 bit address of device being addressed ow.writeByte(ow#READ_SCRATCHPAD) dsOut := ow.readBits(16) 'degF := (temp << 4)*9/5+32 temp := ~~dsOut * 625 ' extend sign, 0.0001° units return temp pub showf(temp,places) | tp,Modulus 'places = number of decimal places to show '' Print temperature in degrees Fahrenheight w/(places) number of decimals ' -- temp is passed in C case places 'this added by AG 0 : Modulus:=0 'integer only 1 : Modulus:=10 '1 decimal 2 : Modulus:=100 '2 3 : Modulus:=1000 '3 4 : Modulus:=10_000 '4 if (temp > 0) temp := temp * 9 / 5 + 32_0000 else temp := 32_0000 - (||temp * 9 / 5) if (temp < 0) 'if negative tv.out("-") ||temp 'print degrees w/ selectable number of decimal places if Modulus==0 tv.dec(temp / 10_000) ' print whole portion truncated else tv.dec(temp / 10_000) ' print whole portion tv.out(".") tv.dec(temp // Modulus) ' print fractional portion tv.out(176) tv.str(string("F ")) PRI readT_couple(_addr) | temp,dsOut, degC ow.reset ow.writeByte(ow#MATCH_ROM) ow.writeAddress(_addr) '64 bit address of device being addressed ow.writeByte(ow#CONVERT_T) ' Wait for the conversion repeat waitcnt(clkfreq/100 + cnt) if ow.readBits(1) ' Have a reading! Read it from the scratchpad. ow.reset ow.writeByte(ow#MATCH_ROM) ow.writeAddress(_addr) '64 bit address of device being addressed ow.writeByte(ow#READ_SCRATCHPAD) dsOut := ow.readBits(16) temp := ~~dsOut * 504 'calibrate temp (lower value = lower readout) tested @ 175 F degF := (temp << 4)*9/5+32 return degF PUB PrintF(FAR) tv.dec(FAR / 10_0000) ' print whole portion truncated tv.out(176) tv.str(string("F ")) pub setconfig(resolution, th, tl) | cfg '' Sets temperature resolution, 9 to 12 bits '' th and tl are passed in whole degrees C '' comment out in PUB init unless you want to change the resolution of all the devices case resolution {Resolution bits...} 9: cfg := %0_00_11111 10: cfg := %0_01_11111 11: cfg := %0_10_11111 other: cfg := %0_11_11111 ow.reset ow.writebyte(ow#SKIP_ROM) {Write to scratchpad...} ow.writebyte($4E) {Three bytes follow this command...} ow.writebyte(th) ow.writebyte(tl) ow.writebyte(cfg) ow.reset ow.writebyte(ow#SKIP_ROM) {Write configuration into EEPROM...} ow.writebyte(ow#COPY_SCRATCHPAD) repeat until ow.readbits(1) {let copy finish} ow.reset DAT
and a screen shot of TV. this is with thermocouple on tableThe MAX 31850 is a onewire device not SPI.
Aaron
I don't know which 1W driver you're using, but I've attached mine which has been used in several commercial apps.
Since I can get the 31850 to work by itself, I'm now trying to use a separate cog for it. Just need to sort the variables so there is no cross talk and will probably use a different 1W driver for it than the 18B20s. I need to study up on how to use cogs and types of memory. It's been a while since I last did these things.
Aaron