Connect with us

using PORT A of 16f870

Discussion in 'Microcontrollers, Programming and IoT' started by gurjant.sandhu33, Mar 16, 2014.

Scroll to continue with content
  1. gurjant.sandhu33

    gurjant.sandhu33

    51
    0
    Dec 10, 2013
    how to use the adc port A of pic 16f870 as a normal port. like the port B and port C.
    is there any special code for it or just trisa=0xff is enough.
     
  2. BobK

    BobK

    7,682
    1,686
    Jan 5, 2010
    Did you try reading the datasheet?

    Bob
     
  3. kpatz

    kpatz

    313
    82
    Feb 24, 2014
    Look in the datasheet for how to initialize the ADCON0 and ADCON1 registers. From there you should be able to figure it out.
     
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,270
    Nov 28, 2011
    The use of RA0~3, RA5 and RE0~2 is controlled by the PCFG3~0 bits in ADCON1 according to a big table. The device only supports certain combinations, and those bit settings also determine where the ADC gets its positive and negative reference voltages from.

    Look through that table for a suitable combination of ADC and digital I/O functions and set those bits accordingly.
     
  5. gurjant.sandhu33

    gurjant.sandhu33

    51
    0
    Dec 10, 2013
    thank for your suggestions.
    i came to know that ADCON1 value must be 0x05 and my work will be complete.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-