1LED
程序停下来:
while(1)
{
}
延时子函数:(500ms为例)
///闪烁
#include<REGX52.H>
#include<INTRINS.H>
void Delay1ms(unsigned int xms)//子函数
{
unsigned char i,j;
/_nop_();//空语句,此处停一会
while(xms)
{
i=2;j=239;
do
{
while(--j);
}while(--i);
xms--;//
}
}
调用
Delay1ms(500); //任意毫秒