先实现一个功能吧,按K1数码管显示加1,LED灯左移一位。
#include
#include
#define uchar unsigned char
uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};//共阳级数码管码表0-9
uchar key;
void ext0() interrupt 0
{
key++;
P1=_crol_(0xfe,key);
P0=table[key];
}
main()
{
EX0=1;
IT0=1;
EA=1;
while(1);
}