Array problem
hi everyone.i want interface 3x8x8 led matrix using 3 max72xx . modified library led control work x,y values , works great. want characters font.h , copy array of bytes in array, , later "print" array. copy function (void makeword) not working good...it working 1-5 characters.if want display 6 or more characters, led display seems crazy
.if want display array prebiosly declared , manually loaded temp2 works perfectly, nomatter number of characters. if want display generated array works 5 characters; if want 6 or more works desastrous.i try search function memcpy have add end of generated array, didn't find...any ideea ?
my code this:
ps : sorry bad english
.if want display array prebiosly declared , manually loaded temp2 works perfectly, nomatter number of characters. if want display generated array works 5 characters; if want 6 or more works desastrous.i try search function memcpy have add end of generated array, didn't find...any ideea ?my code this:
code: [select]
int k=0;
char text_afisare[] = "testtest";
int nr_litere = strlen(text_afisare);
int nr_bytes = nr_litere*8;
byte temp[64];
byte temp2[328]={
b00000000,b11000000,b11000000,b11111111,b11111111,b11000000,b11000000,b00000000,b00000000,b11111111,b11111111,b11011011,b11011011,b11011011,b11000011,b00000000,b00000000,b01110010,b11111011,b11011011,b11011011,b11011111,b01001110,b00000000,b00000000,b11000000,b11000000,b11111111,b11111111,b11000000,b11000000,b00000000,
b00000000,b00000000,b00000000,b00000000,b00000000,b00000000,b00000000,b00000000,
b00000000,b01111110,b11111111,b11000011,b11000011,b11111111,b01111110,b00000000,b00000000,b11111100,b11111110,b00000011,b00000011,b11111110,b11111100,b00000000,b00000000,b11111111,b11111111,b11011011,b11011011,b11011011,b11000011,b00000000,b00000000,b11111111,b11111111,b11001100,b11001100,b11111111,b01110111,b00000000,b00000000,b11111111,b11111111,b00111000,b00011100,b11111111,b11111111,b00000000,b00000000,b11111111,b11111111,b11011011,b11011011,b11011011,b11000011,b00000000,b00000000,b11000000,b11000000,b11111111,b11111111,b11000000,b11000000,b00000000,
b00000000,b00000000,b00000000,b00000000,b00000000,b00000000,b00000000,b00000000,
b00000000,b11000000,b11000000,b11111111,b11111111,b11000000,b11000000,b00000000,b00000000,b11111111,b11111111,b11011011,b11011011,b11011011,b11000011,b00000000,b00000000,b01110010,b11111011,b11011011,b11011011,b11011111,b01001110,b00000000,b00000000,b11000000,b11000000,b11111111,b11111111,b11000000,b11000000,b00000000,
0x08, 0x04, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01,
0x10, 0x20, 0x40, 0x80, 0x80, 0x02, 0x02, 0x02,
0x99, 0x24, 0x42, 0x99, 0x99, 0x42, 0x24, 0x99,
0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff,
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc,
0x42, 0xc3, 0x24, 0x18, 0x18, 0x24, 0xc3, 0x42,
0xfd, 0x85, 0xb5, 0xa5, 0xa5, 0xbd, 0x81, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x7e, 0x7e, 0x7e, 0x7e, 0x42, 0x24, 0x18,
0x18, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x18,
0x78, 0x78, 0x18, 0xff, 0xff, 0x0c, 0x3c, 0x3c,
0xf2, 0x82, 0x12, 0x3a, 0x10, 0xc0, 0xc4, 0x0e,
0x7f, 0x84, 0xa7, 0x84, 0xa7, 0x84, 0x7f, 0x00,
0x3c, 0x42, 0x81, 0xa1, 0x89, 0x95, 0xa5, 0x42,
0x07, 0x2f, 0x1c, 0x3e, 0x3c, 0x30, 0x30, 0x30,
0x5a, 0x99, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18,
0x82, 0x41, 0x82, 0x41, 0x82, 0x41, 0x82, 0x41,
0x00, 0x01, 0x06, 0x7e, 0xdf, 0x7e, 0x06, 0x01,
0x04, 0x0f, 0x1f, 0x3c, 0x3c, 0x1f, 0x0f, 0x04,
0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x49, 0x92, 0x24, 0x49, 0x92, 0x24, 0x49, 0x92,
0x92, 0x49, 0x24, 0x92, 0x49, 0x24, 0x92, 0x49
};
void setup() {
lc.shutdown(0,false);
lc.shutdown(1,false);
lc.shutdown(2,false);
lc.setintensity(0,15);
lc.setintensity(1,15);
lc.setintensity(2,15);
lc.cleardisplay(0);
lc.cleardisplay(1);
lc.cleardisplay(2);
makeword(text_afisare);
}
void initializare(){
lc.setintensity(0,15);
lc.setintensity(1,15);
lc.setintensity(2,15);
lc.cleardisplay(0);
lc.cleardisplay(1);
lc.cleardisplay(2);
}
void matrice(unsigned long delaytime, byte character[]) {
lc.cleardisplay(0);
lc.cleardisplay(1);
lc.cleardisplay(2);
for(int i=23;i>=-nr_bytes;i--) {
for(int j=0;j<(24-i);j++) {
if(j < nr_bytes) {
scrie_coloana(i+j, character[j]);
} else {
scrie_coloana(i+j, false);
}
}
delay(delaytime);
}
}
void makeword(char text[])
{
for(int i=0;i<nr_litere;i++)
{
int val=0;
char ch=text[i];
if (ch < 32 || ch > 126){
ch = 32;
}
ch -= 32;
//for(int j=0;j<8;j++)
//{
temp[k]=font[ch][val];
temp[k+1]=font[ch][val+1];
temp[k+2]=font[ch][val+2];
temp[k+3]=font[ch][val+3];
temp[k+4]=font[ch][val+4];
temp[k+5]=font[ch][val+5];
temp[k+6]=font[ch][val+6];
temp[k+7]=font[ch][val+7];
k+=8;
//}
//memcpy(temp,font[ch],8);
//temp[k]=font[ch];
//k+=8;
}
}
void scrie_coloana(int coloana, byte informatie)
{
if(coloana<=7) lc.setrow(0,coloana,informatie);
if(coloana<=15) lc.setrow(1,coloana-8,informatie);
if(coloana<=23) lc.setrow(2,coloana-16,informatie);
}
void loop() {
delay(1000);
initializare();
matrice(100,temp);
}ps : sorry bad english

which arduino using?
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Array problem
arduino
Comments
Post a Comment