This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:piot:chapter_4_3 [2026/02/17 15:12] – updated pictures jtokarz | en: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, | + | Registers are a key element of AVR microcontrollers. There are various types of registers, including general-purpose, |
| - | AVR CPU General | + | ==== General-purpose registers ==== |
| + | |||
| + | In the AVR architecture, | ||
| **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> |
| + | |||
| + | <table avr_register_comparison> | ||
| + | < | ||
| ^ Feature | ^ Feature | ||
| Line 17: | Line 23: | ||
| | Opcode encoding | | Opcode encoding | ||
| | Typical compiler usage | Less preferred; used for temporary or special roles | | Typical compiler usage | Less preferred; used for temporary or special roles | ||
| - | | Special-purpose roles | + | | Special-purpose roles |
| | Pointer support | | Pointer support | ||
| | Efficiency | | Efficiency | ||
| 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 | | GCC policy | ||
| + | </ | ||
| <figure avr_registers> | <figure avr_registers> | ||
| - | {{ en: | + | {{ en: |
| < | < | ||
| </ | </ | ||
| Line 35: | Line 42: | ||
| <figure extended_registers> | <figure extended_registers> | ||
| - | {{ en: | + | {{ en: |
| < | < | ||
| </ | </ | ||
| - | **Other registers:** | + | ==== Other registers |
| - | RAMPX, RAMPY, RAMPZ: Registers concatenated with the X-, Y-, and Z-registers, | + | **RAMPX, RAMPY, RAMPZ:** Registers concatenated with the X-, Y-, and Z-registers, |
| - | 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> | ||