Home > other >  Please help to comments under the code, how to realize the elevator floor scrolling to the buttons
Please help to comments under the code, how to realize the elevator floor scrolling to the buttons

Time:12-01

# include & lt; Reg51. H>
# include & lt; Intrins. H>
Unsigned char temp, key, keynum current_num, end_num, offset, t, x;
Void delay (int num)
{
Int m, n;
for(m=0; M & lt; Num. M++)
For (n=0; N & lt; 100; N++)
;
}
Unsigned char table []={
X99 x66 0 x00 to 0, 0, 0 x81, x42, 0 0 x24, 0 x18, 0 x00,//
X38 0 x08, 0 x18, 0, 0 x18, 0 x18, 0 x18, 0 x3c, 0 x00,//1
X46 x3c 0, 0 x7e, 0, 0 x0c, 0 x18, 0 x3e, 0 x7e, 0 x00,//2
X06 x3c 0, 0 x66, 0, 0 x3c, 0 x06, 0 x66, 0 x3c, 0 x00,//3
X1c 0 x0c, 0, 0 x3c, 0 x6c, 0 x7e, 0 x7e, 0 x0c, 0 x00,//4
X70 x7e 0, 0 x7e, 0, 0 x7c, 0 x06, 0 x7e, 0 x7e, 0 x00,//5
X7e 0 x3c, 0, 0 x60, 0 x7c, 0 x66, 0 x66, x3c 0, 0 x00,//6
X0c x7e 0, 0 x7e, 0, 0 x0c, 0 x18, 0 x18, 0 x18, 0 x00,//7
X66 x3c 0, 0 x66, 0, 0 x3c, 0 x66, 0 x66, 0 x3c, 8 0 x00,//
X66 x3c 0, 0 x66, 0, 0 x3e, 0 x06, 0 x7e, 0 x3c, 0 x00};//9
Unsigned char key_table []={
Xde 0 xee, 0, 0 xbe, 0 x7e,
XBD xed 0, 0 XDD, 0, 0 x7d,
0 xeb, 0 XDB, 0 XBB, 0 x7b,
Xb7 xe7 0, 0 xd7, 0, 0 x77};
Void display_t0 () interrupt 1
{
Int I, j;
TH0=- 4000/256;
TL0=256-4000%;
P1=0 xf0;
If (P1!=0 xf0)
{
//delay (100);
//if (P1!=0 xf0)
//{
Temp=p;
P1=0 x0f;
Key=temp | P1;
for(i=0; I & lt; 16. I++)
{
If (key==key_table [I])
{
Keynum=I;
break;
}
}
//}
}
The P2=_crol_ (P2), 1);
J=current_num * 8 + t + offset;
P0=~ table [j];
If (current_num & lt; Keynum)
{
If (+ + t==8)
{
T=0;
If (+ + x==4)
{
x=0;
If (+ + offset==8)
{
Offset=0;
Current_num + +;
End_num=current_num;
}
}
}
}

Else if (current_num & gt; Keynum)
{
If (+ + t==8)
{
T=0;
If (+ + x==4)
{
x=0;
If (- offset==8)
{
Offset=0;
Current_num -;
End_num=current_num;
}
}
}
}

The else
{
If (+ + t==8)
T=0;
}
}
Void main ()
{
TMOD=0 x01;
TH0=- 4000/256;
TL0=256-4000%;
TR0=1;
ET0=1;
EA=1;
EX0=1;
EX1=1;
IT0=1;
IT1=1;
PX0=1;
The P2=0 x80;
Keynum=1;
Current_num=1;
T=0;
x=0;
Led=1;
BEEP=1;
while(1);
}

CodePudding user response:

First of all thank you for the invitation, I'm sorry, but can explain their code, others do not understand,

CodePudding user response:

Give money can solve,

CodePudding user response:

P2 is why? After the hardware? _crol_ is why? Write the best part of comments or put the complete code and schematic diagram, or really don't understand
  • Related