koolguy
Active Member
Hi,
I need to some changes this code, to make this free from char count while writing to display..
i am using 13 char for writing in array, the problem in this code is that while if char is less than or more than 13 the method is not working so, i have to count character all times..
need your help for making free from counting...
I need to some changes this code, to make this free from char count while writing to display..
i am using 13 char for writing in array, the problem in this code is that while if char is less than or more than 13 the method is not working so, i have to count character all times..
need your help for making free from counting...
Code:
display(" Test.....");
display(char *str)
{
int addr;
int z;
while(*str!=0){
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=0;z<5;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=6;z<11;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=12;z<17;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=18;z<23;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=24;z<29;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=30;z<35;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=36;z<41;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=42;z<47;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=48;z<53;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=54;z<59;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=60;z<65;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=65;z<70;z++){
leds[z] = Font2[addr+y];
y++;
}
addr = ((int)*str++ - 0x20);
addr *= 5;
int y=0;
for(z=71;z<76;z++){
leds[z] = Font2[addr+y];
y++;
}
}
}