ADC channel numbers

amdunn

New Member
I am unable to find a proper reference for ADC channel numbers on M2 parts. Most of the pinout diagrams simply list the various ADC-capable channels as "ADC" and there is no indication of which channel number is mapped to which pin.

By experimentation I was able to determine, for instance, on an 18M2+ that C.0 is ADC channel 0. But short of experimenting with every pin, is there an actual reference for this? It's not in the manual, and it's not in the product pinouts.
 

eclectic

Moderator
I am unable to find a proper reference for ADC channel numbers on M2 parts. Most of the pinout diagrams simply list the various ADC-capable channels as "ADC" and there is no indication of which channel number is mapped to which pin.

By experimentation I was able to determine, for instance, on an 18M2+ that C.0 is ADC channel 0. But short of experimenting with every pin, is there an actual reference for this? It's not in the manual, and it's not in the product pinouts.
Might this help?


https://picaxe.com/basic-commands/advanced-picaxe-configuration/adcsetup/
 

amdunn

New Member
I still don't see where that adcsetup reference actually indicates the ADC channel to pin mapping for an M2 part.
 

AllyCat

Senior Member
Hi,

On all M2 devices, the ADC "channel" number is simply the Port.Pin number (which the compiler always reduces to a simple number between 0 and 15). I think it's all described lower in the Command Reference.

Cheers, Alan.
 

amdunn

New Member
Ah, I see. There's some confusion as the code example for readadc references the channel number (an integer) not the port number like C.0 :

main: readadc 0,b1
 

erco

Senior Member
Refer to the pinouts (and/or the Wizards in the Programming Editor (are you using PE5 or PE6?)) to see which pins have ADC capability. 18M2 pinout attached.
 

Attachments

amdunn

New Member
I'm using command line compiler on Linux so no PE or wizards at all. And yes I get which pins have capability... it was more a question of converting pin numbers to ADC channel numbers as the readadc example used the channel number. But if the compiler will auto convert then that isn't an issue.
 

Technical

Technical Support
Staff member
The historical answer is channel numbers often confused people, so we now recommend that you use the port.pin label and let the compiler sort out the rest!
 

lbenson

Senior Member
Related, is there an ADC15 on the 40X2?
By the order of the numbers, it would seem likely to have been C.3 if that weren't assigned as ADC4.

This breaks the simulator--have to use Task Manager to terminate PE6:
Code:
b0=15
readadc b0,b1
sertxd(#b1)
This simulates ok, giving a reading that has been changed for C.3 in the Values pane:
Code:
b0=4
readadc b0,b1
sertxd(#b1)
There's no ADC channel 15 in that Values pane.
 

erco

Senior Member
Thanks for your sleuthing, lbenson.

PE5 doesn't bat an eye, FYI. Simulates just fine and ADC15 shows up.

Hippy?

Technical?

40X2b.png
 
Top