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;

};

};

};

最新文章

  1. SEO:避免关键词内部竞争带来的无法收录问题,
  2. 解决h5的video标签,android、ipad客户端播放正常,iphone客户端无法播放
  3. System.Web.Caching.Cache类 缓存
  4. python进阶学习三——第四天
  5. Mac 系统下类似于 apt-get 的软件包管理器 -- Homebrew
  6. Android动画之translate(位移动画)
  7. php foreach的使用注意
  8. BILL.WEI]stimulsoft reports 中panel 妙用
  9. Java 泛型类型的一些限制
  10. 原生JS判断密码强弱
  11. Git学习之添加远程仓库
  12. 云笔记项目-MyBatis返回自增类型&堆栈对象补充理解
  13. findBugs安装
  14. CORS跨域
  15. Android 解决启动页白屏或者黑屏的问题
  16. Visual
  17. 爆破root密码hash John the Ripper和hydra爆破ssh密码
  18. vue练习
  19. Codeforces round 1106
  20. identityServer4 中的概念(Scope,claim)

热门文章

  1. 生物标记钙卫蛋白在RA诊疗中的应用研究
  2. .net 下SSE使用demo
  3. 红米手机LineageOS Root(实操)
  4. k8s-分布式系统架构master-worker
  5. 2、flex最后不对齐问题
  6. USACO2023Feb游记
  7. Day 24 24.2:逆向分析2 - 完美世界案例
  8. R Works with Google Earth Engine - Installation 【rgee - 安装问题解决集锦】
  9. Deer_GF之UI界面制作
  10. 【剑指Offer】【树】【双向链表】二叉搜索树与双向链表