Go Down

Topic: Memory (Read 2396 times) previous topic - next topic

4224jax

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

Anachrocomputer

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.

westfw

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?

John_Ryan

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.




mem

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.

westfw

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

Go Up