First PLEASE use the # sign to place
tags around you code like this.
Code:
#include<p18f4550.h>
void main ()
{
TRISC = 0xFF;//configure all pins of port C to be input
TRISD = 0x10111111; //configure pin6 of portD to be output
if(PORTCbits.RC1 == 1)
{
PORTDbits.RD6 = 1;
}
else
{
PORTDbits.RD6 = 0;
}
}
It is not enough to take the 5V away. The input pin needs to be grounded for it to read zero. Without 5V or GND the pin floats.
The most common way to do this is to use a switch and a pullup (or pulldown) resistor.
3v0