alpha91
Full Member level 3
- Joined
- Sep 23, 2011
- Messages
- 168
- Helped
- 1
- Reputation
- 2
- Reaction score
- 2
- Trophy points
- 1,298
- Activity points
- 2,625
Hi all, i am using PIC 16f628a and testing with button trigger function. I wrote this code in C language but it didnt work as expected. My code is error free and i checked the input voltage of button and it has 5V supply.
Desired function is, when button is pressed, only one LED is blinking, when released, two LEDs should blinking.
Desired function is, when button is pressed, only one LED is blinking, when released, two LEDs should blinking.
void main() {
TRISA = 0b1111;
TRISB = 0b0000;
while (1)
{
if (PORTA.F0 = 1)
{
PORTB = 0b0001;
delay_ms(500);
PORTB = 0b0000;
delay_ms(500);
}
else {
PORTB = 0b1011;
delay_ms(500);
PORTB = 0b1000;
delay_ms(500);
}
}
}