7/30/2013

Hàm delay cho 8051 với thạch anh 12Mhz

Download Code Here

#include <REGX51.H>
#define led P0^0
void delay_us(unsigned int us)
{
while(us--)
{
unsigned int i=1000;
while(i--);
}
}

void delay_ms(unsigned int ms)
{
unsigned int x,y;
for(x=0;x<ms;x++)
for(y=0;y<=125;y++);
}
void main()
{
while(1)
{
delay_ms(1000);

}

}

1 comment:

  1. Trí tuệ của bạn thật được, thank bạn vừa chia sẻ.
    Xem thêm tại website: Vòng đeo đá thạch anh

    ReplyDelete