16F88 RA5, RA6, RA7 problems - PBP

Discussion in 'Embedded Systems and Microcontrollers' started by tracecom, Dec 10, 2013.

  1. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    I am unable to set RA5, RA6, and RA7 as outputs on the 16F88. Although the datasheet doesn't make it perfectly clear, I assume that RA5 can only be an input. But what could be wrong with RA6 and RA7? I don't think it's the code or my wiring because I can successfully use all the other 13 I/Os as outputs. Is there some "trick" to using RA6 and RA7 as outputs in the 16F88?

    Thanks.
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,510
    2,369
    Did you set the outputs for digital I/O via tha ANSEL reg to turn off the analogue inputs?
    The RA5 is input only.
    Max.
     
  3. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    I think so. My initialization section when trying to use RA6 is as follows.

    TRISA = %10111111
    OSCCON = $60
    ANSEL = 0
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Have a look at the config word, oscillator options, because they can stop those pins being normal I/O.
     
  5. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    Correct. I just stumbled on the answer.

    #CONFIG
    __config _CONFIG1, _FOSC_INTOSCIO & _WDT_ON & _LVP_OFF & _CP_OFF

    #ENDCONFIG

    Thanks to you and Max.
     
  6. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Also Tracecom it's good to read the datasheet chapter "I/O ports" and sub chapter "PORTA" as it gives specific details of each port pin, and how that pin can be configured. :)
     
Loading...