標(biāo)題:
簡單的C51流水燈源程序
[打印本頁]
作者:
小紅Silvia
時(shí)間:
2020-11-22 14:19
標(biāo)題:
簡單的C51流水燈源程序
#include "reg52.h"
#include "intrins.h"
#define uchar unsigned char
#define uint unsigned int
//延時(shí)函數(shù)
void delay(uint i)
{
uchar t;
while(i--)
{
for(t=0;t<120;t++);
}
}
//程序1 自上向下流水燈
/*
void main()
{
P1=0xfe;
while(1)
{
delay(500);
P1=_crol_(P1,1);
}
}
*/
//程序2 自下向上流水燈
/*
void main()
{
P1=0x7f;
while(1)
{
delay(500);
P1=_cror_(P1,1);
}
}
*/
//程序3 自上向下流水燈(兩個(gè))
/*
void main()
{
P1=0xfc;
while(1)
{
delay(500);
P1=_crol_(P1,2);
}
}
*/
//程序4 自下向上流水燈(兩個(gè))
/*
void main()
{
P1=0x3f;
while(1)
{
delay(500);
P1=_cror_(P1,2);
}
}
*/
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1