Analog inputs to PICAXE chips.....how!

fdwll

New Member
I cannot get the PICAXE chips to read an analog input. I have tried pots, LDR's, temperature
sensors and although they vary the voltage to the ADC input pin, the input signal does
not read out in the variables dialog and the chip does not react in any way to the input.
The chip is working, as it will flash a LED as the program cycles, and read digital inputs and
switch the outputs, but not read an analog input.
I will be grateful if anybody can help, as I am obviously not doing something right.
 

Dippy

Moderator
Post your code and schematic including component values.

Have you read the Getting Started Manual to see which legs can be used for ADCing??
Have you read the Basic manual under READADC etc.??

Its better for people to point out where you've gone wrong rather than write code for you etc.
 

Mycroft2152

Senior Member
FDWLL,

Post the dsn and bas file. I'll take a look at it. My crystal ball is not working this morning.

Myc

Dippy, stop being so cheap and buy VSM, while you are at it, get a copy of DIPTRACE too. :)
 

Dippy

Moderator
I'll get round to getting VSM. Looks good.

Diptrace? I'm sure it's very good, but as I already use Seetrax Ranger and trying to convert to EasyPC/EasySpice/Pro-router I really can't wear out my brain learning another one.
I dunno whether Diptrace has it but Easy-PC has this really useful calculator for pcb track/resistance/heating/impedance/heatsink calcs. Very useful.

Anyway, back to the thread....
 

fdwll

New Member
Analog input program

Here are the files for the above thread. I have been using & programming PICAXE chips
for some time, so I hope I have it right. If I run this on the PICAXE simulator it works.
 

Attachments

Last edited:

Technical

Technical Support
Staff member
You've got your power rails in a mix because of the battery symbol. This has confused the digital microcontroller simulation and the analogue SPICE simulation (two separate simulations interact at the same time). The LED works because it is a digital simulation, the ADC not because it is an analogue simulation. The ISIS help files explain this in more detail.

Due to the technicalities of simulation a PICAXE chip (and all other 'digital' ICs) always use the background Vcc/Vdd power supply. The Vcc and Vdd pins on the IC layout version of the PICAXE chip are purely cosmetic (they dont even appear on the schematic version layout).

So to get your circuit working:
1) Right Click > Place Terminal > Power
Add the power terminal onto the design - where abouts is irrelevent, it just adds a reference for the analogue SPICE anaysis.
2) Design>Configure Power Rails
You now have two conflicting power rails Vcc (from the battery) and the default Vcc/Vdd (always included). So just delete Vcc.

Your design will then work as expected.

The morale of the story is it is much easier to use the default POWER and GROUND terminals rather than a battery symbol. If you must use a battery symbol always add a POWER terminal somewhere on the design.
 

fdwll

New Member
Analog inputs

Thanks Technical, I did as you said and it all works perfectly now. Much obliged.
Frank Williams
 
Top