I would start with the section 5. AVR ATmega88/168 Memories on page 15 in the following document:How AVR Memory is sectioned. Let's take ATmeaga168 for illustration, and where to find this in the datasheet? [please note that I am an absolute beginner with microcontrollers]
I already read this. But the question is, for every memory address what is its size? And where to find this in the datasheet?I would start with the section 5. AVR ATmega88/168 Memories on page 15 in the following document:
http://ww1.microchip.com/downloads/...ocontrollers-ATmega88-ATmega168_Datasheet.pdf
You can find all the datasheets you could ever want by Googling "ATmega168 datasheet"
It is all there. Please try to read the documentation with more care and avoid a procession of questions that you can answer for yourself.I already read this. But the question is, for every memory address what is its size? And where to find this in the datasheet?
I'm sorry if my questions seem silly. But it is the first time for me to surf a datasheet of a microcontroller so it is confusing for some somehow.It is all there. Please try to read the documentation with more care and avoid a procession of questions that you can answer for yourself.
Can you please explain what is this multiplication?2/4/8K x 16.
When you go the the lumber yard and ask for a 2 x 4 you get a board with specific dimensions. It is only a multiplication if you want the area of the end of the board. It is not really very accurate. Memory has dimensions in a similar fashion:I'm sorry if my questions seem silly. But it is the first time for me to surf a datasheet of a microcontroller so it is confusing for some somehow.
Can you please explain what is this multiplication?
Nice explanationWhen you go the the lumber yard and ask for a 2 x 4 you get a board with specific dimensions. It is only a multiplication if you want the area of the end of the board. It is not really very accurate. Memory has dimensions in a similar fashion:
2K x 16 = 2048 words by 16 bits each
4K x 16 = 4096 words by 16 bits each
8K x 16 = 8192 words by 16 bits each
In these cases the amount of memory you get is quite accurate.
Nice explanation. But multiplying by 16 means two bytes and we were talking of just one byte wide.When you go the the lumber yard and ask for a 2 x 4 you get a board with specific dimensions. It is only a multiplication if you want the area of the end of the board. It is not really very accurate. Memory has dimensions in a similar fashion:
2K x 16 = 2048 words by 16 bits each
4K x 16 = 4096 words by 16 bits each
8K x 16 = 8192 words by 16 bits each
In these cases the amount of memory you get is quite accurate.
No, the program memory and the data space are two different memories. The program memory is 16 bits wide, starts at address 0x0000 and goes up to some limit depending on which ATmega variant you have. The data space is 8 bits wide, stars at address 0x0000 and it also goes up to some maximum value. This design is called a Harvard architecture. The alternative is called a Princeton architecture where instructions and data occupy the same memory space. This architecture allows for self modifying instructions, the Harvard architecture does not.Nice explanation. But multiplying by 16 means two bytes and we were talking of just one byte wide.
This works for me so far. Can you suggest a book or an online course to study this stuff? Or you think this is not viable and I should be concentrating more about C programming and making fancy projects with the AVR and this should be enough?No, the program memory and the data space are two different memories. The program memory is 16 bits wide, starts at address 0x0000 and goes up to some limit depending on which ATmega variant you have. The data space is 8 bits wide, stars at address 0x0000 and it also goes up to some maximum value. This design is called a Harvard architecture. The alternative is called a Princeton architecture where instructions and data occupy the same memory space. This architecture allows for self modifying instructions, the Harvard architecture does not.
Atmel AVR architecture and instruction set were well thought of (though there are some idiosyncrasies which I will cover at some later point). It is a good starting point in order to learn about MCU architecture and how computers work. I would highly recommend that you learn to write code in ASM first before moving on to C if you really want to grasp the fundamentals of computer programming.This works for me so far. Can you suggest a book or an online course to study this stuff? Or you think this is not viable and I should be concentrating more about C programming and making fancy projects with the AVR and this should be enough?
I think this book is so interesting and I already started printing. Thank you.The best book that covers the foundations of MCU architecture and coding is:
https://www.nxp.com/docs/en/reference-manual/M68HC05TB.pdf
Although it is based on the Motorola/Freescale/NXP M68HC05 MCU most of it is still very relevant to what you are trying to learn.
Motorola?Don't get too wrapped up in learning this processor and it's peripherals. It is obsolete and no longer available except maybe on the gray market. They never did make a version with Flash for program memory.
Motorola does not exist anymore as a semiconductor manufacturer. The 68HC05 series wen end of life almost a decade ago.Motorola?
But the book is still useful as a general reference for microcontrollers, isn't it?Motorola does not exist anymore as a semiconductor manufacturer. The 68HC05 series wen end of life almost a decade ago.
Yes, but you'll have considerable difficulty it you want to acquire an actual part and try to use it. You would be better off learning a part for which development tools and part programming tools are available.But the book is still useful as a general reference for microcontrollers, isn't it?
I'd like to hear your suggestions. And thanks for much help.Yes, but you'll have considerable difficulty it you want to acquire an actual part and try to use it. You would be better off learning a part for which development tools and part programming tools are available.