Page 1 sur 1

Problème de nombre de lignes de données sur UNO

Message non luPosté: Ven 11 Jan 2013 21:34
de hjojo
Bonjour a tous,

Voila mon soucis.....

J'ai réalisé une matrice 8x8 RVB qui fonctionne bien mais je me trouve confronté a un problème concernant le nombre de ligne de données pour l'affichage. En éffet je ne peux rentrer que 83 ligne de code pour l'affichage.

Quelqu’un peu t' il m'aiguiller car je sèche un peu surtout que je suis débutant

Voici le programme

Merci d'avance pour votre aide

Code: Tout sélectionner
int DataPin = 11; //shift input
int LatchPin = 10; //rstclk on shift
int ClockPin = 13; //srclk on shift
int clock = 9; //decade clk
int Reset = 8; //reset
int x;  //used in the for loop counter
int y;  //used in the for loop counter

unsigned char rain [][8][3] = {                                       
{{0,2,4},{32,0,0},{1,0,16},{0,0,0},{0,0,64},{2,0,0},{0,0,4},{8,0,0}},                             
{{4,0,32},{0,2,4},{32,0,1},{1,0,16},{0,0,0},{0,0,64},{2,0,0},{0,0,0}},                                 
{{0,2,0},{4,0,32},{0,2,4},{32,2,1},{1,0,16},{0,0,0},{0,0,64},{2,0,0}},                                 
{{8,0,0},{0,0,0},{4,0,32},{0,2,4},{32,0,1},{1,0,16},{0,0,0},{0,0,64}},                                 
{{0,0,0},{8,0,0},{0,0,0},{4,0,32},{0,2,4},{32,2,0},{1,0,16},{0,0,0}},                              
{{0,0,4},{8,0,0},{0,0,0},{4,0,32},{0,2,4},{32,8,0},{1,2,16},{0,2,0}},                                 
{{2,0,0},{0,0,4},{8,0,0},{0,0,0},{4,0,32},{0,2,4},{32,32,0},{0,0,16}},                                 
{{0,0,64},{2,0,0},{0,0,4},{8,0,0},{0,0,0},{4,0,32},{0,0,4},{0,6,0}},                                 
{{1,0,16},{0,0,64},{2,0,0},{0,0,4},{8,0,0},{0,0,0},{4,0,32},{0,0,0}},                                 
{{32,0,0},{1,0,16},{0,0,64},{2,0,0},{0,0,4},{8,0,0},{0,0,0},{4,0,32}},                                 
{{0,0,0},{32,0,0},{1,0,16},{0,0,64},{2,0,0},{0,0,4},{8,0,0},{0,0,0}}


};                                
 
 unsigned char KLT [][8][3] = {
 
{{126,2,241},{16,2,9},{16,2,5},{16,2,3},{16,2,5},{16,126,249},{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,0,0},{0,0,0}}

 };
 unsigned char KLT2 [][8][3] = {

{{7,254,32},{0,1,32},{0,228,160},{0,76,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,5,32},{0,224,160},{0,76,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,1,32},{0,224,160},{0,76,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,1,32},{0,228,160},{0,72,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,229,32},{0,0,160},{0,72,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,1,32},{0,0,160},{0,72,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,1,32},{0,72,160},{0,0,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,73,32},{0,0,160},{0,0,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,229,32},{0,0,160},{0,0,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{7,254,32},{0,1,32},{0,0,160},{0,0,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{0,0,0},{0,1,32},{0,0,160},{0,0,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{0,1,32},{0,0,0},{0,0,160},{0,0,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{0,0,0},{0,0,0},{0,0,160},{0,0,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{0,0,0},{0,0,160},{0,0,0},{0,0,96},{0,0,160},{7,255,32},{0,0,0},{0,0,0}},
{{0,0,160},{0,0,0},{0,0,0},{0,0,96},{0,0,160},{7,255,32},{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,0,0},{0,0,0}}

 };
 
unsigned char KLTS [][8][3] = {
{{68,0,0},{68,0,0},{68,0,0},{68,0,0},{68,0,0},{40,0,0},{16,0,0},{0,0,0}},
{{57,16,0},{69,16,0},{69,16,0},{69,16,0},{69,16,0},{68,160,0},{56,64,0},{0,0,0}},
{{0,228,64},{69,20,64},{69,20,64},{69,20,64},{69,20,64},{69,18,128},{56,225,0},{0,0,0}},
{{120,3,145},{5,20,81},{5,20,81},{57,20,81},{65,20,81},{65,20,74},{56,227,132},{0,0,0}},
{{1,228,78},{0,20,81},{0,20,81},{0,228,81},{1,4,81},{1,4,81},{0,227,142},{0,0,0}},
{{0,7,145},{0,0,81},{0,0,81},{0,3,145},{0,4,17},{0,4,17},{0,3,206},{0,0,0}},
{{0,0,30},{0,0,1},{0,0,1},{0,0,14},{0,0,16},{0,0,16},{0,0,15},{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,0,0}}
};
unsigned char KLTE [][8][3] = {
{{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255},{255,255,255}},
{{127,255,254},{127,255,254},{127,255,254},{127,255,254},{127,255,254},{127,255,254},{127,255,254},{127,255,254}},
{{63,255,252},{63,255,252},{63,255,252},{63,255,252},{63,255,252},{63,255,252},{63,255,252},{63,255,252}},
{{31,255,248},{31,255,248},{31,255,248},{31,255,248},{31,255,248},{31,255,248},{31,255,248},{31,255,248}},
{{31,255,240},{31,255,240},{31,255,240},{31,255,240},{31,255,240},{31,255,240},{31,255,240},{31,255,240}},
{{31,254,16},{31,255,16},{31,255,144},{31,255,208},{31,255,240},{31,255,208},{31,255,144},{31,255,16}},
{{31,254,16},{31,253,16},{31,252,144},{31,252,80},{31,252,48},{31,252,80},{31,252,144},{31,255,16}},
{{31,254,16},{31,225,16},{31,228,144},{31,228,80},{31,228,48},{31,220,80},{31,224,144},{31,255,16}},
{{31,254,16},{24,1,16},{31,196,144},{31,196,80},{31,196,48},{31,220,80},{24,0,144},{31,255,16}},
{{31,254,16},{24,1,16},{31,196,144},{25,4,80},{25,4,48},{25,28,80},{24,0,144},{31,255,16}},
{{31,254,16},{0,1,16},{7,196,144},{1,4,80},{1,4,48},{1,28,80},{0,0,144},{31,255,16}},
{{31,254,16},{0,1,16},{7,196,144},{1,4,80},{1,4,48},{1,28,80},{0,0,144},{31,255,16}},
{{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}},
{{31,254,16},{0,1,16},{7,196,144},{1,4,80},{1,4,48},{1,28,80},{0,0,144},{31,255,16}},
{{31,254,16},{0,1,16},{7,196,144},{1,4,80},{1,4,48},{1,28,80},{0,0,144},{31,255,16}},
{{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}


};



void setup(){
  pinMode(DataPin,OUTPUT);   
  pinMode(ClockPin,OUTPUT);
  pinMode(LatchPin,OUTPUT);
  pinMode(clock,OUTPUT);
  pinMode(Reset,OUTPUT);
  digitalWrite(Reset,HIGH);
  delayMicroseconds(5);
  digitalWrite(Reset,LOW);
}

void run_animation(unsigned char frame_time,unsigned char frames[][8][3],unsigned char num_frames,unsigned char num_loops){
 
 for(int i=0;i<num_loops;i++){     
  for(x=0;x<num_frames;x++){       
   for(int z=0;z<frame_time;z++){
    for(y=0;y<8;y++){
     digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,LSBFIRST,frames[x][y][2]);   
     shiftOut(DataPin, ClockPin,LSBFIRST,frames[x][y][1]);
     shiftOut(DataPin, ClockPin,LSBFIRST,frames[x][y][0]);
     digitalWrite(LatchPin, 1);
     delayMicroseconds(700);
     digitalWrite(LatchPin, 0);
     shiftOut(DataPin, ClockPin,MSBFIRST,0);
     shiftOut(DataPin, ClockPin,MSBFIRST,0);
     shiftOut(DataPin, ClockPin,MSBFIRST,0);
     digitalWrite(LatchPin, 1);
     digitalWrite(clock, 1);
     digitalWrite(clock, 0);     
    }
    digitalWrite(Reset, 1);
    digitalWrite(Reset, 0);
  }
}
}
}

void loop(){
//Pour ajouter des animations:  run_animation(vitesse, titre, nombre de lignes, nombre de cycles);

run_animation(4,rain,11,15);//(delai,nom du cycle,nombre de lignes max 55,nombre de cycles)
run_animation(20,KLT,2,2);
run_animation(15,KLT2,16,1);
run_animation(12,KLTS,8,2);
run_animation(20,KLTE,16,2);// MAXIMUM 83 LIGNES POUR LA TOTALITE DU PROGRAMME !!!!!!

}

Re: Problème de nombre de lignes de données sur UNO

Message non luPosté: Dim 13 Jan 2013 23:48
de phil
Essaye d'utiliser ça => http://arduino.cc/en/Reference/PROGMEM
ou ça => http://arduiniana.org/libraries/Flash/
pour déclarer tes tableaux (rain, KLTS...)
D’après mon expérience il y a tout de même une limitation à 64 k de données.

Re: Problème de nombre de lignes de données sur UNO

Message non luPosté: Lun 14 Jan 2013 14:29
de hjojo
Ok je vais essayer merci