原理搞清楚了,那么下面我们就先编写一个独立按键的程序,把最基本的功能验证一下。#include <reg52.h>sbit ADDR0 = P1^0;sbit ADDR1 = P1^1;sbit ADDR2 = P1^2;sbit ADDR3 = P1^3;sbit ENLED = P1^4;sbit LED9 = P0^7;sbit LED8 = P0^6;sbit LED7 = P0^5;sbit LED6 = P0^4;sbit KEY1 = P2^4;sbit KEY2 = P2^5;sbit KEY3 = P2^6;sbit KEY4 = P2^7;