|
- //#include <REG52.h>
- #include <STC/STC89C5xRC.H>
- void Delay(unsigned int i);
- #define DP P1 //DataPort
- unsigned char code RTL[9]={0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00};
- /**
- * 1111 1111 1111 1110 -- 0000 0000
- */
- unsigned char code LTR[9]={0xff,0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00};
- /**
- * 1111 1111 0111 1111 -- 0000 0000
- */
- unsigned char code L[2][5]={{0xff,0x7f,0x3f,0x1f,0x0f},{0x0f,0x8f,0xcf,0xef,0xff}};
- /**
- * 1111 1111 0111 1111 -- 0000 1111
- * 0000 1111 1000 1111 -- 1111 1111
- */
- unsigned char code R[2][5]={{0xff,0xfe,0xfc,0xf8,0xf0},{0xf0,0xf1,0xf3,0xf7,0xff}};
- /**
- * 1111 1111 1111 1110 -- 1111 0000
- * 1111 0000 1111 0001 -- 1111 1111
- */
- void main(){
- int i,j;
- while(1){
- for(i=0;i<=8;i++){
- DP=LTR[i];
- Delay(100);
- }
- //Delay(1000);
- for(i=8;i>=0;i--){
- DP=RTL[i];
- Delay(100);
- }
- //Delay(200);
-
- for(i=0;i<=8;i++){
- DP=RTL[i];
- Delay(100);
- }
- //Delay(1000);
- for(i=8;i>=0;i--){
- DP=LTR[i];
- Delay(100);
- }
- //Delay(200);
-
- for(j=0;j<2;j++){
- for(i=0;i<5;i++){
- DP=L[j][i]&R[j][i];
- Delay(100);
- }
- //Delay(200);
- }
- for(j=1;j>=0;j--){
- for(i=4;i>=0;i--){
- DP=L[j][i]&R[j][i];
- Delay(100);
- }
- //Delay(200);
- }
-
- DP=0x00;
- Delay(200);
- DP=0xff;
- Delay(100);
- DP=0x00;
- Delay(200);
- DP=0xff;
- Delay(100);
-
- }
- }
- void Delay(unsigned int i){
- unsigned int j;
- for(;i>0;i--)
- for(j=0;j<125;j++) ;
- }
復(fù)制代碼
|
|