readtemp issue

speed23947

New Member
This is probably a really stupid question but i cant get my temp sensor working for nothing!!
just trying the basic readtemp to a debug the read.
I'm using a picaxe 18m2 with the One Wire Digital Temperature Sensor - DS18B20
ive tried...

main:
readtemp b4,b0
sertxd (“The value is “,#b0,cr,lf)
pause 500
goto main
I get the "the value is" on the terminal but its allways 0

Main:
readtemp b.4,b1
if b1 > 127 then nege
serout c.0,t2400,(#b1)
goto main
nege:
let b1 = b1 - 128
serout c.0,t2400, ("-")
serout c.0,t2400, (#b1)
goto main

it sends to the lcd but the same ... I just get zeros..
I have the polarity right on the terminals on the sensor and the center pin
going to the b.4 pin on the 18m2 with the resistor across the pin and the +rail.


I dont know where im going wrong.. Please help
 

westaust55

Moderator
Do you definitely have a 5 volt supply to the DS18B20 and also a 4k7 ohm pull-up resistor on the data line to 5V supply? (checked with a multimeter?)
See page 184 in the current (V7.9) PICAXE manual 2

The value of zero sugggsts either the data line is not being pulled high (hence no "1" bits to give an alternative value) or there is a wiring error of some other nature (even maybe connected to the wrong PICAXE pin).
Maybe post you schematic diagram and a clear photo so folks here can trace the wiring which can help located wiring errors.

also spotted:
readtemp b4,b0
is missing the "." should be "b.4"

Are you using on a breadboard or a Rev Ed proto board or other?
If a Rev Ed board, there is often a 10 k Ohm pull down resistor on inputs that would need to be removed.

Note when posting program code, please insert between [code] and [/code] tags so it appears in a sub window within you post.
 
Last edited:

Technical

Technical Support
Staff member
Also make sure you are connecting directly to the PICAXE pin, not via a darlington buffer chip (e.g. on the 18 pin project board as supplied in 18 pin starter packs).
 

speed23947

New Member
attached is a image of what ive done to this point.as you can see in the image the lcd is showing 0000000000.
Its running the second program in the origanal post

Temp problems.jpg
 

speed23947

New Member
Also if anyone knows, you can see in the serial LCD that the top of the numbers are cut off.
If anyone has a thought on that...
 

Technical

Technical Support
Staff member
4k7 looks like a 47K (yellow violdet orange?)
You are also unlikely to get reliable connection to the download socket like that, it would be better to use flying wires as you have done on the sensor (or an AXE029 adapter)

The LCD is faulty, you shouldn't get a missing top pixel like that.
 
Top