I am still having problems with my program. If I don't tie my inputs to ground, my program wont run properly! The problem is that I'm trying to sense a ground or "low" condition at that pin and using internal pullups.
My basic circuit is as follows: I am running 4 LEDs off of PORTC through NPN transistors. I am also running a PWM output.
I have 3 digital inputs that read a switch state as on or off. Pins are tied to ground through a 10k resistor. Press switch 1 on input 1 and LED1 on output 1 goes on (input pin drivin to +5V when switch closed). Nothing fancy, very simple logic.
My problem lies when I enable an input that is normally "high" through the weak pullups. The program does not run at all. If I configure that pin as an output, program runs fine.... There is no routines in the code that reference that pin either! So I'm pretty sure it's not my code...
What am I missing!!!
Here is my configuration:
OSCCON = %01100001 '4 Mhz
INTCON = %00000000 'disable interrupts
PIE1 = %00000000
CMCON0 = %00000111
ANSEL = %00000000 ' all digital I/O
TRISA = %11111111 ' input pins
TRISC = %11011111 ' input pins except pwm port
IOCA = %00000000
T2CON = %00000100 ' enable timer 2 for PWM and set prescaler to 0
CCPR1L = %00000000 'zero duty cycle
CCP1CON = %00001100 'enable PWM, active high
PR2 = 24 '0-100 duty cycle
Bookmarks