Keil51单片机数码管鬼影显示问题
Keil51单片机数码管鬼影显示问题
所为的鬼影就是程序逻辑正确,但电路逻辑有问题。就是按程序逻辑,前一个数字显示后,直接显示下一组数字,因为没清干净,导致瞬间残留;
处理的办法,就是有就显示,没有就让数码管处于关闭状态。
while(1)
{
if (cnt >= 100)
{
cnt = 0; //time length control
Sec++; //1x1000ms=1 second
switch (j)
{
case 0:
{
if (Sec>9)
{
j++;
}
else
{
LedBuff[0] = LedChar[Sec%10]; //正常显示
LedBuff[1] = 0xFF; //关闭显示
LedBuff[2] = 0xFF; //关闭显示
LedBuff[3] = 0xFF; //关闭显示
LedBuff[4] = 0xFF; //关闭显示
LedBuff[5] = 0xFF; //关闭显示
};
};break;
case 1:
{
if (Sec>99)
{
j++;
}
else
{
LedBuff[0] = LedChar[Sec%10];
LedBuff[1] = LedChar[Sec/10%10];
LedBuff[2] = 0xFF;
LedBuff[3] = 0xFF;
LedBuff[4] = 0xFF;
LedBuff[5] = 0xFF;
};
};break;
case 2:
{
if (Sec>999)
{
j++;
}
else
{
LedBuff[0] = LedChar[Sec%10];
LedBuff[1] = LedChar[Sec/10%10];
LedBuff[2] = LedChar[Sec/100%10];
LedBuff[3] = 0xFF;
LedBuff[4] = 0xFF;
LedBuff[5] = 0xFF;
};
};break;
case 3:
{
if (Sec>9999)
{
j++;
}
else
{
LedBuff[0] = LedChar[Sec%10];
LedBuff[1] = LedChar[Sec/10%10];
LedBuff[2] = LedChar[Sec/100%10];
LedBuff[3] = LedChar[Sec/1000%10];
LedBuff[4] = 0xFF;
LedBuff[5] = 0xFF;
};
};break;
case 4:
{
if (Sec>99999)
{
j++;
}
else
{
LedBuff[0] = LedChar[Sec%10];
LedBuff[1] = LedChar[Sec/10%10];
LedBuff[2] = LedChar[Sec/100%10];
LedBuff[3] = LedChar[Sec/1000%10];
LedBuff[4] = LedChar[Sec/10000%10];
LedBuff[5] = 0xFF;
};
};break;
case 5:
{
if (Sec>999999)
{
j=0;
Sec = 0;
}
else
{
LedBuff[0] = LedChar[Sec%10];
LedBuff[1] = LedChar[Sec/10%10];
LedBuff[2] = LedChar[Sec/100%10];
LedBuff[3] = LedChar[Sec/1000%10];
LedBuff[4] = LedChar[Sec/10000%10];
LedBuff[5] = LedChar[Sec/100000%10];
};
};break;
default: break;
};
};
};
最新文章
- SEO:避免关键词内部竞争带来的无法收录问题,
- 解决h5的video标签,android、ipad客户端播放正常,iphone客户端无法播放
- System.Web.Caching.Cache类 缓存
- python进阶学习三——第四天
- Mac 系统下类似于 apt-get 的软件包管理器 -- Homebrew
- Android动画之translate(位移动画)
- php foreach的使用注意
- BILL.WEI]stimulsoft reports 中panel 妙用
- Java 泛型类型的一些限制
- 原生JS判断密码强弱
- Git学习之添加远程仓库
- 云笔记项目-MyBatis返回自增类型&;堆栈对象补充理解
- findBugs安装
- CORS跨域
- Android 解决启动页白屏或者黑屏的问题
- Visual
- 爆破root密码hash John the Ripper和hydra爆破ssh密码
- vue练习
- Codeforces round 1106
- identityServer4 中的概念(Scope,claim)