i am programming interrupt 0 using 8051
my task is.. explained in the circuit diagram as follows
when ever till the push button pressed the led should goes low which is connected at P2.1
but the problem i am facing is if long press the button the led toggles quickly and repeatedly... but i want that till the button is pressed the led should be off
here is my code
my task is.. explained in the circuit diagram as follows
when ever till the push button pressed the led should goes low which is connected at P2.1
but the problem i am facing is if long press the button the led toggles quickly and repeatedly... but i want that till the button is pressed the led should be off
here is my code
Code:
#include<reg51.h>
sbit a=P2^1; // for led
void ext(void) interrupt 0
{
a=0;
}
void main()
{
IE=0x81; // using external 0 interrupt
while(1)
{
a=1;
}
}
Attachments
-
19 KB Views: 33
Last edited by a moderator: