The following is taken from ATmega328-328P Data sheet.

enter image description here

According to this, I can access all the 32 registers in CPU using memory addresses. For example:

 unsigned char *register = 0x0;

will access the first register. Is this true? if so, then is this also possible to do on regular CPUs (like my laptop), since I thought you can only use a pointer to access memory and not CPU registers.

Is the register mapped into the SRAM in this case?


1 Answer 1


Microcontrollers tend to be simple compared to processors like you would find in your laptop. Most operating system make use of the higher security features that can prevent user programs from straying where they shouldn't be.

As far as registers being memory mapped, it really depends on the particular architecture, each CPU. They are not all the same.

Is the register mapped into the SRAM in this case?

The data address space maps the 32 general-purpose registers, all the I/O registers (including those also accessible through the I/O address space), and the RAM


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.