Hey Geezer -
One example that really helped me learn what to look for and how to read the data sheet for the A/D modules is HERE. I realize it's not the same micro you're working with, but Bruce does point out some very important steps on how to set up the A/D module. I haven't worked with the Pic 18x's yet, so I'm not even going to try to code anything without testing it. All I can say, is get to know the data sheet. Just by taking a quick look, it saysADCON0 controlsThe module has five registers:
• A/D Result High Register (ADRESH)
• A/D Result Low Register (ADRESL)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
• A/D Control Register 2 (ADCON2)ADCON1
- turning on/off the ADC module
- starting the conversion
- indicating which channel to read
ADCON2 contains
- voltage reference configurations
- AD port configuration bits
ADRESH & ADRESL, of course hold the result from the A/D conversion. Chances are you'll have to do something with each one of these registers, depending on how you want to execute the A/D conversion. Sorry I don't have a cut & paste example for you, but maybe I've helped steer you in the right direction in figuring out the ADC module.
- the result format
- acquistion time selection
- the conversion clock selection
![]()
Bookmarks