Pages: 1 [2]   Go Down
Author Topic: Memory  (Read 2037 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 29
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

particularly with something along the lines of out put control.  Then your aruino could perform a ridiculous long and completly unique task for however long
Logged

Bristol, UK
Offline Offline
Edison Member
*
Karma: 1
Posts: 1197
Exhibitor at UK Maker Faire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Remember that code is stored in Flash memory.  The Flash memory is written to when you click on the button to upload your sketch to the I/O board.  Note how slow it is!  That's because Flash is very slow to write, but fast to read.  So, uploading the code in fragments as you describe would be slow (it was a technique used on mainframes and minicomputers, called "overlays").

A better way is to send data from the host PC that will command the Arduino to do whatever is required.  Some commands could request that the Arduino send back data that has been read from, say, a sensor connected to an input pin.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 133
Posts: 6753
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So what's the maximal number of code lines? Just an estimate. 100, 200, 500?
I'd guess at somewhere about 1000 to 2000 lines of code.

The demo16x24 LED matrix program I posted a while ago is about 450 lines of code (actual CODE lines, as counted by one of those "metric" programs; it's 700+ lines of program), and compiles to about 5500 bytes of object code.
The AF_WAVE library for Adafruit's sound playback shield almost fills the 168, IIRC, and has about 1400 lines of code (not including the .h files.)

As others have mentioned, the 1K of RAM is frequently a problem long before you run out of code space.

You can potentially put an interpreter and SD card file system code in the program memory, and connect up a 2Gbyte SD flash card to contain programs to be interpreted, but that's probably cheating, right?
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 731
skcor oniudrA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You can potentially put an interpreter and SD card file system code in the program memory, and connect up a 2Gbyte SD flash card to contain programs to be interpreted, but that's probably cheating, right?

I'd love to see a board with a 2gig SD card built in.. "SDuino"

I have a sketch thats max'ing out at around 600 lines of code. The "max out" is very subtle, parts of the program stop working.

This initially sent me on a false witch hunt, but after experimenting with removing one function at a time, I narrowed the issue down to DateTime.h, with EEPROM.h and wire.h, was too much for the 168.



Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I narrowed the issue down to DateTime.h, with EEPROM.h and wire.h, was too much for the 168.

John, a significant amount of the code used in DateTime is in converting to and from date formats. If you let me know what functionality your application needs perhaps I can suggest a slimmed down version for you.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 133
Posts: 6753
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I narrowed the issue down to DateTime.h
It is a good point to remember that including a particular library will tend to push you over-size in one way or another in big  lumps, rather than a little bit at a time.  Ditto suddenly adding floating point, etc...
Logged

Pages: 1 [2]   Go Up
Jump to: