找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1769|回复: 0
打印 上一主题 下一主题
收起左侧

单片机显示数字1-8 电路图+源程序

[复制链接]
跳转到指定楼层
楼主
#include <reg51.h>
#include <intrins.h>
unsigned char code dis_code[11]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90, 0xff};
void delay(unsigned int x)
{
unsigned char i;
while(x--)
{
for(i=0;i<120;i++);
}
}


void main()
{
unsigned char k,m=0x80;
P0 = 0xff;
P2 = 0x00;

while(1)
{
for(k = 0;k < 8;k++)
{
P2 = 0x00;
m=_crol_(m,1);
P2=m;
P0=dis_code[k+1];
delay(2);
}
}
}



51hei图片20191112210938.png (58.22 KB, 下载次数: 21)

仿真图

仿真图
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表