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.

PIC Micro Data vs Program Memory

Status
Not open for further replies.

CoTang

Member
Hi all! I am trying to program a software to burn 16F84A Micros. I know there are free ones out there but I wanna learn how to do it, anyways, I was reading the programming specf for the 16F84A and I encounters two twos of memory that sorta confuses me. The Data Memory and Program Memory. Can someone tell me what those are and why you need it? I think the program memory is for the users program to be inserted but what does the data memory do?
 
Most Microcontrollers use two separate data busses one for program memory and one for data memory. Program memory is where your code goes. Each CPU cycle the processor grabs the new instruction to be executed from this memory. The Data memory ususaly goes to RAM to store temporary variables: your Data. The CPU can only execute instructions from the program memory.

What this means for your code is that there are two separate memory locations with the same address, one in Program memory and one in Data Memory. If you use C there are compiler directives telling the compiler which memory to put the variable in. In Keil's 8051 compiler the words are "code" for program memory and "data" for Data memory. The 8051 actually has 5(if i'm counting right) different memory spaces which is a bit confusing but lets you optimise your code for for speed using the best memory for the task.

In assembly the different memory types are accessed using different instructions.

Brent
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top