单片机入门代码库,流水灯

//LED点亮程序
/*
#include<STC15F2K60S2.H>

void main(void)
{
	P2=0XA0;P0=0X00;P2=0X80;P0=0XFF;
	
	P00=1;
	P01=0;
	p02=0;
	while(1);	 
}
*/

//LED闪烁程序
/*
#include<STC15F2K60S2.H>

unsigned int i;

void main(void)
{
	P2=0XA0;P0=0X00;P2=0X80;P0=0XFF;
	
  while(1) 
	{	
		P00=0;
		for(i=0;i<65535;i++);
		P00=1;
		for(i=0;i<65535;i++);	 
	}
}
*/
 //LED交替闪烁程序
 /*
#include<STC15F2K60S2.H>

unsigned int i;

void main(void)
{
	P2=0XA0;P0=0X00;P2=0X80;P0=0XFF;
	
  while(1) 
	{	
		P00=0;
		for(i=0;i<65535;i++);
		P00=1;
		P01=0;
		for(i=0;i<65535;i++);	 
		P01=1;
	}
}
*/
//简易流水灯程序
/*
#include<STC15F2K60S2.H>

unsigned int i;

void main(void)
{
	P2=0XA0;P0=0X00;P2=0X80;P0=0XFF;
	
  while(1) 
	{	
		P00=0;
		for(i=0;i<65535;i++);
		P00=1;
		P01=0;
		for(i=0;i<65535;i++);	 
		P01=1;
		P02=0;
		for(i=0;i<65535;i++);
		P02=1;
		P03=0;
		for(i=0;i<65535;i++);
		P03=1;
		P04=0;
		for(i=0;i<65535;i++);
		P04=1;
		P05=0;
		for(i=0;i<65535;i++);
		P05=1;
		P06=0;
		for(i=0;i<65535;i++);
		P06=1;
		P07=0;
		for(i=0;i<65535;i++);
		P07=1;
	}
}
*/
//
/*
#include<STC15F2K60S2.H>

unsigned int i;

void main(void)
{
	P2=0XA0;P0=0X00;P2=0X80;P0=0XFF;
	
  while(1) 
	{	
		P0=0XFE;
		for(i=0;i<65535;i++);
		P0=0XFD;
		for(i=0;i<65535;i++);	 
		P0=0XFB;
		for(i=0;i<65535;i++);
		P0=0XF7; 
		for(i=0;i<65535;i++);
		P0=0XEF;
		for(i=0;i<65535;i++);
		P0=0XDE;
		for(i=0;i<65535;i++);
		P0=0XBF;
		for(i=0;i<65535;i++);
		P0=0X7E;
		for(i=0;i<65535;i++);
		P0=0XFF;
		for(i=0;i<65535;i++);
	}
}
*/

//
/*
#include<STC15F2K60S2.H>

unsigned int i;

void Delayms(int ms);

void main(void)
{
	P2=0XA0;P0=0X00;P2=0X80;P0=0XFF;
	
  while(1) 
	{	
		P0=0XFE;
		Delayms(1000);
		P0=0XFD;
		Delayms(1000); 
		P0=0XFB;
		Delayms(1000);
		P0=0XF7; 
		Delayms(1000);
		P0=0XEF;
		Delayms(1000);
		P0=0XDE;
		Delayms(1000);
		P0=0XBF;
		Delayms(1000);
		P0=0X7E;
		Delayms(1000);
		P0=0XFF;
		Delayms(1000);
	}
}

void Delayms(int ms)
{
	int i,j;
	for(i=0;i<ms;i++);
	for(j=845;j>0;j--);
}

*/
//
/*
#include<STC15F2K60S2.H>

unsigned char LED;

void Delayms(int ms);

void main(void)
{
	P2=0XA0;P0=0X00;P2=0X80;P0=0XFF;
	
  while(1) 
	{	
	for(LED=0;LED<8:LED++)
		{
		P0=~(0X01<<LED);//	0000	0001 // 1111 1110 //	0000 0010
		D elayms(1000);
		}
	}
}
void Delayms(int ms)
{
	int i,j;
	for(i=0;i<ms;i++);
	for(j=845;j>0;j--);
}
*/

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

花开富贵xxxx

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值