sumonpic10
Newbie level 5
hello everyone..i have a problem on my project..with pic16f877 microcontroller. My project is a 2 button mode led blinking ..Hope someone could help me..the problem is
when I press the 1st button it working such code.
but when I press the 2nd button it's not working such the code. which I programming in 2nd condition......it's only read 2 line of my code
when I press the 1st button it working such code.
but when I press the 2nd button it's not working such the code. which I programming in 2nd condition......it's only read 2 line of my code
Code:
( PORTB=0x00; // PORTB all low
PORTB=0x0f; // PORTB 0b00001111 High)
this 2 line.................................
below my code..........................
void main()
{
TRISC=0xff; // PORTC as input
TRISB=0; // PORTB as output
PORTC=0xff;
PORTB=0;
while(1)
{
if(PORTC.f4==0) // when press RC4 button
{
PORTB=0xff; //PORTB all high
Delay_ms(500); // Delay time
PORTB=0x00; // all low
Delay_ms(500); // Delay time
}
else if(PORTC.f5==0) // when press RC5 button
{
PORTB=0x00; // PORTB all low
PORTB=0x0f; // PORTB 0b00001111 High
Delay_ms(500); // Delay time
PORTB=0x0f; // PORTB 0b11110000 high
Delay_ms(500); // Delay time
}
else // no press any button
{
PORTB=0x00; // output all low
}
}
}
Last edited by a moderator: