Pages: 1 [2]   Go Down
Author Topic: Lack of SRAM memory  (Read 1637 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 106
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Sr. Member
****
Karma: 1
Posts: 462
I am a amateur.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4837
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

I speak logic.  The code is
Code:
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
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2927
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#include <SPI.h>
#include <Ethernet.h>
#include <VirtualWire.h>
#include <Wire.h>
#include "SdFatUtil.h"
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6639
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged

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.

Pages: 1 [2]   Go Up
Jump to: