Problem in reading ADC on 28X2

dseverin

New Member
I saw this earlier and I have the same problem. I have voltmeter on the pins to confirm the attached hardware but all I read is 128 (80H) what have I missed?

#picaxe 28X2
'Have 4 pots on C.4 to C.7 which are ADC 16-19
main:
dirsC = %00000000
adcsetup2 = %00001111
more:
readadc 16,b0
readadc 17,b1
readadc 18,b2
readadc 19,b3
sertxd (#b0," ",#b1," ",#b2," ",#b3,13,10)
pause 1000
goto more
 

Aries

New Member
What does your voltmeter read (on the actual pins) and on the V+ pin of the Picaxe? Is there anything else connected to the pins? 128 is exactly half way, which is suspicious if there are potentiometers connected and not set at their mid-points. Also, is this a modern 28X2, or one of the 5V or 3V versions (which have other requirements for ADC pins - e.g. they have to be activated in order)?
 

dseverin

New Member
The chip is a PIC18F25K22-1/SP, purchased this year. I can vary the pots and see the voltage change at the actual pins. The V+ is 5 volt. I had used a similar program at another time successfully on a 40X2 chip. I'm about to change the chip to another.
 

inglewoodpete

Senior Member
The chip is a PIC18F25K22-1/SP, purchased this year. I can vary the pots and see the voltage change at the actual pins. The V+ is 5 volt. I had used a similar program at another time successfully on a 40X2 chip. I'm about to change the chip to another.
The command adcsetup2 has no impact on the outcome since the ReadADC command sets the related digital input bit (disables the related digital input buffer) upon execution.

Some photos of your circuit wiring may reveal more about what appears to be a hardware problem.
 

dseverin

New Member
Sorry - problem solved. Having used the Simulation for the first time (since using Picaxe from 2007) not realized that the data (128) was coming from the editable screen toolbar on the left/bottom of the screen and not from the hardware. I had usually used the debug command and a hardware LCD panel previously. Yes, you are correct inglewoodpete - the adcsetup2 had no bearing, can be left out.
 
Top