void delayms(unsigned char ms) // 延轮誉时子程序
{
unsigned char i
while(ms--)
{
for(i = 0i <腊羡段 120i++)
}
}
main()
{
unsigned char LED
LED = 0xff
P0 = LED
while(1)
{
delayms(1000)
LED = LED<<1 //循环右移1位,点亮下一个派源LED
if(LED==0x00)
{
LED=0xff
}
P0 = LED
}
}
#include<reg52.h>sbit LED1=P2^0
//1ms延时程桥拿雹序敏帆敏则
void delayms(unsigned int i)
{ unsigned int j
while(i--)
{
for(j=0j<115j++)
}
}
void main()
{
LED1=0
while(1)
{
delayms(1000)
LED1=~LED1
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)