Picaxe 28X1 and readtemp... What am I missing ??

Hydroid

Senior Member
Hi,

I cannot seem to get the readtemp command to work with my 28X1. I didn't bother attaching a photo of my setup because I'm using an AXE091 development board - and there is only one wire connected: From the TMP pin to the 28X1's ADC0 channel (Pin2). I figure even I can't mess up one wire..... :)

This is my very simple code:

Code:
main:

	readtemp 0, b0
	
	debug
	
	goto main
The debug screen b0 value never changed from 0...

Just for experimentation, I installed an 08M onto the AXE091 and connected the jumper from the TMP pin to the 08M's Pin6 (ADC1 channel) and ran this code:

Code:
main:

	readtemp 1, b0
	
	debug
	
	goto main
As expected, the debug screen b0 value read 21 and increased as I put my finger on the DS18B20 showing that it is responding...

I then tried a 18M2 chip, jumper from TMP to Pin18 (C.1 ADC) and ran this code:

Code:
main:

	readtemp c.1, b0
	
	debug
	
	goto main
As with the 08M, the b0 value showed 21 and responded to my finger touch

I also tried a 20M chip - and it worked too...

I then retried my 28X1 code, using a different 28X1 chip - to rule out a bad chip.. Nothing, b0 remained at 0...

Manual 2 page 184's READTEMP description shows that this command works on a 28X1, so I assume I'm missing something really simple, but I can't figure out what.

What am I not seeing / understanding ??

Thanks, John.
 

KeithRB

Senior Member
ReadTemp is not an ADC command. It uses a special 1 wire communication with the DS18B20. You need to specify a pin number for an input/output pin.
 

Technical

Technical Support
Staff member
28X1's ADC0 channel cannot be used for readtemp

You need to use an input pin, 0 through 7.

So readadc 0 is checking input 0, leg 10
 

Hydroid

Senior Member
Thank You

I figured it was something simple that I wasn't seeing. Leave it to me to just by chance pick three other chips where the ADC channel I chose also happens to be an input pin.. Talk about leading yourself down the garden path!

For my own future reference, I have annotated the manual changing the syntax statement from "Pin is the input pin" to "Pin must be an input pin"

Thanks for the clarification,

Regards, John.
 

westaust55

Moderator
Remember also as per Manual 2"

This command cannot be used on the following pins due to silicon restrictions:
08, 08M, 08M2 3 = fixed input
14M, 14M2 C.3 = fixed input
18M2 C.4, C.5 = fixed input
20M,20M2, 20X2 C.6 = fixed input
The reason is that the pin must be capable of being bi-directional as the PICAXE must send a control signal or setting data out to the DS18B20, and also must be able to act as an input to receive the data.
 
Top