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/02/17 15:12] – updated pictures jtokarzen:multiasm:piot:chapter_4_3 [2026/03/01 17:43] (current) ktokarz
Line 1: Line 1:
 ====== Registers ====== ====== Registers ======
  
-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)+==== General-purpose registers ==== 
 + 
 +In the AVR architecture, there are 32 general-purpose registers belonging to two groups:
  
 **R0-R15:**  **R0-R15:** 
Line 11: Line 13:
 General-purpose registers that can be used with immediate instructions General-purpose registers that can be used with immediate instructions
  
-Comparison Table: AVR Registers R0–R15 vs. R16–R31+Table {{ref>avr_register_comparison}} presents a summary of AVR CPU General Purpose Working Registers (R0-R31) with their features. 
 + 
 +<table avr_register_comparison> 
 +<caption>Comparison Table: AVR Registers R0–R15 vs. R16–R31</caption> 
  
 ^  Feature                      R0–R15                                                            ^  R16–R31                                        ^ ^  Feature                      R0–R15                                                            ^  R16–R31                                        ^
Line 17: Line 23:
 |  Opcode encoding              Not encodable in 4‑bit register fields                            |  Encodable in all immediate‑type formats        | |  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  | |  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        |+|  Special-purpose roles        R0: scratch\\ R1: constant zero                                   |  R26–R31 used as X/Y/Z pointer registers        |
 |  Pointer support              No                                                                |  Yes: X, Y, Z pointers                          | |  Pointer support              No                                                                |  Yes: X, Y, Z pointers                          |
 |  Efficiency                  |  Less efficient for immediate operations                            More efficient due to shorter opcodes          | |  Efficiency                  |  Less efficient for immediate operations                            More efficient due to shorter opcodes          |
Line 23: Line 29:
 |  Suitability in ASM          |  Limited; avoid with immediates; R0/R1 have special rules          |  Recommended for general ALU operations         | |  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    | |  GCC policy                  |  R1 must remain 0; R0 is volatile                                  |  Treated as normal general-purpose registers    |
 +</table>
  
 <figure avr_registers> <figure avr_registers>
-{{ en:multiasm:piot:avr_register1.png?400 |AVR Registers}}+{{ en:multiasm:piot:avr_register1.png?600 |AVR Registers}}
 <caption>AVR Registers</caption> <caption>AVR Registers</caption>
 </figure> </figure>
Line 35: Line 42:
    
 <figure extended_registers> <figure extended_registers>
-{{ en:multiasm:piot:x_y_z_registers.png?400 |Extended registers}}+{{ en:multiasm:piot:x_y_z_registers.png?600 |Extended registers}}
 <caption>Extended Registers</caption> <caption>Extended Registers</caption>
 </figure> </figure>
-**Other registers:**+==== Other registers ====
  
-RAMPX, RAMPY, RAMPZ: Registers concatenated with the X-, Y-, and Z-registers, enabling indirect addressing of the entire data space on MCUs with more than 64 KB of data space, and constant data fetch on MCUs with more than 64 KB of program space.+**RAMPX, RAMPY, RAMPZ:** Registers concatenated with the X-, Y-, and Z-registers, enabling indirect addressing of the entire data space on MCUs with more than 64 KB of data space, and constant data fetch on MCUs with more than 64 KB of program space.
  
-RAMPD: Register concatenated with the Z-register, enabling direct addressing of the whole data space on MCUs with more than 64 KB data space.+**RAMPD:** Register concatenated with the Z-register, enabling direct addressing of the whole data space on MCUs with more than 64 KB data 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.+**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> <table Register properties>
en/multiasm/piot/chapter_4_3.1771333920.txt.gz · Last modified: by jtokarz
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