为什么那个十位上的数字不能显示
#include<reg51.h>#define uchar unsigned charsbit L1=P1^0;sbit L2=P1^1;sbit L3=P1^2;sbit L4=P1^3;sbit LSA=P2^2;sbit LSB=P2^3;sbit LSC=P2^4;uchar tis[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};unsigned int time;delay(time){ unsigned int j; for(j=0;j<time;j++) {} }void main(){ uchar temp; uchar i,k=0,h=0,m; while(1) { P1=0xef; for(i=0;i<=3;i++) { if(L1==0) { k=i4+0; if(k<10) { LSA=0;LSB=1;LSC=1; P0=tis[k]; break; } else { LSA=1;LSB=1;LSC=1; P0=tis[2]; LSA=0;LSB=1;LSC=1; P0=tis[k-10]; } } if(L2==0) {k=i4+1; if(k<10) { LSA=0;LSB=1;LSC=1; P0=tis[k]; break; } else { LSA=1;LSB=1;LSC=1; P0=tis[2]; LSA=0;LSB=1;LSC=1; P0=tis[k-10]; } } if(L3==0) { k=i4+2; if(k<10) { LSA=0;LSB=1;LSC=1; P0=tis[k]; break; } else { LSA=1;LSB=1;LSC=1; P0=tis[2]; LSA=0;LSB=1;LSC=1; P0=tis[k-10]; } } if(L4==0) { k=i4+3; if(k<10) { LSA=0;LSB=1;LSC=1; P0=tis[k]; break; } else { LSA=1;LSB=1;LSC=1; P0=tis[2]; LSA=0;LSB=1;LSC=1; P0=tis[k-10]; } } delay(500); temp=P1; temp=temp|0x0f; temp=temp<<1; temp=temp|0x0f; P1=temp; } }}
51单片机显示矩阵按键的序号
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
悬赏问题
- ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
- ¥20 怎么用dlib库的算法识别小麦病虫害
- ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
- ¥15 java写代码遇到问题,求帮助
- ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
- ¥15 有了解d3和topogram.js库的吗?有偿请教
- ¥100 任意维数的K均值聚类
- ¥15 stamps做sbas-insar,时序沉降图怎么画
- ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
- ¥15 关于#Java#的问题,如何解决?