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.

Explaining microcontroller memories to a beginners

Status
Not open for further replies.

misterT

Well-Known Member
Most Helpful Member
Does this make any sense if you are a beginner (first year university student)? Should I simplify it (how)? The illustration is supposed to relate to AVR microcontrollers.

**broken link removed**
 
It makes sense to me but maybe you should change the hex addresses to match the decimal. I.E 128k should go to 0x1FFFF.

Edit, decimal is the wrong word but I'm not sure what would be correct.

Mike.
 
Hi T
First of all, this is great!

Doesn't the "Data Memory" contain 4 sections - .data, .bss, stack and heap - in a way that the stack and heap sections are separated from the .data and .bss sections?

by 32 working registers, you mean SFRs?

What is the Status register?
 
Last edited:
Doesn't the "Data Memory" contain 4 sections - .data, .bss, stack and heap - in a way that the stack and heap sections are separated from the .data and .bss sections?

You are confusing hardware and software... There is code space and data space... how the compiler splits it up is another thing..

A pic16f877a has 8192 bytes of ROM and 368 bytes of RAM... 256 bytes of EEPROM.

The Databanks are controlled by the compiler.
 
Hi Ian.
Thank you :)

Could you recommend on some good link for memory architecture?
I'm not quite sure i understand what you said and it probably since i lack of knowledge.
 
Hi Ian.
Thank you :)

Could you recommend on some good link for memory architecture?
I'm not quite sure i understand what you said and it probably since i lack of knowledge.
Back to the main question.... Which architecture???

There are two main ways a micro manufacturer implements memory...

Linear memory.. One entire length from 0 to 0x... whatever..
Banked memory.. ( Paged as required )..

Linear is the easiest way to access and the easiest to understand.. Intel use ( mainly ) linear in their micro's, I say micros because anyone who looks at x86 style processors memory will get confused VERY quickly..
I'm pretty sure AVR uses linear memory ( going off experience AND MrT's first post..)

The humble pic seems to have memory thrown all over the place!! Some pages are bigger than others!!
The GPR's are in the same space as the SFR's so bank selection is a pain!!

Makes you wonder why I use them so much!!
Oh yeah!! I use C more than ASM so it looks linear...

Every Datasheet you get hold of has the memory map inside, so it's quite easy for you..

Now!! If you want to talk about the memory map on the x86!!! Let us know as I already said its a tad confusing to the newbie...
 
Last edited:
It makes sense to me but maybe you should change the hex addresses to match the decimal. I.E 128k should go to 0x1FFFF.

Thanks.. That is a typo. I'll fix it.
And thanks everybody for the input. I'll test the illustration tomorrow. It is an introductory course for microcontrollers, so the goal is just to give students an idea what a microcontroller is and what it can and can not do. Maybe a simpler image would be better.. just three boxes to show that there are two kinds of memory and a processor.
 
Last edited:
Maybe you can also (Like Ivan pointed out can be confusing a first) add a bit about PC style memory architecture (one address space https://en.wikipedia.org/wiki/Von_Neumann_architecture) VS 8bit PIC/AVR Harvard architecture.
https://en.wikipedia.org/wiki/Harvard_architecture

In the Harvard architecture you might have banked or linear addressing modes within each buss but they are in two distinct address registers for each type of access (program/data).
https://blog.jcole.us/2010/07/17/architecture-of-the-avr/
 
i like the drawing, it has helped explain alot to me, one question that was asked and i would also like to know, are the 32 registers what are called SFR registers? seeing it like that is good. they should understand it as i can kind of get my head round it and i am way way off uni first year (at least 6 years before i can go )
 
are the 32 registers what are called SFR registers?

No, those are General Purpose Registers that ALU works with. The naming conventions between PIC and AVR micros are different. My picture relates to AVR microcontrollers.

From AVR datasheet:
"The high-performance AVR ALU operates in direct connection with all the 32 general purpose working registers."

I think PIC micros (mid-range family) have only one general purpose working register. Look at page 5 in this document: https://ww1.microchip.com/downloads/en/devicedoc/31005a.pdf

My picture actually does not show SFR registers.. Note how the address of the SRAM starts from 0x0100. The SFR registers are in the SRAM memory 0x00 to 0xFF. This design allows 8 bit addresses to be used when accessing SFR registers, while the rest of the SRAM needs to be accessed using 16bit addresses.

Anyway, the picture is not supposed be very accurate or detailed. Just to give a general idea of the important parts. Maybe I should include the SFR registers. Many students are also interested to learn what happens when an interrupt occures.. but that needs another picture.. maybe a series of pictures (like a cartoon or something).
 
Last edited:
cartoon is a good idea, i have always kind of thought of interrupts as a kind of book mark gets placed focus is switched elsewhere then its back to the book mark after, but i am just about to delve into interrupts for my own project as i need software pwm, so i guess pretty soon i will be having to find out what really happens lol, shame its AVR i think i would have enjoyed your course
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top