Bumping the top of my RAM memory on this arduino project. Read the stuff here about tricks to help. First was the F("xx") macro. That seems to be broken. Is there any info on this? Second was chopping the Hardware serial buffer and for the life of me I can't find it. Searched and commented out all Serial statements, not using serial. Removed all the SD card stuff. Even went as far as to comment out the button code in the Adafruit graphics library. I'd kill for 100 bytes of RAM! Is there any more hidden ram eaters out there that anyone can think of?
Many thanks in advance!
Oh the hardware is a arduino uno with Adafruit capacitive touch screen.
Built my own touch screen RPN HP Calculator.
-jim lee
Memory memory memory!
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Memory memory memory!
Really? Seems to be working fine here. What version of the IDE are you using? If you post your code, we can take a look for other potential savings.First was the F("xx") macro. That seems to be broken.
A Leonardo would give you another 512 bytes.I'd kill for 100 bytes of RAM! ... Oh the hardware is a arduino uno
- jim_lee
- Posts: 709
- Joined: Thu May 24, 2012 8:24 pm
Re: Memory memory memory!
Here's the package in here.
https://github.com/leftCoast/Arduino
The bits you want are.. HP_Calc folder
/libraries/LC_RPNCalculator
/libraries/LC_TFTTools
/libraries/LC_baseTools
Of course you'll need to add your stuff to it.
Adafruit_FT6206
Adafruit_GFX
Adafruit_ILI9341
-jim lee
https://github.com/leftCoast/Arduino
The bits you want are.. HP_Calc folder
/libraries/LC_RPNCalculator
/libraries/LC_TFTTools
/libraries/LC_baseTools
Of course you'll need to add your stuff to it.
Adafruit_FT6206
Adafruit_GFX
Adafruit_ILI9341
-jim lee
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Memory memory memory!
[Moved to General Project Help]
That is a lot of stuff to cram into an Arduino. It probably can be done if you are meticulous with your memory usage.
The F() macro is a great, easy to use tool. But it is not a universal solution. You will probably need to master PROGMEM to squeeze out the last few bytes of SRAM.
http://www.arduino.cc/en/Reference/PROGMEM
That is a lot of stuff to cram into an Arduino. It probably can be done if you are meticulous with your memory usage.
The F() macro is a great, easy to use tool. But it is not a universal solution. You will probably need to master PROGMEM to squeeze out the last few bytes of SRAM.
http://www.arduino.cc/en/Reference/PROGMEM
- jim_lee
- Posts: 709
- Joined: Thu May 24, 2012 8:24 pm
Re: Memory memory memory!
Ok, in a desperate attempt to lesson my memory load, I've been attempting to add Pro Trinket to the mix to offload the calculator code. The calculator code very well suited to this, it takes in a string as a button press and updates its registers. The calling program just reads the Xreg and fixReg to update its display. Perfect for client server.
So the big Arduino with the touch screen has the screen stuff along with the window manager and it just stuffs button presses out the serial port and reads in the display info. Simple simple.
But of course its not working. Even wiring in a power switch to the co-processor I can't reprogram anything. I think they are stomping on each other's serial lines. Sigh..
So the big Arduino with the touch screen has the screen stuff along with the window manager and it just stuffs button presses out the serial port and reads in the display info. Simple simple.
But of course its not working. Even wiring in a power switch to the co-processor I can't reprogram anything. I think they are stomping on each other's serial lines. Sigh..
- jim_lee
- Posts: 709
- Joined: Thu May 24, 2012 8:24 pm
Re: Memory memory memory!
Alright..
I rewired it so I now have an unplug-able serial line. Yelllow is output, Blue is input. Even made the input male & output female so I can't mix 'em up.
Now I can reprogram the two processors.
Main Processor (The Uno with the screen) :
Co-processer (The Pro-Trinket inside) :
And the result..
Seems they are not talkin' the same lingo.
So here I sit, hat in hand, wondering if anyone can give me a hint? Why can't one not read the other when they -seemingly- are set up the same?
Thanks!
-jim lee
I rewired it so I now have an unplug-able serial line. Yelllow is output, Blue is input. Even made the input male & output female so I can't mix 'em up.
Now I can reprogram the two processors.
Main Processor (The Uno with the screen) :
Code: Select all
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_FT6206.h>
#include <Adafruit_ILI9341.h>
#include <colorObj.h>
#include <idlers.h>
#include <lists.h>
#include <mapper.h>
#include <timeObj.h>
#include <drawObj.h>
#include <label.h>
#include <screenObj.h>
void setup() {
if (initScreen(INV_PORTRAIT)) {
screen->fillScreen(BLACK);
}
screen->setTextSize(1);
screen->setTextWrap(true);
screen->setCursor(10, 10);
screen->println("waiting for data");
screen->print(">");
Serial.begin(9600);
Serial.setTimeout(50);
}
void loop() {
char buff[20];
Serial.readBytes(buff,20);
screen->print(buff);
}
Code: Select all
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.write("Help!!\n");
delay(250);
}
Seems they are not talkin' the same lingo.
So here I sit, hat in hand, wondering if anyone can give me a hint? Why can't one not read the other when they -seemingly- are set up the same?
Thanks!
-jim lee
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Memory memory memory!
Try catching the number of bytes read from Serial.readBytes() and printing that to the display. Let's make sure the Pro Trinket is reading data and not timing out.
- jim_lee
- Posts: 709
- Joined: Thu May 24, 2012 8:24 pm
Re: Memory memory memory!
It was timing out. Either the uno couldn't hear or the trinket wasn't sending. I won't be able to work on it for a few days though.
Thanks for the reply
- Jim lee
Thanks for the reply
- Jim lee
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Memory memory memory!
What pins on the Uno do you have Rx & Tx connected to? I don't see any software-serial in your code and it doesn't look like they are connected to the hardware serial pins (0 & 1)
Please be positive and constructive with your questions and comments.