File size: 399 Bytes
bd8bc50 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #include <REG51.H>
sbit K1 = P3^0;
sbit K2 = P3^1;
sbit K3 = P3^2;
sbit K4 = P3^3;
void main(void)
{
P2 = 0xFF;
while (1)
{
if (K1 == 0)
P2 = 0xFE;
else if (K2 == 0)
P2 = 0xFC;
else if (K3 == 0)
P2 = 0xF8;
else if (K4 == 0)
P2 = 0xF0;
else
P2 = 0xFF;
}
}
|