PortC.7 general I/O output problem


Closed Thread
Results 1 to 13 of 13
  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?

  7. #7
    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

    I think NO! ADCON = 7 is the same as ADCON = %00000111. so you have enabled the a/d and turned it on. Please correct this and see if it helps. It looks like you DO have the serial disabled as you wanted to.
    -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!

  8. #8
    Join Date
    Jun 2011
    Posts
    26


    Did you find this post helpful? Yes | No

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

    Ok, I changed the ADCON0 and ADCON1 to 0, still have the same problem. Portc.0-portc.6 work fine, it is just the last pin portc.7 that doesn't seem to change no matter what I send to it.

  9. #9
    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

    I don't see any reason for it not to work. Maybe the circuit is bad? Breadboard or SIM? How do you know it is not working?
    -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!

  10. #10
    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

    [mondayRant]
    Please say SIM
    [/mondayRant]
    Steve

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

  11. #11
    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

    breadboard - breadboard - breadboard - breadboard

    Cmon Steve, say it with me.
    -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!

  12. #12
    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



    ----======----
    Steve

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

  13. #13
    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 one of those prototype boards with each individual hole plated so I can solder to it.

    I have sent my design to the PCB makers, should be here tomorrow so I will see if the problem still persists. Hopefully it is just a dodgy connection somewhere, I do have a lot of wires :-)

Members who have read this thread : 1

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