这个是用延时写的,你可以参考一下
#include<reg52.h>
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit LED = P1^0;
void delays(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
}
void main()
{
while(1)
{
LED = 0;
delay(1000);
LED = 1;
delay(1000);
}
} |