Navigation

Tuesday 8 September 2020

Configure Analog pins in PIC Micro for Digital I/O

Sometimes, it is necessary to use analogue pins in the PIC micro- controller for Digital I/O. PORTA and TRISA registers of the PIC microcontroller are normally con gured for Analogue input function, to con gure them for digital output, rst set the TRISA register for output. To con gure for digital input, the TRISA register should be set for input.

Then the ADCON1 bit3-0 (PCFG3:PCFG0) should be set to 011X as indicated in Table 1. ADCON1 < 3 : 0 > are A/D Port Con figuration Control bits.

This is given by the following two lines of code: 


No comments:

Post a Comment