LED Switch Gone Bad (PIC16F687)
I made a short C code that I thought turn an LED on when i connected the input pin to VSS( 5V). However the LED is off ALL the time and will only turn off when i disconnect ground. Here is the code i made,
#include <xc.h>
#include <stdio.h>
#define _XTAL_FREQ 2000000
void main() {
TRISC = 0b00000010;
if(PORTCbits.RC0==1)
PORTCbits.RC1 = 1;
else if (PORTCbits.RC0==0)
PORTCbits.RC1 = 0;
Port RC1 is at 0V (Pin 15)
Port RC0 is at VDD when i want to turn it on (Pin 16)
VDD measured is at 5.03V ( Potentoimeter voltage divider)
VSS Measured is 0V (GND from Supply)
when i disconnect the ground, pins 11-20 except the pin 16 ( becasue VDD is connected to it) go to 3V.
can i get hints to help me solve the problem?