#include <reg52.h> #include <absacc.h> #define unit unsigned int #define uchar unsigned char
sbit L0=P2^0; sbit L1=P2^1; sbit L2=P2^2; sbit L3=P2^3;
void delays(void) { uchar i; for(i=300;i>1;i--); }
void main(void) { P2=0x0f; EA=1;IT0=1;EX0=1;
while(1) { delays(); if (keystate!=key) { L3=!L3; L2=!L2; L1=!L1; L0=!L0;
} }
}
void intersvr1(void) interrupt 2 using 1 { key=!key; }
运行提示keystate 和 key 没有定义,我搞不懂怎么弄,一本书上的,请前辈指点一下!感激!
|