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C,0xFF,0xFF,0xFF,0xFF}, {0xFF,0xFF,0xFF,0xF3,0x5F,0xFB,0xDF,0xFD,0xFF,0xED,0x0F,0x82,0xF3,0xEE,0x1B,0xFC, 0x7F,0xFF,0xFF,0xC0,0x03,0xFE,0xFF,0xFE,0xFF,0xFE,0xFF,0xFE,0x3F,0xFF,0xFF,0xFF}, {0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xC3,0xFD,0xEB,0xE1,0x6B,0xFE,0xAB,0xFB,0x4B,0xFC, 0xDB,0xF3,0x3B,0xFC,0xFB,0xFC,0x7B,0xFD,0xBB,0xDD,0xDB,0x83,0xFF,0xFF,0xFF,0xFF}, }; void Delay (unsigned char a) { unsigned char b,c; for (b=a;b>0;b--) for(c=110;c>0;c--); } void Input(unsigned char a) { unsigned char b; SCK=0; RCK=0; for (b=8;b>0;b--) { a=a<<1; SI=CY; SCK=1; SCK=0; } } void Display() { for (i=0,j=0;i<16;i++) { if(i<8) { Input(H_S[j]); Input(0x00); } else { Input(0x00); Input(H_S[j]); } j++; if(j==8) j=0; Input(dis1[2*i+1]); Input(dis1[2*i]); RCK=1; Delay(3); } } void Now_dis(unsigned char *p,unsigned char *p1) { unsigned char a; for (a=0;a<16;a++) { p[a*2]=p1[a*2]; p[a*2+1]=p1[a*2+1]; } } void V_Move(unsigned char e,unsigned char g,unsigned char *p1) { unsigned char a,b,c,d=0,f=31; for (a=0;a<16;a++) { if(g==1) { for (b=0;b<30;b++) dis1=dis1[b+2]; if(p1==0) { dis1[30]=0xff; dis1[31]=0xff; } else { dis1[30]=p1[d++]; dis1[31]=p1[d++]; } for (c=e;c>0;c--) Display(); } else { for (b=29;b>0;b--) dis1[b+2]=dis1; dis1[2]=dis1[0]; if(p1==0) { dis1[1]=0xff; dis1[0]=0xff; } else { dis1[1]=p1[f--]; dis1[0]=p1[f--]; } for (c=e;c>0;c--) Display(); } } } void RL_Move(unsigned chara,unsigned char b,unsigned char *p) { unsigned char i,j,k,c; for (i=0;i<16;i++) { if(p==0) { dis2[2*i]=0xff; dis2[2*i+1]=0xff; } else { dis2[2*i]=p[2*i]; dis2[2*i+1]=p[2*i+1]; } } if(b==1) for (k=0;k<16;k++) { for(i=0;i<16;i++) { dis1[i*2+1]=dis1[i*2+1]<<1; dis1[i*2]=dis1[i*2]<<1; if (CY==1) dis1[i*2+1]=dis1[i*2+1]|0x01; dis2[i*2+1]=dis2[i*2+1]<<1; if (CY==1) dis1[i*2]=dis1[i*2]|0x01; dis2[i*2]=dis2[i*2]<<1; if (CY==1) dis2[i*2+1]=dis2[i*2+1]|0x01; } for(j=a;j>0;j--) Display(); } else { for(k=0;k<16;k++) { for(i=0;i<16;i++) { dis1[i*2]=dis1[i*2]>>1; c=dis1[i*2+1]&0x01; dis1[i*2+1]=dis1[i*2+1]>>1; if(c) dis1[i*2]=dis1[i*2]|0x80; c=dis2[i*2]&0x01; dis2[i*2]=dis2[i*2]>>1; if(c) dis1[i*2+1]=dis1[i*2+1]|0x80; c=dis2[i*2+1]&0x01; dis2[i*2+1]=dis2[i*2+1]>>1; if(c) dis2[i*2]=dis2[i*2]|0x80; } for (j=a;j>0;j--) Display(); } } } void main () { while (1) { Now_dis(dis1,L_S[0]); V_Move(10,1,L_S[1]); V_Move(10,1,L_S[2]); V_Move(10,0,L_S[3]); V_Move(10,1,L_S[4]); V_Move(10,0,L_S[5]); V_Move(10,1,L_S[6]); V_Move(10,1,L_S[7]); V_Move(10,0,L_S[8]); V_Move(10,1,L_S[9]); V_Move(10,0,L_S[10]); V_Move(10,1,L_S[11]); V_Move(10,1,L_S[12]); V_Move(10,0,L_S[13]); } }
|