Before we get to any algorithms for updating arrays, do you realize that the PROGMEM keyword declares your array to be in FLASH, thus you cannot change it once your program is running?
Rather talking about what you can't do, I thought that it may be better offering you a solution of what you can do.
If you are still looking for a solution for a large array, you can use a microSD card SparkFun microSD Shield - DEV-12761 - SparkFun Electronics. You can download supporting files at the sparkfun site. They can be a bit tricky at first, but once you get it working, it's fine. (If you want some working code, just message me)
You can store large amount of data (I'm using a 2GB card) and only look at a few bytes of it at a time (using a simple offset from the start of a file).
As of now, I don't think that it is compatible with the mega, but I'm currently using it with the Duemilanove.
Okay, perhaps I am not stating this correctly. I already have a 4800 item array in progmem, and it works fine. Let's say I have another array of just 100 items stored in the normal Arduino memory which I can change. How do I change elements as a group the easiest way possible in the middle of the array? Or am I forced to call out items by row and column? This means changing 40 items in an array a long process!
You could assign the same value to a bunch of contiguous elements in a row with a call to memset():
uint8_t array[NumRows][NumCols] = { .... whatever .... };
for (i=0 ; i < NumRows; i++) {
// Set 4 elements at array[i][ColOffset] to 0xFF
memset(array[i] + ColOffset, '\xFF', 4);
}
Alligator, are you saying you want a big background image that will remain static during execution, except for a small rectangular area somewhere inside it which can change under program control? (like a window or a superimposed sprite)
Yes, with the exception that I have to update entire rows at a time on my display - not just the individual cells. However, the values near the edges will be zeros, so in essence, this is just the individual group of items in an array.
Ok. I suggest writing a class that has access to the big PROGMEM background image and also store the small window in SRAM.
It should have a getrow() method for use with your display function that will either
read an entire image row from progmem if the row# is below or above the window or
read a few bytes from progmem for the part to the left of the window, read one row from the window and then take the rest of the row from the right edge of the background image.
There are of course many unanswered questions: does the "window" combine with the background or simply replace it? Does the window appear at a fixed location?
That's good information. In this case, I'm trying to write 3 numbers over a specific spot on the screen. Thus, the values would replace the values that are there already. Because I want to count into the hundreds, it is not logical to simply create an entire group of rows to replace the existing rows or I will quickly run out of memory and end up with a very, very long program.
I'd like to create 10 small sections (the numbers 0 - 9) and simply replace those portions in the array. Then I redraw the screen with that portion of the array (those relevant rows) and I'm done.