c语言编写单片机案例——闪烁的LED

#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit LED = P1^0;

void DelayMS(uint x)
{
 	uchar i;
	while(x--)
	{
	 	for(i=120;i>0;i--);
	}
}

void main()
{
 	while(1)
	{
	 	LED = ~LED;
		DelayMS(150);
	}
}

仿真+源代码在https://download.csdn.net/download/qq_30787727/14927150

关注公号众陆小马获取更多

猜你喜欢

转载自blog.csdn.net/qq_30787727/article/details/113077013