标题: 嘀嗒时间的脚步如流水——蜂鸣器与流水灯的组合 [打印本页]

作者: nius    时间: 2015-4-10 03:19
标题: 嘀嗒时间的脚步如流水——蜂鸣器与流水灯的组合
#include<reg51.h>
#include<intrins.h>
#define xyh unsigned int
#define lq unsigned char
lq bf;
sbit  loving=P2^5;
void love (xyh);
void main()
{
P2=0;
P0=0;
bf=0xfd;
bf=1;
        while(1)
        {
P0=bf;
love(100);
bf=_crol_(bf,1);
loving=1;
love(100);
loving=0;
love(100);
        }
}
void love (xyh rich)
{
xyh she,he;
for(she=100;she>0;she--)
for(he=rich;he>0;he--);
}




蜂鸣器发声
流水灯左移
流水灯每左移一次蜂鸣器滴答一次

这都是薛yh的功劳







欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1