When I read about registers I always encounter the following illustration:

enter image description here

So there are 32 registers in the above diagram. They are processor registers.

But in the data-sheet of ATmega328P at page 428 there is a section called "Register Summary".

Here in that list there are much more than 32 registers. Do the rest of the registers physically stay somewhere else?

Lest's take an example of ADMUX register. Where is that register physically inside the DIP? It is not one of the 32 registers? And if stays somewhere else how does it connected to the ALU?

  • Physical location or memory location? The datasheetss has the later. – dannyf Feb 23 '17 at 14:14
  • I mean is ADMUX one of those 32 reg? – user16307 Feb 23 '17 at 14:51
  • In the table that you refer to, ADMUX is mapped to memory location 0x7C. – 6v6gt Feb 23 '17 at 15:29
  • No, R0 to R31 are General Purpose registers for use in your application. The compiler usually takes care of using them appropriately. All the other registers are special purpose and can only be utilised explicitly. Those registers form the state machine of the MCU. – Kwasmich Feb 23 '17 at 15:29
  • Is GPIO a subset of SFR? – user16307 Feb 23 '17 at 18:26

You are confusing CPU registers and SFRs, Special Function Registers.

CPU registers only exist within the CPU core. SFRs exist within the RAM bus's memory map.

CPU registers are used by the CPU to execute instructions and do calculations, etc. SFRs are a part of the logic of the rest of the chip and directly affect the working of the various peripherals.

As far as the CPU is concerned an SFR is just a bit of SRAM, but it affects physical workings when written to, and reflects physical states when read from.

  • Chapter 8.3 in the ATMEGA328P datasheet (ver 10/2014) has a memory map of SRAM. Here it uses the term IO Register and Extended IO Register to refer to the Special Function Registers. – 6v6gt Feb 23 '17 at 15:47
  • Every manufacturer has their own name for them. SFR is an accepted standard name for the concept. – Majenko Feb 23 '17 at 15:48
  • Are those 32 registers called GPIO? – user16307 Feb 23 '17 at 17:27
  • No. They are called registers. They are the internal memory of the CPU. You have very limited access to them in C, but in assembly they are all you have for doing any form of calculations with. – Majenko Feb 23 '17 at 17:32
  • Some wrote under my question that they re called general purpose registers. Is that right? – user16307 Feb 23 '17 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.