Hagjmgtpjm

#include <REGX51.H>

sfr led=0x90;

void delay( unsigned short );

void tat (void);

void nhay(void);

void main()

{

led=0;

while(1)

{

tat();

nhay();

}

}

void tat (void)

{

unsigned char i=0;

while(i<8)

{

if(i==0) led=0x80;

if(i==1) led=0x00;

if(i==2) led=0x80;

if(i==3) led=0x00;

if(i==4) led=0x80;

if(i==5) led=0x00;

if(i==6) led=0x80;

if(i==7) led=0x00;

i++;

delay(40000);

}

}

void nhay (void)

{

unsigned char i=0;

while(i<8)

{

if(i==0) led=0x80;

if(i==1) led=0x40;

if(i==2) led=0x20;

if(i==3) led=0x10;

if(i==4) led=0x08;

if(i==5) led=0x04;

if(i==6) led=0x02;

if(i==7) led=0x01;

i++;

delay(40000);

}

}

void delay(unsigned short d )

{

while(d>0) d--;

}

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: