I've been working with PIC16F877. Can someone please explain how to configure its pins to be analog or digital?
I saw somewhere that we need to configure ADCON1, but don't really understand how that works.
|
I've been working with PIC16F877. Can someone please explain how to configure its pins to be analog or digital? I saw somewhere that we need to configure |
|||||||||
|
|
See datasheet, Section 11.0 (Register 11-2), page 112. You select the operation of the pins by setting the four bits The power-on default of these bits is To configure all the AN-pins as digital, you set the |
|||
|
|
|
If you are just using the pins for output, they don't have to be configured as digital. That is only required for digital inputs. It's implied by all the data sheets, but a lot of people don't realise it. It is mentioned in the data sheets for the latest parts. |
|||||||
|