16f887 portc input problems


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2011
    Posts
    19

    Default 16f887 portc input problems

    Im having problems with my portc in this clock project. Portc is acting as if i had the button already pushed.portb had the same problem but it was fixed easy by switching the port to digital by using ANSELH=0. I dont know what portc is set to, analog or digital. I dont think you would need my code, but if you do just tell me and i will post it.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: 16f887 portc input problems

    Let me guess, you are using PORTC.1 and/or PORTC.2 ?? The comparator will need dealt with.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,576


    Did you find this post helpful? Yes | No

    Default Re: 16f887 portc input problems

    Hi Dave,
    This is a bit confusing, I thought that the comparator outputs was on RA4 and RA5 respectively. Looking at the device overview in the datasheet confirms this.

    However, in the PortC section, under PortC.1 and PortC.2, which I believe is where you looked, it says Capture input and Compare/PWM output for Comparator C1.This LOOKS like a typo to me and THINK what they really mean is Compare/PWM output for CCP1 which i think makes more sense.Is the comparator outputs multpiplexed between RA4/5 and RC1/2 and where do you select that?

    I've tried to see what could cause the OP's problem but I've failed to find anything on PortC that needs disabling in order to function as digital inputs. Weak pullups crossed my mind but there are none on PortC so that can't be it.

    /Henrik.

  4. #4
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: 16f887 portc input problems

    Quote Originally Posted by mackrackit View Post
    Let me guess, you are using PORTC.1 and/or PORTC.2 ?? The comparator will need dealt with.
    I am using portc.4,5,6 and 7

  5. #5
    Join Date
    Feb 2011
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: 16f887 portc input problems

    Quote Originally Posted by mackrackit View Post
    Let me guess, you are using PORTC.1 and/or PORTC.2 ?? The comparator will need dealt with.
    I just disabled c1 and c2 comparators and it dident change any thing.

  6. #6
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: 16f887 portc input problems

    Code:
    CLRF CCP1CON ;Turn CCP module off
    CLRF CCP2CON ;Turn CCP module off
    But those are supposed to be cleared on POR and those pins are not the question now.

    Looks like we need to see your code and schematic...
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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