This is an old revision of the document!


Instruction Set

The assembler instruction set includes arithmetic, logical, control, and input/output operations. Arithmetic instructions include addition, subtraction, multiplication, and division. Logical instructions include operations such as AND, OR, XOR, and NOT. Control instructions include jumps, loops, and conditions. Input/output instructions include operations on ports and registers. Understanding the instruction set is crucial for effective programming in assembler. This course will discuss the most commonly used instructions and their application in assembly code. Practical examples will show how to use instructions in AVR programming. The instruction set allows full control over the processor and its functions.

Basic instructions

The following data transfer instructions are available:

  • ldi load immediate
  • mov copy register
  • movw copy register pair

The following logical instructions are available:

  • and logical AND
  • andi logical AND with immediate
  • or logical OR
  • ori logical OR with immediate
  • eor exclusive OR
  • com one's complement
  • neg two's complement

The following arithmetic instructions are available:

  • add add without carry
  • adc add with carry
  • adiw add immediate to word
  • sub subtract without carry
  • subi subtract immediate
  • sbc subtract with carry
  • sbci subtract immediate with carry
  • sbiw subtract immediate from word
  • inc increment
  • dec decrement
  • mul multiply unsigned(1)
  • muls multiply signed(1)
  • mulsu multiply signed with unsigned(1)
  • fmul fractional multiply unsigned(1)
  • fmuls fractional multiply signed(1)
  • fmulsu fractional multiply signed with unsigned(1)

(1) Not all processors support commands

The following bit shift instructions are available:

  • lsl logical shift left
  • lsr logical shift right
  • rol rotate left through carry
  • ror rotate right through carry
  • asr arithmetic shift right

The following bit manipulation instructions are available:

  • sbr set bit(s) in register
  • cbr clear bit(s) in register
  • ser set register
  • clr clear register
  • swap swap nibbles
en/multiasm/piot/chapter_4_7.1782157303.txt.gz · Last modified: 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