Analog in

jrem

New Member
Hi to all . . . I'm messing around with the analog input on the PICAXE-08. I have a 10k pot +5-W-0, and tied the wiper to the input. Then I'm multiplying the sample by a value, and blinking an LED using the value to pause the blink.

I'm not getting consistent pause rates. The VDC on the wiper is good, i.e., .2 - 4.9, and I get a changing pause rate for the lower 2/3 voltage range, but I get errant analog values inbetween voltage change rates.

Any ideas why this is happening? I would expect steps for the analog value as the pot is turned, but I get random blink rates inbetween the steps.

Regards, John.
 

hippy

Ex-Staff (retired)
Welcome to the PICAXE forum.

The first thing to do is to tray a short program so you can use the Terminal function of the Programming Editor to see what you are getting ...

Do
ReadAdc pin, variable
SerTxd( #variable, CR, LF )
Pause 500
Loop

If that's working as expected it's likely down to how you create your random delay - Are you using byte 'b' variables, or trying to use numbers greater than 65,535 ?

Also, have a read of Manual 2 regarding analogue inputs (READADC ) - The 08 only has a 16-step ADC converter and doesn't read the whole range of a pot.

If it's not something covered by a D'Oh! moment in hindsight - that is it is doing as it should, but not as had been expected - it will help if you can post the code you are currently using.
 
Last edited:

Technical

Technical Support
Staff member
This is completely normal behaviour with the 08 with its lower grade ADC function - see readadc description as Hippy suggests. Use an 08M chip instead for the behaviour you desire.
 

jrem

New Member
ok, got it working, I was trying to multiply b0 and stuff it into w0, my bad. Changed w0 to w1 and it works. Thanks . . .
 
Top