/***************显示英寸界面******************/
void led_page1(uchar p)
{
switch(p)
{
case 0: // 1/8寸
OE1=1;
cs=1;
OE2=0;
P1=0x3e;
P2=table[1];
delay(200);
cs=0;
P1=0x3d;
P2=0xff;
delay(200);
cs=1;
P1=0x3b;
P2=table[8];
delay(200);
OE1=1;
OE2=1;
delay(200);
P1=0x37;
P2=0xff;
delay(200);
OE1=1;
OE2=0;
delay(200);
P1=0x2f;
P2=sdz[0];
delay(200);
P1=0x1f;
P2=sdz[1];
delay(200);
OE1=1;
OE2=1;
break;
case 1: // 5/8 寸
OE1=1;
cs=1;
OE2=0;
P1=0x3e;
P2=table[5];
delay(200);
cs=0;
P1=0x3d;
P2=0xff;
delay(200);
cs=1;
P1=0x3b;
P2=table[8];
delay(200);
OE1=1;
OE2=1;
delay(200);
P1=0x37;
P2=0xff;
delay(200);
OE1=1;
OE2=0;
delay(200);
P1=0x2f;
P2=sdz[2];
delay(200);
P1=0x1f;
P2=sdz[3];
delay(200);
OE1=1;
OE2=1;
break;
case 2: // 1/2寸
OE1=1;
cs=1;
OE2=0;
P1=0x3e;
P2=table[1];
delay(200);
cs=0;
P1=0x3d;
P2=0xff;
delay(200);
cs=1;
P1=0x3b;
P2=table[2];
delay(200);
OE1=1;
OE2=1;
delay(200);
P1=0x37;
P2=0xff;
delay(200);
OE1=1;
OE2=0;
delay(200);
P1=0x2f;
P2=sdz[4];
delay(200);
P1=0x1f;
P2=sdz[5];
delay(200);
OE1=1;
OE2=1;
break;
case 3: // 3/8寸
OE1=1;
cs=1;
OE2=0;
P1=0x3e;
P2=table[3];
delay(200);
cs=0;
P1=0x3d;
P2=0xff;
delay(200);
cs=1;
P1=0x3b;
P2=table[8];
delay(200);
OE1=1;
OE2=1;
delay(200);
P1=0x37;
P2=0xff;
delay(200);
OE1=1;
OE2=0;
delay(200);
P1=0x2f;
P2=sdz[6];
delay(200);
P1=0x1f;
P2=sdz[7];
delay(200);
OE2=1;
OE1=1;
break;
case 4: // 5/16寸
OE1=1;
cs=1;
OE2=0;
P1=0x3e;
P2=table[5];
delay(200);
cs=0;
P1=0x3d;
P2=0xff;
delay(200);
cs=1;
P1=0x3b;
P2=table[1];
delay(200);
OE1=1;
OE2=1;
delay(200);
P1=0x37;
P2=table[6];
delay(200);
OE1=1;
OE2=0;
delay(200);
P1=0x2f;
P2=sdz[8];
delay(200);
P1=0x1f;
P2=sdz[9];
delay(200);
OE1=1;
OE2=1;
break;
case 5: // 1/4寸
OE1=1;
cs=1;
OE2=0;
P1=0x3e;
P2=table[1];
delay(200);
cs=0;
P1=0x3d;
P2=0xff;
delay(200);
cs=1;
P1=0x3b;
P2=table[4];
delay(200);
OE1=1;
OE2=1;
delay(200);
P1=0x37;
P2=0xff;
delay(200);
OE1=1;
OE2=0;
delay(200);
P1=0x2f;
P2=sdz[10];
delay(200);
P1=0x1f;
P2=sdz[11];
delay(200);
OE1=1;
OE2=1;
break;
case 6: // 3/16 寸
OE1=1;
cs=1;
OE2=0;
P1=0x3e;
P2=table[3];
delay(200);
cs=0;
P1=0x3d;
P2=0xff;
delay(200);
cs=1;
P1=0x3b;
P2=table[1];
delay(200);
OE1=1;
OE2=1;
delay(200);
P1=0x37;
P2=table[6];
delay(200);
OE1=1;
OE2=0;
delay(200);
P1=0x2f;
P2=sdz[12];
delay(200);
P1=0x1f;
P2=sdz[13];
delay(200);
OE1=1;
OE2=1;
break;
default : break;
}
}
/***************显示毫米界面******************/
void led_page2(uchar k)
{
switch(k)
{
case 0: // 16mm
delay(200);
OE1=1;
OE2=1;
P1=0x3e;
P2=0xff;
delay(200);
cs=1;
P1=0x3d;
P2=0xff;
delay(200);
cs=1;
delay(200);
OE1=1;
OE2=0;
P1=0x3b;
P2=table[1];
delay(200);
OE1=1;
OE2=0;
P1=0x37;
P2=table[6];
delay(200);
OE1=1;
OE2=0;
delay(200);
P1=0x2f;
P2=sdz[14];
delay(200);
P1=0x1f;
P2=sdz[15];
delay(200);
OE1=1;
OE2=1;
delay(200);
break;
case 1: // 14mm
OE1=1;
OE2=1;
P1=0x3e;
P2=0xff;
delay(20);
cs=1;
P1=0x3d;
P2=0xff;
delay(20);
cs=1;
delay(20);
OE1=1;
OE2=0;
P1=0x3b;
P2=table[1];
delay(20);
OE1=1;
OE2=0;
P1=0x37;
P2=table[4];
delay(20);
OE1=1;
OE2=0;
delay(20);
P1=0x2f;
P2=sdz[16];
delay(20);
delay(20);
P1=0x1f;
P2=sdz[17];
delay(20);
OE1=1;
OE2=1;
delay(20);
break;
case 2: // 12mm
OE1=1;
OE2=1;
P1=0x3e;
P2=0xff;
delay(20);
cs=1;
P1=0x3d;
P2=0xff;
delay(20);
cs=1;
delay(20);
OE1=1;
OE2=0;
P1=0x3b;
P2=table[1];
delay(20);
OE1=1;
OE2=0;
P1=0x37;
P2=table[2];
delay(20);
OE1=1;
OE2=0;
delay(20);
P1=0x2f;
P2=sdz[18];
delay(20);
delay(20);
P1=0x1f;
P2=sdz[19];
delay(20);
OE1=1;
OE2=1;
delay(20);
break;
case 3: // 10mm
delay(20);
OE1=1;
OE2=1;
P1=0x3e;
P2=0xff;
delay(20);
cs=1;
P1=0x3d;
P2=0xff;
delay(20);
cs=1;
delay(20);
OE1=1;
OE2=0;
P1=0x3b;
P2=table[1];
delay(20);
OE1=1;
OE2=0;
P1=0x37;
P2=table[0];
delay(20);
OE1=1;
OE2=0;
delay(20);
P1=0x2f;
P2=sdz[20];
delay(20);
delay(20);
P1=0x1f;
P2=sdz[21];
delay(20);
OE1=1;
OE2=1;
delay(20);
break;
case 4: // 8mm
OE1=1;
OE2=1;
P1=0x3e;
P2=0xff;
delay(20);
cs=1;
P1=0x3d;
P2=0xff;
delay(20);
cs=1;
delay(20);
P1=0x3b;
P2=0xff;
delay(20);
OE1=1;
OE2=0;
P1=0x37;
P2=table[8];
delay(20);
OE1=1;
OE2=0;
delay(20);
P1=0x2f;
P2=sdz[22];
delay(20);
delay(20);
P1=0x1f;
P2=sdz[23];
delay(20);
OE1=1;
OE2=1;
delay(20);
break;
case 5: // 6mm
OE1=1;
OE2=1;
P1=0x3e;
P2=0xff;
delay(20);
cs=1;
P1=0x3d;
P2=0xff;
delay(20);
cs=1;
delay(20);
P1=0x3b;
P2=0xff;
delay(20);
OE1=1;
OE2=0;
P1=0x37;
P2=table[6];
delay(20);
OE1=1;
OE2=0;
delay(20);
P1=0x2f;
P2=sdz[24];
delay(20);
delay(20);
P1=0x1f;
P2=sdz[25];
delay(20);
OE1=1;
OE2=1;
delay(20);
break;
case 6: // 4mm
delay(20);
OE1=1;
OE2=1;
P1=0x3e;
P2=0xff;
delay(20);
cs=1;
P1=0x3d;
P2=0xff;
delay(20);
cs=1;
delay(20);
P1=0x3b;
P2=0xff;
delay(20);
OE1=1;
OE2=0;
P1=0x37;
P2=table[4];
delay(20);
OE1=1;
OE2=0;
delay(20);
P1=0x2f;
P2=sdz[26];
delay(20);
delay(20);
P1=0x1f;
P2=sdz[27];
delay(20);
OE1=1;
OE2=1;
delay(20);
break;
case 7: // 3mm
delay(20);
OE1=1;
OE2=1;
P1=0x3e;
P2=0xff;
delay(20);
cs=1;
P1=0x3d;
P2=0xff;
delay(20);
cs=1;
delay(20);
P1=0x3b;
P2=0xff;
delay(20);
P1=0x37;
P2=table[3];
delay(20);
OE1=1;
OE2=0;
delay(20);
P1=0x2f;
P2=sdz[28];
delay(20);
P1=0x1f;
P2=sdz[29];
delay(20);
OE1=1;
OE2=1;
delay(20);
break;
default :break;
}
}
void change_p()
{
if(!bz_e)
{
if(bz_p == 1)
{
led_page1(0);
sdz[0]=sdz[31];
sdz[1]=sdz[32];
}
if(bz_p == 2)
{
led_page1(1);
sdz[2]=sdz[31];
sdz[3]=sdz[32];
}
if(bz_p == 3)
{
led_page1(2);
sdz[4]=sdz[31];
sdz[5]=sdz[32];
}
if(bz_p == 4)
{
led_page1(3);
sdz[6]=sdz[31];
sdz[7]=sdz[32];
}
if(bz_p == 5)
{
led_page1(4);
sdz[8]=sdz[31];
sdz[9]=sdz[32];
}
if(bz_p == 6)
{
led_page1(5);
sdz[10]=sdz[31];
sdz[11]=sdz[32];
}
if(bz_p == 7)
{
led_page1(6);
sdz[12]=sdz[31];
sdz[13]=sdz[32];
}
}
else
{
if(bz_p == 1)
{
led_page2(0);
sdz[14]=sdz[31];
sdz[15]=sdz[32];
}
if(bz_p == 2)
{
led_page2(1);
sdz[16]=sdz[31];
sdz[17]=sdz[32];
}
if(bz_p == 3)
{
led_page2(2);
sdz[18]=sdz[31];
sdz[19]=sdz[32];
}
if(bz_p == 4)
{
led_page2(3);
sdz[20]=sdz[31];
sdz[21]=sdz[32];
}
if(bz_p == 5)
{
led_page2(4);
sdz[22]=sdz[31];
sdz[23]=sdz[32];
}
if(bz_p == 6)
{
led_page2(5);
sdz[24]=sdz[31];
sdz[25]=sdz[32];
}
if(bz_p == 7)
{
led_page2(6);
sdz[26]=sdz[31];
sdz[27]=sdz[32];
}
if(bz_p == 8)
{
led_page2(7);
sdz[28]=sdz[31];
sdz[29]=sdz[32];
}
}
}
void d_s_min()
{
if(!bz_e)
{
if(bz_p==1)
{
s_min= sdz[0];
Write24c02(s_min,0x01);
}
if(bz_p==2)
{
s_min= sdz[2];
Write24c02(s_min,0x03);
}
if(bz_p==3)
{
s_min= sdz[4];
Write24c02(s_min,0x05);
}
if(bz_p==4)
{
s_min= sdz[6];
Write24c02(s_min,0x07);
}
if(bz_p==5)
{
s_min= sdz[8];
Write24c02(s_min,0x09);
}
if(bz_p==6)
{
s_min= sdz[10];
Write24c02(s_min,0x0b);
}
if(bz_p==7)
{
s_min= sdz[12];
Write24c02(s_min,0x0d);
}
}
else
{
if(bz_p==1)
{
s_min= sdz[14];
Write24c02(s_min,0x10);
}
if(bz_p==2)
{
s_min= sdz[16];
Write24c02(s_min,0x12);
}
if(bz_p==3)
{
s_min= sdz[18];
Write24c02(s_min,0x14);
}
if(bz_p==4)
{
s_min= sdz[20];
Write24c02(s_min,0x16);
}
if(bz_p==5)
{
s_min= sdz[22];
Write24c02(s_min,0x18);
}
if(bz_p==6)
{
s_min= sdz[24];
Write24c02(s_min,0x20);
}
if(bz_p==7)
{
s_min= sdz[26];
Write24c02(s_min,0x22);
}
if(bz_p==8)
{
s_min= sdz[28];
Write24c02(s_min,0x24);
}
if(bz_p==9)
{
s_min= sdz[30];
Write24c02(s_min,0x26);
}
}
}
void d_s_sec()
{
if(!bz_e)
{
if(bz_p==1)
{
s_sec= sdz[1];
Write24c02(s_sec,0x02);
}
if(bz_p==2)
{
s_sec= sdz[3];
Write24c02(s_sec,0x04);
}
if(bz_p==3)
{
s_sec= sdz[5];
Write24c02(s_sec,0x06);
}
if(bz_p==4)
{
s_sec= sdz[7];
Write24c02(s_sec,0x08);
}
if(bz_p==5)
{
s_sec= sdz[9];
Write24c02(s_sec,0x0a);
}
if(bz_p==6)
{
s_sec= sdz[11];
Write24c02(s_sec,0x0c);
}
if(bz_p==7)
{
s_sec= sdz[13];
Write24c02(s_sec,0x0e);
}
}
else
{
if(bz_p==1)
{
s_sec= sdz[15];
Write24c02(s_sec,0x11);
}
if(bz_p==2)
{
s_sec= sdz[17];
Write24c02(s_sec,0x13);
}
if(bz_p==3)
{
s_sec= sdz[19];
Write24c02(s_sec,0x15);
}
if(bz_p==4)
{
s_sec= sdz[21];
Write24c02(s_sec,0x17);
}
if(bz_p==5)
{
s_sec= sdz[23];
Write24c02(s_sec,0x19);
}
if(bz_p==6)
{
s_sec= sdz[25];
Write24c02(s_sec,0x21);
}
if(bz_p==7)
{
s_sec= sdz[27];
Write24c02(s_sec,0x23);
}
if(bz_p==8)
{
s_sec= sdz[29];
Write24c02(s_sec,0x25);
}
}
用什么方法将毫米与英寸两个界面区分开。我是一个区分按键 ,有上,下翻键
|