#include<reg51.h>
void delay(void)
void main(void)
{
unsigned char i,j,value,flag,a[2];
unsigned char r0[4]={0xEE,0xDE,0xBE,0x7E};
unsigned char r1[4]={0xED,0xDD,0xBD,0x7D};
unsigned char r2[4]={0xEB,0xDB,0xBB,0x7B};
unsigned char r3[4]={0xE7,0xD7,0xB7,0x77};
j=0;
a[0]=0;
a[1]=0;
while(1)
{
P0=0xFE;
delay();
value=P0;
for(i=0;i<4;i++)
{
if(value==r0[i])
{
flag=i+1;
delay();
}
}
P0=0xFD;
delay();
value=P0;
for(i=0;i<4;i++)
{
if(value==r1[i])
{
P2=i;
a[j]=P2;
j=j+1;
delay();
}
}
P0=0xFB;
value=P0;
for(i=0;i<4;i++)
{
if(value==r2[i])
{
P2=i+4;
a[j]=P2;
j=j+1;
delay();
}
}
P0=0xF7;
value=P0;
for(i=0;i<12;i++)
{
if(value==r3[i])
{
P2=i+8;
a[j]=P2;
j=j+1;
delay();
}
}
if (flag==1)
P2=a[0]+a[1];
else if(flag==2)
P2=a[0]-a[1];
else if(flag==3)
P2=a[0]*a[1];
else if(flag==4)
P2=a[0]/a[1];
else
P2=P2;
}
}
void delay(void)
{
unsigned int i;
for(i=0;i<20000;i++);
}
void delay(void)
void main(void)
{
unsigned char i,j,value,flag,a[2];
unsigned char r0[4]={0xEE,0xDE,0xBE,0x7E};
unsigned char r1[4]={0xED,0xDD,0xBD,0x7D};
unsigned char r2[4]={0xEB,0xDB,0xBB,0x7B};
unsigned char r3[4]={0xE7,0xD7,0xB7,0x77};
j=0;
a[0]=0;
a[1]=0;
while(1)
{
P0=0xFE;
delay();
value=P0;
for(i=0;i<4;i++)
{
if(value==r0[i])
{
flag=i+1;
delay();
}
}
P0=0xFD;
delay();
value=P0;
for(i=0;i<4;i++)
{
if(value==r1[i])
{
P2=i;
a[j]=P2;
j=j+1;
delay();
}
}
P0=0xFB;
value=P0;
for(i=0;i<4;i++)
{
if(value==r2[i])
{
P2=i+4;
a[j]=P2;
j=j+1;
delay();
}
}
P0=0xF7;
value=P0;
for(i=0;i<12;i++)
{
if(value==r3[i])
{
P2=i+8;
a[j]=P2;
j=j+1;
delay();
}
}
if (flag==1)
P2=a[0]+a[1];
else if(flag==2)
P2=a[0]-a[1];
else if(flag==3)
P2=a[0]*a[1];
else if(flag==4)
P2=a[0]/a[1];
else
P2=P2;
}
}
void delay(void)
{
unsigned int i;
for(i=0;i<20000;i++);
}