求解答ANJIAN.C(56): error C175: 0x7D: duplicate case value
时间:10-02
整理:3721RD
点击:
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit dula = P2^6;
sbit wela = P2^7;
uchar disnum,temp ,key;
uchar code table_du[]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,
0x7d,0x07,0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
delay(uchar x);
void main()
{
wela = 1;
P0 = 0xfe;
P3 = 0xf0;
while(1)
{
temp = P3;
temp=temp & 0xf0;
if(temp != 0xf0)
{
delay(10);
if(temp != 0xf0)
{
temp = P3;
temp = 0x0f | temp;
P3 = temp;
key = P3;
switch(key)
{
case 0xee: disnum =0;
break;
case 0xde: disnum =1;
break;
case 0xbe: disnum =2;
break;
case 0x7e: disnum =3;
break;
case 0xed: disnum =4;
break;
case 0xdd: disnum =5;
break;
case 0xbd: disnum =6;
break;
case 0x7d: disnum =7;
break;
case 0xeb: disnum =8;
break;
case 0xdb: disnum =9;
break;
case 0xbb: disnum = 10;
break;
case 0x7d: disnum = 11;
break;
case 0xe7: disnum =12;
break;
case 0xd7: disnum =13;
break;
case 0xb7: disnum =14;
break;
case 0x77: disnum =15;
break;
}
}
}
P0=table_du[disnum];
dula = 1;
dula = 0;
}
}
delay(uchar x)
{
uchar a,b;
for(a =x; a > 0; a--)
for(b=200; b > 0; b--)
{}
#define uchar unsigned char
#define uint unsigned int
sbit dula = P2^6;
sbit wela = P2^7;
uchar disnum,temp ,key;
uchar code table_du[]={
0x3f,0x06,0x5b,0x4f,0x66,0x6d,
0x7d,0x07,0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71};
delay(uchar x);
void main()
{
wela = 1;
P0 = 0xfe;
P3 = 0xf0;
while(1)
{
temp = P3;
temp=temp & 0xf0;
if(temp != 0xf0)
{
delay(10);
if(temp != 0xf0)
{
temp = P3;
temp = 0x0f | temp;
P3 = temp;
key = P3;
switch(key)
{
case 0xee: disnum =0;
break;
case 0xde: disnum =1;
break;
case 0xbe: disnum =2;
break;
case 0x7e: disnum =3;
break;
case 0xed: disnum =4;
break;
case 0xdd: disnum =5;
break;
case 0xbd: disnum =6;
break;
case 0x7d: disnum =7;
break;
case 0xeb: disnum =8;
break;
case 0xdb: disnum =9;
break;
case 0xbb: disnum = 10;
break;
case 0x7d: disnum = 11;
break;
case 0xe7: disnum =12;
break;
case 0xd7: disnum =13;
break;
case 0xb7: disnum =14;
break;
case 0x77: disnum =15;
break;
}
}
}
P0=table_du[disnum];
dula = 1;
dula = 0;
}
}
delay(uchar x)
{
uchar a,b;
for(a =x; a > 0; a--)
for(b=200; b > 0; b--)
{}
这里有解答
http://zhidao.baidu.com/link?url ... 3D0pa5H9_zdbpX3PHYK