找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

单片机LED数码管显示数字及左移程序Proteus仿真(独立按键)

查看数: 3056 | 评论数: 3 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2022-11-28 21:55

正文摘要:

单片机独立按键控制LED数码管显示数字及左移 仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)

回复

ID:1135525 发表于 2024-11-5 14:31
U2是什么元件
ID:1135525 发表于 2024-11-5 10:53
终于找到关于多个数码管动态显示的帖子了
ID:1134495 发表于 2024-11-2 23:48
请问使用矩阵键盘的话应该怎么改


// 矩阵键盘读取按键键码
unsigned char MatrixKey()
{
    unsigned char KeyNumber = 0;

    P1 = 0xFF;
    P1_3 = 0;
    if (P1_7 == 0) {Delay_ms(20); while (P1_7 == 0); Delay_ms(20); KeyNumber = 16;}
    if (P1_6 == 0) {Delay_ms(20); while (P1_6 == 0); Delay_ms(20); KeyNumber = 15;}
    if (P1_5 == 0) {Delay_ms(20); while (P1_5 == 0); Delay_ms(20); KeyNumber = 14;}
    if (P1_4 == 0) {Delay_ms(20); while (P1_4 == 0); Delay_ms(20); KeyNumber = 13;}

    P1 = 0xFF;
    P1_2 = 0;
    if (P1_7 == 0) {Delay_ms(20); while (P1_7 == 0); Delay_ms(20); KeyNumber = 12;}
    if (P1_6 == 0) {Delay_ms(20); while (P1_6 == 0); Delay_ms(20); KeyNumber = 11;}
    if (P1_5 == 0) {Delay_ms(20); while (P1_5 == 0); Delay_ms(20); KeyNumber = 10;}
    if (P1_4 == 0) {Delay_ms(20); while (P1_4 == 0); Delay_ms(20); KeyNumber = 9;}

    P1 = 0xFF;
    P1_1 = 0;
    if (P1_7 == 0) {Delay_ms(20); while (P1_7 == 0); Delay_ms(20); KeyNumber = 8;}
    if (P1_6 == 0) {Delay_ms(20); while (P1_6 == 0); Delay_ms(20); KeyNumber = 7;}
    if (P1_5 == 0) {Delay_ms(20); while (P1_5 == 0); Delay_ms(20); KeyNumber = 6;}
    if (P1_4 == 0) {Delay_ms(20); while (P1_4 == 0); Delay_ms(20); KeyNumber = 5;}

    P1 = 0xFF;
    P1_0 = 0;
    if (P1_7 == 0) {Delay_ms(20); while (P1_7 == 0); Delay_ms(20); KeyNumber = 4;}
    if (P1_6 == 0) {Delay_ms(20); while (P1_6 == 0); Delay_ms(20); KeyNumber = 3;}
    if (P1_5 == 0) {Delay_ms(20); while (P1_5 == 0); Delay_ms(20); KeyNumber = 2;}
    if (P1_4 == 0) {Delay_ms(20); while (P1_4 == 0); Delay_ms(20); KeyNumber = 1;}

    return KeyNumber;
}

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

Powered by 单片机教程网

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