Go Down

Topic: Lack of SRAM memory (Read 2186 times) previous topic - next topic

blastboot

you're right i know that but write it wrong...  :smiley-red:

dkl65

I'm sorry that I am not answering your question, but I have found a library that tells you how much SRAM you have left. It could be useful in the future for diagnosing problems causeb by the lack of SRAM: http://playground.arduino.cc/Code/AvailableMemory.
Visit http://www.glenof.webs.com/!

GoForSmoke


you're right i know that but write it wrong...  :smiley-red:


I speak logic.  The code is
Code: [Select]
noMes[carmes - '0' + 1]

If carmes is '0' then the index will be 1 because of the + 1. You waste noMes[0] and must have an extra noMes[] to hold the last because the + 1 moves all up by 1, you see?

int Arry[ 4 ] = { 1, 2, 3, 4 };
Arry[0] == 1
Arry[3] == 4

for ( byte i = 0; i < 4; i++ )
{
  Serial.println( Arry[ i ] );
}

will print
1
2
3
4
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

oric_dan

Just a couple of thoughts. First off, this doesn't look good to me, as it indicates
almost all of the Flash in the chip [I assume it's a UNO] has been used up, unless
I'm reading it wrong.
Quote
(Flash memory is good: 31.030 bytes).


Secondly, personally I don't see much in the code posted originally to indicate the
strings use up very much RAM. I would think that more likely the libraries being
called are the bad boys. Do you know what size RAM buffers each of them uses?
Code: [Select]
#include <SPI.h>
#include <Ethernet.h>
#include <VirtualWire.h>
#include <Wire.h>
#include "SdFatUtil.h"

dc42


dc42 thank you very much, i will look to do what you have recommended.
Quote
3. You use the same string literal several times, for example ".csv", "%s%s" and " , ". Depending on whether gcc is performing string pooling or not, you might save memory by naming string literals that you use more than once.

You're telling to use like
Code: [Select]
char name[]=".csv" and everytime i need to "write" that i point to "name" char. Is this?


I'm suggesting that may save memory - it depends on whether gcc is using string pooling both in flash and in RAM when it is invoked from the Arduino IDE. Try it on a few strings to see whether it saves any memory before you spend time applying it on the whole program. You should always use "const char*" instead of "char*" when naming string literals.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy