Scrolling text goes crazy when Serial is set

I built my own scrolling text panel using 6 5x7 dot matrix panel. Driving matrix panel is done using MBI5026 shift register IC. In order to shift bits I use shiftOut function already exist in arduino. And, I am using 96 7x8 bit character set to represent some of the ASCII characters.

It looks like that:

byte keywords[96][7]={
{B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000
}
.
.
.
};

Here is the strange problem I faced when I want to use Serial port to send string from my computer to show it on the panel:

If I don't set Serial port, I can write any string on the panel. However, characters get garbled or even not seen if I set Serial port using command Serial.begin(9600).

I thought 96 characters might consume most of the program memory of arduino therefore I deleted all characters except one dummy character, re-enabled Serial connection and tried to write set of that dummy chacter. And it works flowlessly!

Problems seems to be related to memory of arduino but I couldn't find out the relation between Serial port and program memory of arduino. How come that's possible? I might be wrong about the program memory explanation. Do you have any suggestion how I can solve that issue?

I need to send serial commands to arduino in order arduino to write the string I want.

It sounds like you're confusing program memory with RAM, but without seeing your code, it is difficult to say.
Certainly, the small amount of code you did post will put its contents into RAM, and not program memory.
If you've got all your font in RAM, it may well be that using Serial will push your RAM usage over the edge.

Attached my code. It might be little confusing but sure it will help. Things I wrote on the editor will be uploaded to program memory, right ? Otherwise, is it possible to save character set to another memory block exist in arduino ?

shiftReg4.ino (12.1 KB)

Things I wrote on the editor will be uploaded to program memory, right ?

Of course (there's nowhere else for it to go), but some of it will get copied out to RAM before "main" runs
The trick is to make sure that stuff that doesn't need to change gets left in PROGMEM (there's a useful search term)

Thank you. I solved the problem using PROGMEM suffix when I define my character set. By using PROGMEM, variables are stored in program memory instead of storing them in SRAM.

Here how I used it:

Defining variable;

const byte charset[][7] PROGMEM = {{...}...{...}};

Using variable;

pgm_read_byte(&charset*[j])*