Arduino Forum

Using Arduino => Microcontrollers => Topic started by: Caseyg on Feb 14, 2013, 04:57 am

Title: More than 256K of memory?
Post by: Caseyg on Feb 14, 2013, 04:57 am
I am planning on a project that I think will end up taking quite a bit of code. Primarily I am looking to create a way to remotely control and monitor my commercial espresso machine and was hoping to make it stand alone. I don't want to have a computer running for it to serve up all of the information about the machine.
Is there a way to store my large (presumably) code base on a flash device? I am not talking strings and such, but large amounts of logic/code itself that would bring my code base past 256K. I have been looking for samples and howtos, but either there are none out there or i am using the wrong search terms. Any guidance would be much appreciated.
Title: Re: More than 256K of memory?
Post by: nickgammon on Feb 14, 2013, 05:10 am
I can't think offhand what you would run to control an espresso machine that would require more than 256 Kb of program memory. The architecture (Harvard) does not allow code to be loaded from external devices, such as SD cards.

However people are making quite complex things, like quadcopters, and robots, using quite small amounts of program memory.

If you simply can't fit your code into 256 Kb, you might look at another processor. The Arduino Due for example has 512 Kb of program memory.

http://arduino.cc/en/Main/ArduinoBoardDue

Bear in mind that early PCs (eg. Apple, Apple Mac) shipped with less than 256 Kb of memory.

From Wikipedia:

Quote

IBM sold the first IBM PCs in configurations with 16 or 64 kB of RAM preinstalled using either nine or thirty-six 16-kilobit DRAM chips. ... After the IBM XT shipped, the IBM PC motherboard was configured more like the XTs motherboard with 8 narrower slots, as well as the same RAM configuration as the IBM XT. ( 64 kB in one bank, expandable to 256kB by populating the other 3 banks ).


It's hard to believe that one dedicated device (a coffee machine) would need more memory than you got on the original IBM PC.
Title: Re: More than 256K of memory?
Post by: fungus on Feb 14, 2013, 08:43 am

I am planning on a project that I think will end up taking quite a bit of code. Primarily I am looking to create a way to remotely control and monitor my commercial espresso machine and was hoping to make it stand alone. I don't want to have a computer running for it to serve up all of the information about the machine.
Is there a way to store my large (presumably) code base on a flash device? I am not talking strings and such, but large amounts of logic/code itself that would bring my code base past 256K. I have been looking for samples and howtos, but either there are none out there or i am using the wrong search terms. Any guidance would be much appreciated.


I have a hard time imagining an espresso machine needs more than a couple of K of code to monitor.

Maybe you can flesh out your plan. What values need to be monitored? How do you want to access the information?
Title: Re: More than 256K of memory?
Post by: Grumpy_Mike on Feb 14, 2013, 09:10 am
If you run bitlash, you can pull the code from the SD card.
Bitlash is an interpretive version of the arduino commands, google for it.
Title: Re: More than 256K of memory?
Post by: Retroplayer on Feb 15, 2013, 01:05 am
If I had to take a guess, I would say the OP probably is thinking of storing stuff like the webpages, etc.. in the main flash. Actual code, I couldn't imagine many projects that would need more than 256K. So, if it data (audio, graphics, HTML, etc...) that will be filling up your memory, move that stuff to some external memory.
Title: Re: More than 256K of memory?
Post by: Grumpy_Mike on Feb 15, 2013, 09:31 am

If I had to take a guess, I would say the OP probably is thinking of storing stuff like the webpages, etc.. in the main flash. Actual code, I couldn't imagine many projects that would need more than 256K. So, if it data (audio, graphics, HTML, etc...) that will be filling up your memory, move that stuff to some external memory.


Well he did say
Quote
I am not talking strings and such, but large amounts of logic/code itself that would bring my code base past 256
Title: Re: More than 256K of memory?
Post by: Docedison on Feb 15, 2013, 10:31 pm
Unfortunately.. he didn't say much else.

Bob
Title: Re: More than 256K of memory?
Post by: Tom Carpenter on Feb 16, 2013, 08:49 pm
Do you know it is going to be larger than 256K, or are you just making a wild guess? Just as an example, it is possible to make an entire MP3 player in 90k of Flash, and that was over 15000 lines of code...
Title: Re: More than 256K of memory?
Post by: nickgammon on Feb 16, 2013, 10:43 pm
Better let the OP respond. :)

Haven't heard a word since the original post.
Title: Re: More than 256K of memory?
Post by: fungus on Feb 17, 2013, 03:43 pm

Better let the OP respond. :)

Haven't heard a word since the original post.


He's probably waiting for the 8-CPU, 4-terabyte RAID, 32GB RAM workstation needed to run the Arduino IDE.  :)
Title: Re: More than 256K of memory?
Post by: Docedison on Feb 18, 2013, 03:39 am
Gee alla that...? I have an instance running on a 1GHz 1GB Dell D610 laptop... It works fine, Windows 7 Ultimate, though is horribly slow.. I just wanted to see If I could make it work and one more time proved that there are pieces of code too big for a machine... An Expresso Machine?... Does it grow the beans too? I can see where duplicating the environment 'might' require some extra code... but more than 256K?

Bob
Title: Re: More than 256K of memory?
Post by: fungus on Feb 18, 2013, 04:13 am
I've written a complete Space Invaders game with VGA graphics and sampled sound on an Arduino Uno. I doubt a coffee machine needs that much.
Title: Re: More than 256K of memory?
Post by: nickgammon on Feb 18, 2013, 06:27 am
Since we are pressing on without the pleasure of the company of the OP, I was reading yesterday about how one of the first gaming consoles (or devices anyway) only had 128 bytes of RAM, because it was so expensive. It might have been Pong. So each frame refresh, the entire playing field had to be generated from scratch, because it couldn't be stored in RAM.
Title: Re: More than 256K of memory?
Post by: fungus on Feb 18, 2013, 06:56 am

Since we are pressing on without the pleasure of the company of the OP, I was reading yesterday about how one of the first gaming consoles (or devices anyway) only had 128 bytes of RAM, because it was so expensive. It might have been Pong. So each frame refresh, the entire playing field had to be generated from scratch, because it couldn't be stored in RAM.


Sounds like the Atari VCS: https://en.wikipedia.org/wiki/Atari_2600_hardware

128 bytes for everything, including CPU stack, frame buffer, sprites, game variables, etc. I've programmed some limited-resource systems in my time but I'm still amazed anybody managed to make games for the VCS.

Sure, Atmel makes ATtinys with only 64 bytes of RAM, but they don't normally get asked to do graphics and sound and manage multiple aliens.
Title: Re: More than 256K of memory?
Post by: Coding Badly on Feb 18, 2013, 07:31 am
Sure, Atmel makes ATtinys with only 64 bytes of RAM...


Atmel makes ATtiny processors with no SRAM.
Title: Re: More than 256K of memory?
Post by: westfw on Feb 18, 2013, 08:23 am
The classic 8051 processor contains 128 bytes of RAM.
But we're talking code space, aren't we?  PIC10F200 has 256 words of program and 16 bytes of "RAM" (and very few "registers, but it does have some hw stack.)  Atmel ATtiny4 has 256 words of program and 32 bytes of RAM, plus some registers.   In the AVR case, 256 words of program works out to 512 bytes; for the PIC10, an instruction word is only 12bits...
Title: Re: More than 256K of memory?
Post by: nickgammon on Feb 18, 2013, 09:32 am

Atmel makes ATtiny processors with no SRAM.


Whoa.
Title: Re: More than 256K of memory?
Post by: nickgammon on Feb 18, 2013, 09:34 am
I withdraw that comment. The early processors (eg. 6800, 6502) had no RAM as such. But you wouldn't operate them without RAM on the bus.
Title: Re: More than 256K of memory?
Post by: Coding Badly on Feb 18, 2013, 06:59 pm

There is at least one Atmel AVR ATtiny processor with no SRAM.  The one I looked at has three "slots" for return addresses so CALL (barely) works but it otherwise has no memory.  All data has to be kept in registers (32 bytes) (or EEPROM).

Quote
Whoa.


No doubt!  "ATtiny" is apropo.
Title: Re: More than 256K of memory?
Post by: Docedison on Feb 24, 2013, 10:44 am
Talk about the room being so small you had to go out side to change your mind...
Title: Re: More than 256K of memory?
Post by: JoeN on Feb 25, 2013, 10:44 pm

Since we are pressing on without the pleasure of the company of the OP, I was reading yesterday about how one of the first gaming consoles (or devices anyway) only had 128 bytes of RAM, because it was so expensive. It might have been Pong. So each frame refresh, the entire playing field had to be generated from scratch, because it couldn't be stored in RAM.


The Atari 2600 had no video memory.  The video signal out was generated on the fly.  This was not just pong, but for every game that ran on this system.  I think it generated an interrupt when a scanline needed to be started for output to the TV and then it was up to the CPU to provide the data on the fly.

http://en.wikipedia.org/wiki/Atari_2600

A lot of vector games worked this way too.  For vector monitors this makes total sense because the main program has control of the electron gun and doesn't even have the constraints of timing, except how many inches of line it can draw between refresh cycles.