Home > other >  # # disambiguation 51 microcontroller independent key code
# # disambiguation 51 microcontroller independent key code

Time:12-14

With which you can explain the meaning of this code is for how to run really didn't understand the logic relationship between
The first condition is the if backup [I]!=KeySta [I] the two arrays are assigned at the beginning doesn't it have been equal initial ah doesn't it just can't get into the if function inside the
Second if conditions backup [I]!=0 is right all the time so it how to detect the button is pressed in accordance with this should not always press the
Uchar pdata KeySta [4]={//four separate button current state
1, 1, 1, 1
};

Void KeyDriver ()
{
uint8 i;
Static uint8 pdata backup [4]={//four independent backup keys
1, 1, 1, 1
};
for (i=0; i<4. I++)//cycle detection of four separate button
{
If (backup [I]!=KeySta [I])//test keys
{
If (backup [I]!=0)//if the button press
{
KeyAction (KeyCodeMap [I]);//call buttons function
}
Backup [I]=KeySta [I];//refresh backup value
}
}
}
  • Related