PROGMEM LCD custom chars and memcpy_P()

Hello !!

I'm confused, I show you my code, running on Arduino MEGA and LCD 16x2.

This is my custom charset, a total of 19 characters of 8 bytes each

const byte CCFlash[19][8] PROGMEM = {
 {B10000, B10000, B10000, B10000, B10000, B10000, B10000, B10000}, // 1/5 full block, 
 {B11000, B11000, B11000, B11000, B11000, B11000, B11000, B11000}, // 2/5 full block
 {B11100, B11100, B11100, B11100, B11100, B11100, B11100, B11100}, // 3/5 full block
 {B11110, B11110, B11110, B11110, B11110, B11110, B11110, B11110}, // 4/5 full block 
 {B11111, B11111, B11111, B11111, B11111, B11111, B11111, B11111}, // 5/5 full block
 {B01100, B10010, B10010, B01100, B00000, B00000, B00000, B00000}, // Grado 
 {B00100, B01110, B01110, B01110, B11111, B00000, B00100, B00000}, // Bell
 {B00010, B00011, B00010, B01110, B11110, B01100, B00000, B00000}, // Note
 {B00000, B01010, B11111, B11111, B01110, B00100, B00000, B00000}, // Heart
 {B00000, B00000, B01010, B00000, B00000, B10001, B01110, B00000}, // Smile
 {B00000, B00000, B01010, B00000, B00000, B00000, B01110, B10001}, // Frownie
 {B00100, B01010, B00100, B00100, B01110, B10101, B00100, B01010}, // Armsdown
 {B00100, B01010, B00100, B10101, B01110, B00100, B00100, B01010}, // Aarmsup
 {B11111, B10101, B11111, B11111, B01110, B01010, B11011, B00000}, // Alien
 {B00000, B00001, B00011, B10110, B11100, B01000, B00000, B00000}, // Check
 {B00001, B00011, B01111, B01111, B01111, B00011, B00001, B00000}, // Speaker
 {B00001, B00011, B00101, B01001, B01001, B01011, B11011, B11000}, // Sound
 {B00000, B01110, B10101, B11011, B01110, B01110, B00000, B00000}, // Skull
 {B01110, B10001, B10001, B11111, B11011, B11011, B11111, B00000}, // Lock
};

and this is the procedure to create the characters

void createCustomChars_P()
{
 byte i;
 byte CCRam[8];
 
 #define MaxCC 19
 for (i = 0 ; i < MaxCC ; i++)
   {
     memcpy_P(CCRam, &CCFlash[i][0], 8);
      lcd.createChar(i, CCRam);
 
   }
}

If I use #define MaxCC 8 it works fine, but obvious only 8 characters.

by example

lcd.setCursor(1, 0);
lcd.write(byte(0));  //print  1/5 full block on lcd

but

If #define MaxCC 19 (all chars, original code) don't create characters in correct position, and when

lcd.setCursor(1, 0);
lcd.write(byte(0));

print another character on LCD.
Any suggestions would be welcome !
Thanks

You can define only 8 different custom chars at the same time.

Which LCD display are you using? The common displays with an HD44780 or compatible controller chip only have enough memory in the controller for 8 custom characters. The custom characters can be redefined at any time, so you can have as many as you want, but only 8 can be in use at any given time, and redefining a custom character that is currently being displayed will alter the actual display.

Thanks a lot !