Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:multiasm:piot:chapter_4_3 [2026/01/10 20:37] pczekalskien:multiasm:piot:chapter_4_3 [2026/01/19 15:08] (current) marcin
Line 3: Line 3:
 Registers are a key element of AVR microcontrollers. There are various types of registers, including general-purpose, special-purpose, and status registers. General-purpose registers are used to store temporary data. Special registers control microcontroller functions, such as timers or ADC. Status registers store information about the processor state, such as carry or zero flags. Each register has a specific function and is accessible through particular assembler instructions. Registers allow quick access to data and control over the processor. Registers are a key element of AVR microcontrollers. There are various types of registers, including general-purpose, special-purpose, and status registers. General-purpose registers are used to store temporary data. Special registers control microcontroller functions, such as timers or ADC. Status registers store information about the processor state, such as carry or zero flags. Each register has a specific function and is accessible through particular assembler instructions. Registers allow quick access to data and control over the processor.
  
-AVR CPU General Purpose Working Registers (R0-R31, Fig. {{ref>avr_registers}})+AVR CPU General Purpose Working Registers (R0-R31)
  
 **R0-R15:**  **R0-R15:** 
Line 10: Line 10:
 **R16-R31:**  **R16-R31:** 
 General-purpose registers that can be used with immediate General-purpose registers that can be used with immediate
 +
 +Comparison Table: AVR Registers R0–R15 vs. R16–R31
 +
 +^  Feature                      R0–R15                                                            ^  R16–R31                                        ^
 +|  Instruction compatibility    Cannot be used with immediate instructions (LDI, CPI, ORI, ANDI)  |  Fully compatible with immediate instructions   |
 +|  Opcode encoding              Not encodable in 4‑bit register fields                            |  Encodable in all immediate‑type formats        |
 +|  Typical compiler usage      |  Less preferred; used for temporary or special roles                Preferred for arithmetic and logic operations  |
 +|  Special-purpose roles        R0: scratch<br>R1: constant zero                                  |  R26–R31 used as X/Y/Z pointer registers        |
 +|  Pointer support              No                                                                |  Yes: X, Y, Z pointers                          |
 +|  Efficiency                  |  Less efficient for immediate operations                            More efficient due to shorter opcodes          |
 +|  Multiplication involvement  |  R0/R1 used implicitly for results                                  Not used by multipliers                        |
 +|  Suitability in ASM          |  Limited; avoid with immediates; R0/R1 have special rules          |  Recommended for general ALU operations         |
 +|  GCC policy                  |  R1 must remain 0; R0 is volatile                                  |  Treated as normal general-purpose registers    |
  
 <figure avr_registers> <figure avr_registers>
-{{:en:multiasm:piot:avr_general_purpose_register.png?400|AVR Registers}}+{{en:multiasm:piot:avr_register1.svg?300|AVR Registers}}
 <caption>AVR Registers</caption> <caption>AVR Registers</caption>
 </figure> </figure>
Line 21: Line 34:
 R26-R31: These registers serve as 16-bit address pointers for indirect addressing of the data space. They are defined as X, Y, and Z registers. R26-R31: These registers serve as 16-bit address pointers for indirect addressing of the data space. They are defined as X, Y, and Z registers.
    
 +<figure avr_registers> 
 +{{en:multiasm:piot:x_y_z_registers.svg?400|Extended registers}} 
 +<caption>Etended Registers</caption> 
 +</figure>
 **Other registers:** **Other registers:**
  
Line 29: Line 45:
  
 EIND: Register concatenated with the Z-register, enabling indirect jump and call to the entire program space on MCUs with more than 64K words (128 KB) of program space. EIND: Register concatenated with the Z-register, enabling indirect jump and call to the entire program space on MCUs with more than 64K words (128 KB) of program space.
 +
 +<table Register properties>
 +<caption>Register properties</caption>
 +^  Register  ^  Purpose                              ^  Combined With  ^  Enables                                           ^
 +|  RAMPX      Extends data addressing              |  X register      Access to data above 64 KB using X                |
 +|  RAMPY      Extends data addressing              |  Y register      Access to data above 64 KB using Y                |
 +|  RAMPZ      Extends data and program addressing  |  Z register      Access to data and constants above 64 KB using Z  |
 +|  RAMPD      Extends data addressing              |  Z register      Direct access to data above 64 KB                 |
 +|  EIND      |  Extends program addressing            Z register      Jumps and calls to program memory above 128 KB    |
 +</table>
 +
 +All of the registers RAMPX, RAMPY, RAMPZ, RAMPD, and EIND are located in the extended I/O space of AVR microcontrollers. This area typically occupies addresses 0x3B–0x3F, although the exact address of each register depends on the specific AVR device. The precise locations can always be found in the Register Summary section of the device datasheet.
 +
 +
  
en/multiasm/piot/chapter_4_3.1768070262.txt.gz · Last modified: 2026/01/10 20:37 by pczekalski
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0