# Storing more on an EEPROM

I'm using a mini pro which has 1k of EEPROM space. I'm using each byte to store a character. But it's not enough for my purposes. However, the character set I need to store is really only a-z plus spaces, so I don't need the whole 128 ASCII set. What would be an elegant and code-light way of assigning/reading/writing, say, 3 characters per EEPROM byte?

I am not clear how 3 characters will fit in 8 bits when each character can be one of 27 values, if that is what you are suggesting

So, 27 characters? Then one character would fit in 5 bits (2^5 = 32). You have 3 bits left.

I know I'm being stupid, but if I use 0-26 for the characters I want, why can't I use 27-127 for some other characters?

if I use 0-26 for the characters I want, why can't I use 27-127 for some other characters?

You can, but that is not what you asked. Whichever way you cut it you cannot get 3 characters in a byte when each character has a value between 0 and 27. There are simply not enough bits available as each one takes 5 bits

There are 8 bits per byte.
0 = 0b00000000, lets say that is a space
26 = 0b00011010, and this represents Z, with 27,28,29,30,31 not used

So you could use the upper 3 bits that no character uses as an index to other characters
0b000xxxxx is the group you have now
0b001xxxxx represents another group of 32 characters
0b010xxxxx a 3rd group
0b100xxxxx a 4th group
(with 8 groups possible from 000 to 111)

Is that what you are asking?
Or do you want each 8 bits to represent 3 letters at once so you can squeeze 3K of letters where there is only 1K of memory?
0baa bbb ccc
That only leaves 2 or 3 bits to represent 5 bits of information, not really practical.
What you'd have to do is manage the letter storage to have 8 characters stored across 5 bytes:

``````byte4     byte3     byte2     byte1     byte0
hhhh hggg ggff fffe eeee dddd dccc ccbb bbba aaaa
``````

What you could do pretty easily is add some external memory, I2C or SPI based EEPROM, or FRAM, and have as much room as you want for letter storage.

Alternately, you can change to a '1284P processor, with 4K of EEPROM:
̶ 128KBytes of In-System Self-programmable Flash program memory
̶ 4KBytes EEPROM
̶ 16KBytes Internal SRAM
32 IO, dual hardware serial ports.

I offer them in small footprints, here are a couple

(other header pins can be installed as well)