独立按键驱动
//key.c #include <STC12C5A60S2.H> #include <key.h> bit READ_S1() { if(P35==1) return KEY_OFF; else return KEY_ON; } bit READ_S2() { if(P34==1) return KEY_OFF; else return KEY_ON; } bit READ_S3() { if(P33==1) return KEY_OFF; else return KEY_ON; } bit READ_S4() { if(P32==1) return KEY_OFF; else return KEY_ON; }
//key.h #define KEY_ON 0 #define KEY_OFF 1 bit READ_S1(); bit READ_S2(); bit READ_S3(); bit READ_S4();