You are on page 1of 1

#include <REGX51.

H>
void msdelay(unsigned int );
void main(){
P2=0x00; //all pin of PORT2 declared as output
//infinite loop
while(1){
P2=0xFF; //all pin high
msdelay(100); //delay
P2=0x00; //all pin low
msdelay(100); //delay
}
}
//delay function
void msdelay(unsigned int value){
unsigned int x,y;
for(x=0;x<value;x++)
for(y=0;y<1000;y++);
}

You might also like