PortC.7 general I/O output problem


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Jun 2011
    Posts
    26

    Default PortC.7 general I/O output problem

    I have a 16f887 PIC and I am using PortC for general output. If I toggle bits 0-7, only bits 0-6 are working. Bit 7 doesn't toggle as expected.

    I am thinking that it may have something to do with my configuration, as RC7 is used for RX for serial. Maybe I haven't disabled the serial connection properly?

    ADCON0 = 7 'Disable ADC
    ADCON1 = 7

    ANSEL=%00000000 'all analogue ports to digital
    ANSELH=%00000000 'all analogue ports to digital
    CM1CON0=%00000000 'disable COMPARATOR 1
    CM2CON0=%00000000 'disable COMPARATOR 2
    SSPCON=%00000000' disable SERIAL PORT
    RCSTA=%00000000 'disable SERIAL PORT
    PCON=%00000000 'disable BOR and ULPW
    OPTION_REG=%00000000 'disable INTERNAL PULLUPS
    WPUB=%00000000 'disable INDIVIDUAL PULLUPS
    IOCB=%00000000 'disable INTERRUPT ON CHANGE
    CCP1CON = 0 ' turn off CCP1 Module which affects portC
    CCP2CON = 0 ' turn off CCP2 Module which affects portC
    PSTRCON=%00000000 'disable PULSE STEERING MODE
    T1CON=%00000000 'disable TIMER1

    'All pins are outputs
    trisa = 0
    trisb = 0
    trisc = 0
    trisd = 0

    Any suggestions?

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: PortC.7 general I/O output problem

    From the datasheet...
    Note: When the SPEN bit is set the TX/CK I/O
    pin is automatically configured as an
    output, regardless of the state of the
    corresponding TRIS bit and whether or not
    the EUSART transmitter is enabled. The
    PORT latch is disconnected from the
    output driver so it is not possible to use the
    TX/CK pin as a general purpose output.
    You can't
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Jun 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: PortC.7 general I/O output problem

    I saw that, but I am talking about RC7, which is the RX pin.

    The RC6 Pin (TX) which you are talking about seems to work as a general I/O. I was wondering why the RC7 / RX Pin won't work.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: PortC.7 general I/O output problem

    Note 1: When the SPEN bit is set the RX/DT I/O pin
    is automatically configured as an input,
    regardless of the state of the corresponding
    TRIS bit and whether or not the EUSART
    receiver is enabled.
    The RX/DT pin data
    can be read via a normal PORT read but
    PORT latch data output is precluded.
    You can't if you're using HSEROUT
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: PortC.7 general I/O output problem

    Are you using hserout or hserin?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  6. #6
    Join Date
    Jun 2011
    Posts
    26


    Did you find this post helpful? Yes | No

    Default Re: PortC.7 general I/O output problem

    I am using neither hserout or hserin. I just want to use ports c.0 - c.7 for general output.

    Have I configured my pic incorrectly?

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts