Log in

View Full Version : 16f887 portc input problems



lockjawz
- 30th March 2011, 14:02
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.

mackrackit
- 31st March 2011, 07:13
Let me guess, you are using PORTC.1 and/or PORTC.2 ?? The comparator will need dealt with.

HenrikOlsson
- 31st March 2011, 09:28
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.

lockjawz
- 31st March 2011, 12:52
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

lockjawz
- 31st March 2011, 13:12
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.

mackrackit
- 31st March 2011, 14:02
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...