Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //#include <stdlib.h> /
- #include <stdio.h>
- #define masyvo_x 16
- #define masyvo_y 16
- #define masyvo_a 48 //// ilgis masyvo
- #define a 1
- const short int greitis = 10;
- char *tekstas = "HELLO";
- const int sakinio_ilgis=5/*strlen(x)*/;
- short int abc1[][20][20]={
- {
- {0,0,0,1,1,0,0,0,2},
- {0,0,0,1,1,0,0,0},
- {0,0,1,0,0,1,0,0},
- {0,0,1,0,0,1,0,0},
- {0,0,1,0,0,1,0,0},
- {0,1,0,0,0,0,1,0},
- {0,1,1,1,1,1,1,0},
- {0,1,0,0,0,0,1,0},
- {1,0,0,0,0,0,0,1},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- }
- };
- short int test[20][20];
- const short int abc[][16][16]={
- {
- {0,0,0,1,1,0,0,0,2},
- {0,0,0,1,1,0,0,0},
- {0,0,1,0,0,1,0,0},
- {0,0,1,0,0,1,0,0},
- {0,0,1,0,0,1,0,0},
- {0,1,0,0,0,0,1,0},
- {0,1,1,1,1,1,1,0},
- {0,1,0,0,0,0,1,0},
- {1,0,0,0,0,0,0,1},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- },{
- {0,1,1,1,1,1,0,0,2},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,1,1,1,1,0,0},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,1,1,1,1,0,0},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- },{
- {0,0,0,1,1,1,0,0,2},
- {0,0,1,0,0,0,1,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,0,1,0,0,0,1,0},
- {0,0,0,1,1,1,0,0},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- },{
- {0,1,1,1,1,1,0,0,0,2},
- {0,1,0,0,0,0,1,0,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0,0},
- {0,1,1,1,1,1,0,0,0},
- {0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0}
- },{
- {0,1,1,1,1,1,1,0,2},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,1,1,1,1,1,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,1,1,1,1,1,0},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- },{
- {0,1,1,1,1,1,0,2},
- {0,1,0,0,0,0,0},
- {0,1,0,0,0,0,0},
- {0,1,0,0,0,0,0},
- {0,1,1,1,1,1,0},
- {0,1,0,0,0,0,0},
- {0,1,0,0,0,0,0},
- {0,1,0,0,0,0,0},
- {0,1,0,0,0,0,0},
- {0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0}
- },{
- {0,0,0,1,1,1,1,0,0,2},
- {0,0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0,0},
- {0,1,0,0,0,1,1,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,0,1,0,0,0,0,1,0},
- {0,0,0,1,1,1,1,0,0},
- {0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0}
- },{
- {0,1,0,0,0,0,0,1,0,2},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,1,1,1,1,1,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0}
- },{
- {0,1,0,2},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,0,0},
- {0,0,0}
- },{
- {0,1,0,2},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {0,1,0},
- {1,0,0}
- },{
- {0,1,0,0,0,0,1,2},
- {0,1,0,0,0,1,0},
- {0,1,0,0,1,0,0},
- {0,1,0,1,0,0,0},
- {0,1,1,0,0,0,0},
- {0,1,0,1,0,0,0},
- {0,1,0,0,1,0,0},
- {0,1,0,0,0,1,0},
- {0,1,0,0,0,0,1},
- {0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0}
- },{
- {0,1,0,0,0,0,2},
- {0,1,0,0,0,0},
- {0,1,0,0,0,0},
- {0,1,0,0,0,0},
- {0,1,0,0,0,0},
- {0,1,0,0,0,0},
- {0,1,0,0,0,0},
- {0,1,0,0,0,0},
- {0,1,1,1,1,1},
- {0,0,0,0,0,0},
- {0,0,0,0,0,0}
- },{
- {0,1,0,0,0,0,0,0,1,0,2},
- {0,1,1,0,0,0,0,1,1,0},
- {0,1,1,0,0,0,0,1,1,0},
- {0,1,0,1,0,0,1,0,1,0},
- {0,1,0,1,0,0,1,0,1,0},
- {0,1,0,0,1,1,0,0,1,0},
- {0,1,0,0,1,1,0,0,1,0},
- {0,1,0,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,0,1,0},
- {0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0}
- },{
- {0,1,1,0,0,0,0,1,0,2},
- {0,1,1,0,0,0,0,1,0},
- {0,1,0,1,0,0,0,1,0},
- {0,1,0,1,0,0,0,1,0},
- {0,1,0,0,1,0,0,1,0},
- {0,1,0,0,0,1,0,1,0},
- {0,1,0,0,0,1,0,1,0},
- {0,1,0,0,0,0,1,1,0},
- {0,1,0,0,0,0,1,1,0},
- {0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0}
- },{
- {0,0,0,1,1,1,0,0,0,2},
- {0,0,1,0,0,0,1,0,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,0,1,0,0,0,1,0,0},
- {0,0,0,1,1,1,0,0,0},
- {0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0}
- },{
- {0,1,1,1,1,1,0,0,2},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,1,1,1,1,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- },{
- {0,0,0,1,1,1,0,0,0,2},
- {0,0,1,0,0,0,1,0,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,0,1,0,0,0,1,0,0},
- {0,0,0,1,1,1,0,0,0},
- {0,0,0,0,0,1,0,0,0},
- {0,0,0,0,0,0,1,0,0}
- },{
- {0,1,1,1,1,1,0,0,2},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,1,1,1,1,0,0},
- {0,1,0,0,0,1,0,0},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- },{
- {0,0,1,1,1,1,0,0,2},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0},
- {0,0,1,1,1,1,0,0},
- {0,0,0,0,0,0,1,0},
- {0,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,0,1,1,1,1,0,0},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- },{
- {1,1,1,1,1,1,1,2},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0}
- },{
- {0,1,0,0,0,0,0,1,0,2},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,0,0,0,0,0,1,0},
- {0,1,1,0,0,0,1,1,0},
- {0,0,1,1,1,1,1,0,0},
- {0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0}
- },{
- {1,0,0,0,0,0,0,1,2},
- {1,0,0,0,0,0,0,1},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,1,0,0,0,0,1,0},
- {0,0,1,0,0,1,0,0},
- {0,0,1,0,0,1,0,0},
- {0,0,0,1,1,0,0,0},
- {0,0,0,1,1,0,0,0},
- {0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0}
- },{
- {1,0,0,0,0,1,0,0,0,0,1,2},
- {0,1,0,0,0,1,0,0,0,1,0},
- {0,1,0,0,0,1,0,0,0,1,0},
- {0,1,0,0,1,0,1,0,0,1,0},
- {0,0,1,0,1,0,1,0,1,0,0},
- {0,0,1,0,1,0,1,0,1,0,0},
- {0,0,1,0,1,0,1,0,1,0,0},
- {0,0,0,1,0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0,1,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0}
- },{
- {1,1,0,0,0,1,1,2},
- {0,1,0,0,0,1,0},
- {0,0,1,0,1,0,0},
- {0,0,1,0,1,0,0},
- {0,0,0,1,0,0,0},
- {0,0,1,0,1,0,0},
- {0,0,1,0,1,0,0},
- {0,1,0,0,0,1,0},
- {1,0,0,0,0,0,1},
- {0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0}
- },{
- {1,0,0,0,0,0,1,2},
- {0,1,0,0,0,1,0},
- {0,1,0,0,0,1,0},
- {0,0,1,0,1,0,0},
- {0,0,1,0,1,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,1,0,0,0},
- {0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0}
- },{
- {0,1,1,1,1,1,1,1,0,2},
- {0,0,0,0,0,0,0,1,0},
- {0,0,0,0,0,0,1,0,0},
- {0,0,0,0,0,1,0,0,0},
- {0,0,0,0,1,0,0,0,0},
- {0,0,0,1,0,0,0,0,0},
- {0,0,1,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0,0},
- {0,1,1,1,1,1,1,1,0},
- {0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0}
- }
- };
- short int ekranas[16][48];
- short int coped_array[1][16][16];
- //// short int paslinktas_masyvas[8][8];
- /// short int ekranass1[8][8];
- void paduoti_1()
- {
- LATa=0b00000001;
- LATa=0b00000011;
- // LATa=0b00000001;
- }
- void paduoti_0()
- {
- LATa=0b00000000;
- LATa=0b00000010;
- // LATa=0b00000000;
- }
- void clear()
- { int i,j;
- int ba=tekstas[0]-65;
- for(i=0;i<16;i++)
- {
- for(j=0;j<48;j++)
- {
- ekranas[i][j]=0;
- }
- }
- }
- void clear_coped_array()
- { int i,j;
- for(i=0;i<16;i++)
- {
- for(j=0;j<16;j++)
- {
- coped_array[0][i][j]=0;
- }
- }
- }
- void skenas(int indexas)
- { int p;
- for(p=0;p<16;p++)
- {
- if(p==indexas)
- {
- paduoti_0();
- }
- else
- {
- paduoti_1();
- }
- }
- }
- int count_lenght( short int arg[][16][16],int masyvo_raide)
- {int count=0;
- int i;
- for(i=0;i<16;i++)
- {
- if(arg[masyvo_raide][0][i]==2)
- {
- i=21;
- }
- else
- {
- count++;
- }
- }
- // printf("%d", count);
- // system("pause");
- return count;
- }
- void rodyti(short int arg[][masyvo_x][masyvo_y], int masyvo_raide, int x, int y )
- { int raides_ilgis=count_lenght(coped_array,0);
- int i;
- for(i=0;i<11/*reiktu kintamojo*/;i++)
- { int j;
- for(j=0;j<raides_ilgis;j++)
- {
- if(y<48&&x<16)
- {
- ekranas[x][y]=arg[masyvo_raide][i][j];
- }
- y++;
- }
- y=y-raides_ilgis;
- x++;
- }
- //atspausdinti(ekranas);
- //system("pause");
- }
- void uzdegti()
- { int i;
- int j;
- int m=0;
- for(i=0;i<16;i++)
- {
- for(j=47;j>-1;j--)
- {
- short int arrVal = ekranas[i][j];
- if(arrVal == 0)
- {
- paduoti_0();
- }
- else if(arrVal == 1)
- {
- paduoti_1();
- }
- }
- skenas(i);
- LATa=0b00000100;
- //delay_ms(50);
- }
- }
- void uzdegti_coped_array()
- { int i;
- int j;
- int m=0;
- for(i=0;i<16;i++)
- {
- for(j=47;j>-1;j--)
- {
- short int arrVal = coped_array[0][i][j];
- if(arrVal == 0)
- {
- paduoti_0();
- }
- else if(arrVal == 1)
- {
- paduoti_1();
- }
- }
- skenas(i);
- LATa=0b00000100;
- // delay_ms(1000);
- }
- }
- void copyArray(const short int romArray[16][16], short int ramArray[16][16]) {
- int sizeOfBytesToCopy = 20*20*sizeof(romArray);
- // memcpy(&ramArray, &romArray, sizeOfBytesToCopy);
- int i = 0, j = 0;
- for(i = 0; i < 16; i++) {
- for(j = 0; j < 16; j++) {
- ramArray[i][j] = romArray[i][j];
- }
- }
- }
- void animacija_kaire()
- {
- int belekas;
- int test=0;
- int raide=0;
- int vienas=1;
- int m;
- int j;
- int i;
- copyArray(abc[tekstas[raide]-65], coped_array);
- for(m=0;m<sakinio_ilgis*15;m++)
- {
- //int raides_ilgis=count_lenght(abc,x[raide]-65);
- int raides_ilgis_coped_arr=count_lenght(coped_array,0);
- int eilute=0;
- belekas=vienas%raides_ilgis_coped_arr;
- for(i=0;i<=15/*sakinio_ilgis*10*/;i++)
- {
- int stulpelis=0;
- for(j=0;j<=47;j++)
- {
- if(stulpelis-1!=-1)
- {
- ekranas[eilute][stulpelis-1]=ekranas[eilute][stulpelis]; // paslenkam per viena i kaire
- }
- // printf("stulpelis: %d \n", stulpelis);
- // printf("eilute: %d \n", eilute);
- // system("pause");
- // ekranas[eilute][stulpelis]=0; // isvalom sena reiksme
- stulpelis++;
- }
- eilute++;
- }
- if(raide<sakinio_ilgis)
- {
- rodyti(coped_array,0,4,47-test);
- }
- // delay_ms(20);
- // for(i=0;i<greitis;i++)
- // {
- uzdegti(); /// - vietoj animacija
- // }
- if(belekas==0&&m!=0)
- {
- raide++; //pridedam kita raide
- test=0; // dedam ja i gala
- belekas=1;
- vienas=1;
- copyArray(abc[tekstas[raide]-65], coped_array); // kopinam kita raide i masyva ram
- }
- vienas++;
- test++;
- // atspausdinti(ekranas);
- // system("pause");
- /*
- if(m==8)
- {raide++;
- test=0;
- }
- */
- }
- }
- short int test2[20][20];
- void setDiagonal(short int arr[20][20], int diagonalSize) {
- int i;
- for(i=0;i<diagonalSize;i++) {
- arr[i][i] = 1;
- }
- }
- /// const short int greitis=750;
- void main() {
- // int k;
- // int i;
- TRISA=0;
- // UCON = 0x00;
- ADCON1 = 0x0F;
- CMCON = 0x07;
- //
- clear();
- clear_coped_array();
- // copyArray(abc[0], coped_array);
- //setDiagonal(test2, 20);
- //copyArray(abc[tekstas[0]-65], coped_array);
- // coped_array[0][0][0]=1;
- // rodyti(coped_array,0,4,38);
- for(;;) {
- // uzdegti_coped_array();
- // uzdegti();
- animacija_kaire();
- }
- // for(;;)
- // {
- // animacija_kaire();
- // }
- /*
- for(;;)
- {
- //on_led(eilute_1);
- // uzdegti();
- clear();
- animacija_kaire();
- delay_ms(1000);
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement