#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;
}
}
The code runs correctly. The problem is: when I input 5V into the pinC1, the pinD6 LED is on. And when I take 5V out from pinC1, the pinD6 LED continues to light for about 5 to 8 seconds(ideally it should turn off immediately). Could you please help me figure out the problem.
p/s I'm using PIC18F4550.
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;
}
}
The code runs correctly. The problem is: when I input 5V into the pinC1, the pinD6 LED is on. And when I take 5V out from pinC1, the pinD6 LED continues to light for about 5 to 8 seconds(ideally it should turn off immediately). Could you please help me figure out the problem.
p/s I'm using PIC18F4550.