Go Down

Topic: What is the 1KB SRAM used for? (Read 850 times) previous topic - next topic

liudr

Hi all. I'm just a newbee. I'm just curious what the 1KB SRAM is used for. Is it reserved for system and can it be used by user programs? BTW is there any functions that can allocate the flash ram for program? :D

peter247

the sram is the volatile part , to store the variable , system buffers etc .
The users program is stored in the flash non-volatile memory.
http://peter224722.blogspot.com

Anachrocomputer

That's right, Flash is used for program storage, and RAM is used for global variables, local variables and temporaries (i.e. the stack).  There's also EEPROM. which can be used with special EEPROM read/write functions for non-volatile data (but not program) storage.

liudr

Thanks guys. I finally remembered a chart I saw in a book some 15 years ago about sram and dram. Sram is like a ball in one of two boxes marked as 1 and 0. Dram is like a ball on a slope, the high end marked as 1 and low end marked as 0, so dram needs to be refreshed regularly. I also remembered both are volitile.

Anachrocomputer

OK, glad that the explanations made sense.

As for SRAM and DRAM, both are used for data storage, but they do indeed work in different ways.  The Arduino has no DRAM at all, just SRAM.  A desktop PC has DRAM for storage of data and program code.

This is because a DRAM cell (one bit of memory) can be made smaller than an SRAM cell.  So, for high-density memory (PC RAM in the form of DIMMs), DRAM is better.  SRAM cells are larger, but for a tiny amount like the 1k in the Arduino, that does not matter.  SRAM has the advantage that it needs no refresh, which is important for applications like microcontrollers.

Go Up