Pages: [1]   Go Down
Author Topic: uVga, ascii art in PROGMEM array?  (Read 480 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi y'all,

i've been playing with the uVGA module today, nice tool must say a bit buggy though...

well i start with writing a php script that converts an image to 80x25 and then returns the color codes in an array.
so i could easily use it with my Arduino and uVGA. this works quite nicely! :-)

this wouldn't work, i guessed i used to much memory, and then i read about PROGMEM, that's where i thought i'd better ask here before i continue wasting
the rest of the night...

what i want to do is to show a simple ascii image 80x25 with only the ascii 219 block character


so some pseudo code  just to get an idea:

Code:
int pixels_color_codes[] = {0,0,1,2,1,2,2,2,1,1,1,2 ..... etc etc};

for (i = 0; i < 2000; i++){
  textcolor(pixels_color_codes[i]);
  _putch(219);
  }

so how should i continue with this? or is this a bridge to far?




Logged

Central Europe
Offline Offline
Edison Member
*
Karma: 6
Posts: 1220
Use the Source, Luke.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you want to know how put something into PROGMEM at compile-time and use it at runtime, take a look at the Flash library

Also, in your code you use int for values with maximum 256 values. Use int8_t (or uint8_t if you don't need negative values). That halves your memory usage. If you have even fewer colours, you can use jsut the necessary number of bits and pack. Also, you could apply some compression to your images, even  a stupid running length encoding or some simple kind of dictionary compression will a help.

Korman
Logged

Pages: [1]   Go Up
Jump to: