ReadTemp and the 40x

agoodevans

New Member
Hi guys, new to forum and finally worked out how to send a post. I'm trying to write a program to controll an Aquaponics system in a hot house.The PicAxe Editor tells me I have a discontinued 40x which is installed on the Axe 022 proto board kit. Is this worth pursuing with or get a new chip? I've spent some considerable time trying to get ReadTemp to work (Dallas 18b20). I can ouput to leds OK but can't input in any form. (LDR's using readadc?). I'm assuming "Readtemp 0,b0" reads from port D (Input port) bit 0 into variable b0. Debug doesn't show any value read in. This is simple enough to operate on the 08M? I'm using a pullup 4K7 which worked on the 08M? Any help would be appreciated.
 

westaust55

Moderator
Welcome to the PICAXE forum.

Tentatively there is nothing wrong with using an older PICAXE chip if you already own it.

With respect to the 40X what is the firmware version.

At V 7.6 Rev Ed updated the READTEMP/READTEMP12/COUNT TIMING.


Certainly the READTEMP and READTEMP12 commands should work on the 40X.

EDIT:
Yes portD is the inputs with the terminals along the "bottom" edge of the AXE022 board.

althought we represent bit 0 to the right when we write in binary,
input 0 is to the left side of the portD connections - see this post
http://www.picaxeforum.co.uk/showthread.php?p=61040


READTEMP 0, b0 should then work


Since you are having problems with READADC as well, maybe a photo of your connections and post your program may help see if there is something else obvious.
 
Last edited:

BeanieBots

Moderator
Welcome to the forum.

At a glance, it looks like you are trying to use ReadTemp to read the analogue voltage on an LDR. That won't work!
Also, for analogue inputs, double check that you are connecting to an analogue input and that you are using ReadADC.

The 40X is discontinued but it is still supported.
There is no need to upgrade unless you want to take advantage of the extra functions in the newer chips.
 

westaust55

Moderator
LDR's and other analog devices need to be connected to the port A or port E analog input connections at the top-left of the AXE022 board.
Be aware that the very top conenction is the reset pin and there are only 7 analog pins available

For the LDR, do you have a resistor in the circuit as well?
See page 28 in PICAXE manual 3.
 

agoodevans

New Member
Thanks gives me some direction

Thanks,
I thought Port D was along the bottom right side. That explains some problems.
Will try "Readtemp" and a input switch with debounce and see what happens.

The LDR should still work as I'm using the top left bank for the ADC ports and yes I was aware of the reset pin. Read somewhere that some chips need a reference for the LDR? I do get some output via debug but it's not consistent and doesn't make sense.
Cheers :)
 

westaust55

Moderator
Thanks,
I thought Port D was along the bottom right side. That explains some problems.
Will try "Readtemp" and a input switch with debounce and see what happens.
One of the very reasons why I created the AXE022 "layout" that I gave you a link to, as when I started with PICAXE 2 years ago, the datasheet has no layout diagram and the terminal markings were 9and still likely are) non-existent - could see 0V and +V but nothing about port ID

The LDR should still work as I'm using the top left bank for the ADC ports and yes I was aware of the reset pin. Read somewhere that some chips need a reference for the LDR? I do get some output via debug but it's not consistent and doesn't make sense.
Did you look at the schematic for connection of an LDR in PICAXE manual 3 page 28 as mentioned earlier at post4.
 

agoodevans

New Member
Work of art

Thanks the schematic is a work of art and solves many problems. I soldered pin strips onto my board so I couldn't read which port was which. The Ldr problem is also solved. Thanks for the pointers.
One happy chappy!
 
Top