{ aa=ji; }
P2=aa;
delayms(500); aa=_crol_(aa,1); P0=bb;
bb=_cror_(bb,1);
//led4=0; //led13=0; } while(1) { }
} */
#include
#define uchar unsigned char //这个头文件是这个方法的核心,它包含了逐步移位函数功能
uchar code table1[]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80}; uchar code table2[]={0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01};
sbit key=P1^0; //定义按键输入口
uchar ji=0; uchar numt0=0;
void delay(unsigned int i) {
unsigned int j; unsigned char k; for(j=i;j>0;j--)
for(k=125;k>0;k--); }
void keyscan() {
if(key==0) {
21
delay(10); if(key==0) {
ji=ji+1; if(ji>6)ji=0; while(!key); } } }
void init() {
TMOD=0X01;
TH0=(65536-50000)/256; TL0=(65536-50000)%6; EA=1; ET0=1; TR0=1; }
void main() { init();
P2=table1[ji]; delay(1000); while(1) {
unsigned char m; keyscan(); P2=table1[ji];
delay(1000);
for(m=7-ji;m>0;m--) {
P2=_crol_(P2,1); //P1逐步左移一位。delay(1000); }
P2=0xff; P0=table2[ji]; delay(1000);
for(m=7-ji;m>0;m--) {
P0=_cror_(P0,1); //P1逐步左移一位。delay(1000);
22
}
P0=0xff; //ji=ji+1;
if(ji>7) ji=0; } }
void T0_time() interrupt 1 {
TH0=(65536-50000)/256; TL0=(65536-50000)%6; numt0++;
/*if(numt0==20) {
numt0=0; num++; if(num==61) num=1; }*/
keyscan();
} 裊樣祕廬廂颤谚鍘羋蔺。
23