Go Down

Topic: "Load mapping" SRAM memory use in Arduino? (Read 3 times) previous topic - next topic

PeterH


Only variables which are explicitly placed into PROGMEM get put into FLASH.


Isn't the Arduino compiler smart enough to do that with static consts? Many compilers are.
I only provide help via the forum - please do not contact me for private consultancy.

gravelbar

OK everybody, here's the code.

THANKS for your help!  I've put description Exhibition / Gallery  to make things neater:

http://arduino.cc/forum/index.php/topic,78866

Should mention programmer X (anonymous pal) wrote some very sweet encoder code; seems to not be enough of that around; it's in there.

Steve

PS.  Yes, I know all the "30"'s in hydrographs can be replaced, we eventually want to have other numbers there :-)

James C4S


Also he as advised using "const" for variables, this put them in flash, correct?

In this case, your pro-friend is wrong.  const will not place constants/variables into FLASH.  They will still consume RAM during the program's execution.  Only variables which are explicitly placed into PROGMEM get put into FLASH.

The only thing "const" really does is generate complier errors if your code attempts to modify a "constant."
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

robtillaart


Can you post the code you have at the moment?

Quote
A pro programmer wrote some nice code for me as a favor (in C++); it works, but we're bumping against memory limits; we have several large arrays, most of which are used to run "hydrographs" -- simulation of a flood; a curve that starts small, climbs to a max, and then tapers off.


How large are these arrays? Can you post such a hydroGraph?

For these kind of problems approximation by interpolation can be a real memory winner, I wrote the multimap() function for these kind of problems. see - http://arduino.cc/playground/Main/MultiMap - The idea of multimap() is to reduce all points of an array or a function (the wave in your case) to a substantial smaller subset of points, between which linear interpolation is an acceptable approximation of the original array/function. It is a speed - memory - precision tradeoff.

Might help,
Rob



Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

wildbill

There are a number of free memory functions that'll tell you how much SRAM you're consuming - search the forum for freemem.

An easy way out if you're short of space is to upgrade to a Mega - it's more expensive, but perhaps not so bad when that cost is wrapped up with the other components in your product.

I'd assumed as you're making a commercial product that your code is proprietary, but you mention that it's open source. In which case, post it here and there may be things the folks here can suggest to improve/clarify/reduce the memory footprint.

What part does the arduino play in the system? Flow control by PWMing the pump?

Go Up