Home > other >  Why can't a matrix buttons with ai
Why can't a matrix buttons with ai

Time:09-26

#include
Char dizhi [20]={x5b x3f 0, 0 x06, 0, 0 x4f, 0 x66, 0 x6d
X07, 0 x7d, 0, 0 x7f, 0 x6f, 0 x77, 0 x7c, 0 x39, 0 x5e, 0 x79, 0 x71, 0 x00
};
Char xb.
Sbit LSA=P2 ^ 2;
Sbit LSB=P2 ^ 3;
Sbit LSC=P2 ^ 4;
Void delay (unsigned int a)
{
While (a -);
}

Void Keydonw ()
{
Char a;
P1=0 x0f;
If (P1!=0 x0f)
{
Delay (1000);
If (P1!=0 x0f)
{
P1=0 x0f;
The switch (P1) {
Case (0 x07) : xb=0; break;
Case (0 x0b) : xb=1; break;
Case (0 x0d) : xb=2; break;
Case (0 x0e) : xb=3; break; }
P1=0 xf0;
The switch (P1) {
Case: (0 x70) xb=xb; break;
Case (0 xb0) : xb=xb + 4; break;
Case (0 xd0) : xb=xb + 8; break;
Case: (0 xe0-0xfc) xb=xb + 12; break; }
While ((a<50) & amp; & (P1!=0 xf0))//inspection buttons let go
{
Delay (100);
a++;
}

}
}
}
Void main ()
{
LSA=0;
LSB=0;
LSC=0;
While (1)
{
Keydown ();
P0=~ dizhi (xb);
}

}

CodePudding user response:

Detect button press, you put the 0 x0f directly assigned to P1 P1 in the switch statement is always 0 x0f, you put the P1=0 x0f; Instead of P1=P1 & amp; 0 x0f; Try it and see

CodePudding user response:

Switch the sentence above

CodePudding user response:

reference 1/f * JIa reply:
detected button press enough, you have 0 x0f directly assigned to the P1 P1 in the switch statement is always 0 x0f, you put the P1=0 x0f; Instead of P1=P1 & amp; 0 x0f; Try to see

Yes, makes sense, I try another day
  • Related