Bob Parihar
Member
iam new to PIC micro controller
i was doing an interfacing of button and led to the micro controller
objective is simple on pressing the button led should glow.. on releasing the button led should off
following is the program in Mikro C compiler
void main() {
TRISC.F0=0; // for making pin 0 of PORTC as output, for led
TRISC.F1=1; // for making pin 1 of PORTC as input for button
while(1)
{
PORTC.F0=0;
while(PORTC.F1==0)
{
PORTC.F0=1;
}
}
}
the problem here is led glows independent on the button... its not working please correct me
the same logic does work for 8051... but not here... why?
i was doing an interfacing of button and led to the micro controller
objective is simple on pressing the button led should glow.. on releasing the button led should off
following is the program in Mikro C compiler
void main() {
TRISC.F0=0; // for making pin 0 of PORTC as output, for led
TRISC.F1=1; // for making pin 1 of PORTC as input for button
while(1)
{
PORTC.F0=0;
while(PORTC.F1==0)
{
PORTC.F0=1;
}
}
}
the problem here is led glows independent on the button... its not working please correct me
the same logic does work for 8051... but not here... why?