Difference between ROM and RAM..

Discussion in 'Embedded Systems and Microcontrollers' started by Shwethu_Siddu, Jun 23, 2008.

  1. Shwethu_Siddu

    Thread Starter New Member

    Jun 23, 2008
    1
    0
    Dear All,
    As per as my knowledge difference between ROM and RAM is that:-

    ROM:- Read Only memory..all I/O related files will be stored and operating system files are stored...which can't be modified

    RAM:- Random access memory...data which can be repeatedly access by processor stored in this memory..

    Where is my final Executable C code will be stored?
    if your answer is RAM...RAM is volatile memory(Once power is off then data gets lost)...i am getting some kind of confuse can anybody clerify my question?

    Thanks in Advance
     
  2. binu_ji

    Member

    Jul 13, 2007
    22
    1
    Your program will be stored in ROM, and the variables used by your program is stored in RAM.
    for example if you declare a variable int a
    Here the value of "a" is stored in the RAM
     
  3. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    Not exactly true. Your program will be stored in some type of media that may or may not be non-volatile. ROM usually hold data or programs that are not changed (or not often changed) -- BIOS for a motherboard. When you write your code it will be stored in a secondary storage device like the hard drive or flash.
     
  4. Hamilton

    Member

    Jun 20, 2008
    10
    0
    There are many types of memory today and therefore many answers depending on the application:

    Non-volatile storage is where the program code is stored and possibly executed from depending on the type. Examples of just storage include CDRs, hard drives, etc. The program code is loaded into RAM for execution.

    Flash memory, SRAM with a battery, EPROM, PROMs are example of non-volatile storage that also support program execution directly from the device or it may be loaded into RAM.

    RAM is for temporary storage during execution. Data buffers, variables, and other temporary values must be stored and retrieved quickly. There is no limit on the number of writes.

    Static RAM (SRAM) is even faster that DRAM and only needs a small battery to retain its memory. It is more expensive and tends to come is smaller memory sizes than DRAM.

    Dynamic RAM (DRAM) is inexpensive, comes in very large sizes, is very fast and very low power. It requires periodic refreshing (i.e. clocks and circuitry) to retain its memory.

    If you use flash memory (internal to the MCU or external including common memory sticks) it is important to note that it is slow to write to, generally* to re-write to it you must erase the entire page and re-write it (flash starts as all 1s, you really only write 0s to it, you can not turn a bit back to a 1 except to erase it which is done a page at a time, and start over). With very few exceptions flash can only be re-written 5000 to 10,000 times. Imagine 44K samples/sec of audio data stored in flash. In less than a second it would be killed if you could write to it that fast. So, "program code" only in the flash memory space. Most compilers handle this automatically once set up.

    Note: * RAMTEK and other flash memory uses unique processes which allows unlimited read/writes, bit level re-writes and fast writes. These technologies are not used in MCU at this time.
     
  5. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,347
Loading...