为什么那个十位上的数字不能显示
#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 提建议
- 关注问题
- 邀请回答
-