View previous topic :: View next topic |
Author |
Message |
andreahmed
Joined: 09 Dec 2020 Posts: 13
|
Select adc channel pic18f2458 |
Posted: Thu Dec 10, 2020 5:16 pm |
|
|
Hello,
I configured PIC18F2458 as analog input from A0 to A9 which is
Code: |
#define AN0_TO_AN9 0x05 // A0 A1 A2 A3 A5 B2 B3 |
How do I select channel B2, B3 ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 10, 2020 6:40 pm |
|
|
Your PIC doesn't support individual enables for the analog pins. You have
to select one of the preset groups. Look in the 18F2458.h file to see what
groups are available. If you just want two analog pins, you will have to
use AN0 and AN1. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Dec 11, 2020 9:18 am |
|
|
It is worth perhaps saying that the ability to enable individual channels
for the ADC is a feature that has appeared in later PIC's.
The PIC18F27J53, is pretty much pin compatible with the 2458, except
for losing pin 6 to Vddcore, and supports individual ADC channel enables.
It does lack EEPROM, but the virtual EEPROM driver can be used. Has a
lot more ROM and RAM, and is cheaper. So if you must use the high channels
for the ADC, consider if you could change to this chip. It also has much
more flexibility in the peripheral use (PPS), and draws less power. |
|
|
|