Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

In which memory is stored each instruction?

bahya

New Member
Hello ,
I have as a program this example :

#include <stdio.h>
#define LAST 10

int main()
{
int i, sum = 0;

for ( i = 1; i <= LAST; i++ ) {
sum += i;
} /*-for-*/
printf("sum = %d\n", sum);

return 0;
}

And I want to know in which memory is stored each instruction.
for example :
==> int i, sum = 0; is stored in RAM
so what aboute the others?

Thanks.
 
The program gets stored in program ROM. Variables (i.e. int, char, etc etc) get stored in RAM during program execution.
 
So all the program is stored in ROM except ''variables"?
And ROm you mean flash memory of my microcontroller !!
 
So all the program is stored in ROM except ''variables"?
And ROm you mean flash memory of my microcontroller !!

The flash memory of the microcontroller is a contiguous space which contains both the program ROM space as well as the data EEPROM space and the configuration word. The program instructions get stored in the program space within the flash ROM. The data EEPROM section of flash ROM can be used for permanent storage of user settings while RAM is used for variables during program execution. With the proper code routines, the microcontroller can write to as well as read from the data EEPROM space in the flash memory but special code routines are required to do this.
 
Last edited:

Latest threads

New Articles From Microcontroller Tips

Back
Top