Forum Index > Projects > Micro-readerboard project support
 Simplifying and saving a little ram in mrb.c
 |  Printable Version
By: Anonymous: Kevin Osborn () on Wednesday, March 02 2011 @ 08:37 PM PST (Read 1709 times)  
Anonymous: Kevin Osborn

I had some longer strings I wanted to use in my new microreaderboard, and while in the first version, I managed to expand the buffer just enough to fit my longer strings, I didn't like that I had to check the length of my strings.

Looking into the code, the program memory strings are copied into a ram buffer that has to be as big as the longest string. I made a few simple mods to simply use pgm_read_byte at the top of the loop and eliminated the buffer. You can put in as long a string as will fit in flash.

I was going to eliminate the need to tell it the number of strings by doing:

#define NoOfStrings1 sizeof(stringset1)/sizeof(char*) but I couldn't remember if this would be done at compile time, or would be calculated at runtime, requiring pulling in division routines

so I did a
#define NoOfStrings1 sizeof(StringSet1)>>1
I think it becomes a constant, as the amount of flash written was identical.

By: osbock (offline) on Sunday, March 06 2011 @ 05:02 PM PST  

More detailed description of my experience with the Microreaderboards on my blog:

Forum Apprentice

Status: offline

Registered: 03/02/11
Posts: 4

Profile Email    

 All times are PDT. The time is now 05:10 PM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to Post 
Filtered HTML Allowed 
Censored Content 

Evil Mad Scientist Forum Archives — Read only!

Please visit our new forums for new discussions.

DIY Hardware for Electronic Art

The Original Egg-Bot Kit

Interactive LED kits

Meggy Jr RGB
LED matrix game
development kit.

Business-card sized
AVR target boards

Peggy 2
LED Pegboard kits

My Account

Lost your password?