75. LDS (16-bit) – Load Direct from Data Space
75.1. Description
Loads one byte from the data space to a register. For parts with SRAM, the data space consists of the
Register File, I/O memory, and internal SRAM (and external SRAM if applicable). For parts without
SRAM, the data space consists of the register file only. In some parts the Flash memory has been
mapped to the data space and can be read using this command. The EEPROM has a separate address
space.
A 7-bit address must be supplied. The address given in the instruction is coded to a data space address
as follows:
ADDR[7:0] = (INST[8], INST[8], INST[10], INST[9], INST[3], INST[2], INST[1], INST[0])
Memory access is limited to the address range 0x40...0xbf.
This instruction is not available in all devices. Refer to the device specific instruction set summary.
Operation:
(i) Rd ← (k)
Syntax: Operands: Program Counter:
(i) LDS Rd,k 16 ≤ d ≤ 31, 0 ≤ k ≤ 127 PC ← PC + 1
16-bit Opcode:
1010 0kkk dddd kkkk
75.2. Status Register (SREG) and Boolean Formula
I T H S V N Z C
– – – – – – – –
Example:
lds r16,$00 ; Load r16 with the contents of data space location $00
add r16,r17 ; add r17 to r16
sts $00,r16 ; Write result to the same address it was fetched from
Words 1 (2 bytes)
Cycles 1
Note: Registers r0...r15 are remapped to r16...r31.
Atmel AVR Instruction Set Manual [OTHER]
Atmel-0856L-AVR-Instruction-Set-Manual_Other-11/2016
117