To start with SUM of RAM and IMMEDIATE value in Atmega32 using ATMEL STUDIO 7 Assembly .Load a single byte into a register from the data space. The Register File, I/O memory, and internal SRAM (and external SRAM if appropriate) make up the data space for components that have SRAM. The register file is the only component in the data space for components that don’t have SRAM. The address space of the EEPROM is distinct.
There must be a 16-bit address provided. There is only 64KB of memory available at this time for data segment access. To access memory larger than 64KB, the LDS instruction makes use of the RAMPD Register. In devices with more than 64KB of data capacity, a change must be made to the RAMPD in register located in the I/O area in order to access another data segment.
Let us understand this concept through a program in assembly language.
Firstly, we will include a header file.
CODE:
.INCLUDE “M32DEF.INC”
If you do not know how to include it, you can check by clicking here.
As we know that we cannot access the memory directly and also cannot add the immediate value in the memory directly.
And we know that to load the value in some memory location we use the LDS command. And in the LDS command the range of the registers is from R0 to R31.
LDS R2, 0X400 // ASSUME THAT AT LOCATION 0X400=33H
LDI R21,0X55 // R21=0X55
ADD R21,R2 // R21=R21+R2
BREAK
So, in the above piece of code, we loaded the value in the general purpose register R2. And then we loaded the immediate value 0x55 in the general purpose register R21. And then we added the R2 value in the general purpose register R21.
Now we will build and debug the solution and verify the results.
As we can see that R2 has the 0 value which means that the value on the memory location 0x400 is 0. And we have to assume this value is 33 as given in the statement.
DEBUG:
And in the next step we loaded the 0x55 value in the R21 which you can see below.
And at the end R2 value will be loaded in R21. As R2 has the 0 value so the result remain the same as you can see below.
Conclusion
Finally, exploring the Atmega32’s SUM of RAM and IMMEDIATE value using ATMEL STUDIO 7 Assembly offers a deep understanding of the field of microcontroller programming. Our comprehension of low-level processes is improved by this investigation, which also gives us the ability to fully utilize and optimize the capabilities of the Atmega32 microcontroller.
To comprehend in one sitting was more than enough. You should at least now be aware of the kind of operations that are possible with general purpose work registers. To fully understand this, you may need to read it more than once.
For Complete Trial Watch the Video: SUM of RAM and IMMEDIATE value in Atmega32 using ATMEL STUDIO 7 Assembly
For more blogs explore the website: https://ninjatech.live/