A/D converter -- picaxe18X

mccarthym

New Member
After the following declaration
symbol adc= input2

the instruction
readadc adc,b1

appears not to convert but gives only a 0 or 255 return to b1.

If the the declaration is removed and the instruction is

readadc 2,b1 then conversion appears to occur as expected.

If a declaration is made for an input, does this then force it as a digital input and cannot be used as an analogue input?
 

hippy

Technical Support
Staff member
The problem is that you are trying to do "READADC input2,b1" to determine which channel to read it uses the value specified from 'input2' which will be 0 or 1 depending on whether the digital input is set or not, and it will then read analogue channel 0 or 1 respectively.

What you want is "SYMBOL adc = 2" at the top.

Edited by - hippy on 1/20/2004 10:42:44 PM
 
Top