Write a program to glow first 4 MSB of LED and then last 4 LSB of LED when an interrupt comes otherwise glow all 8 LEDs.


#include<8051.h>
void en_int();
void delay(unsigned int i);
void main()
{
P0=0x00;
INT0=1;
en_int();
while(1)
{
P0=0xff;
delay(0xffff);
P0=ox00;
delay(0xffff);
}
}
void en_int()
{
EA=1;
EX0=1;
}
void isr_intr() interrupt 0
{
P0=0xf0;
delay(0xffff);
P0=0x0f;
delay(0xffff);
}
void delay(unsigned int i)
{
while(i!=0)
{
i–;
}
}

Add Comment