基于51单片机心形流水灯c语言源程序,51单片机心形流水灯源程序

原理图我就不画了4个p口全部接上led灯即可,下面是控制程序:

#include

#include #define uint unsigned int

#define uchar unsigned char

uchar code table0[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};//P0-P7依次点亮

uchar code table1[]={0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff};//P0-P7依次熄灭

uchar code table2[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};//P7-P0依次点亮

uchar code table3[]={0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};//P7-P0依次熄灭

uchar temp,aa,bb,temp,temp1;

void delay(uint z);

void h();

void hh();

void hhh();

void hhhh();

void init();

void main()//主函数

{

init();

while(520)//大循环

{

h();

hh();

hhh();

hhhh();

}

}

void delay(uint z)//延时函数

{

uint x,y;

for(x=z;x>0;x--)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值