[Solved]AVR opcodes

Hi all

Just to satisfy my curiosity, is there an official Atmel (Microchip) document for the opcodes of e.g. the 328? If so, where does one find it?

// Edit
Up till now, my searches did not return anything.

// Edit
2018/01/21 Marked as solved

Just about any processor full datasheet.

https://www.microchip.com/wwwproducts/en/ATmega328#documents

Look for Instruction Set Manual

you'll probably also need to google: "arduino inline assembly" for assembler directives

Yours,
TonyWilk

I have downloaded a document titled Atmel 8-bit AVR Instruction Set. I don't have a link to it but I saved it under the name Atmega328 Instructions doc0856.pdf. Some or all of that name may have come from the Atmel website.

...R

Everyone thanks for the replies.

GrooveFlotilla:
Just about any processor full datasheet.

I have the full (complete) datasheet for the 328 (and a few other AVRs). I've not been able to find the opcodes in there, only the mnemonics.

TonyWilk:
Dynamic Product Page | Microchip Technology

Look for Instruction Set Manual

you'll probably also need to google: "arduino inline assembly" for assembler directives

Yours,
TonyWilk

Thanks, I could find it there. I could not open the doc on my phone, will try tomorrow on my PC.

this one!
this one also! (AVR Instruction Set with Instruction Templates.)

My own style of finding opcode/instruction for ATmega:
1. Write an assembly line using AVR Studio 4 or Atmel Studio 7.0. For example: ldi r17, 0x5F
2. Get the list file: 0031 e51f ldi r17, 0x5F
3. Draw the Instruction Template (from AVR Instruction Set): 1110 KKK dddd KKKK
Getting syntax from AVR Instruction Set: LDI Rd, K
Opcode: e (1110) = ldi
KKKK= upper 4-bit of source (data itself) = 5 = 0101
dddd = data destination register, Rd (index 0001) for r17; 0 for r16, 2 for r18 and, so on.
KKKK = lower 4-bit of source (data itself) = f = 1111

4. Finally, the opcode/instruction is: e51f (very very different from the opcode/instruction style of 8051 or 8086)

http://www.microchip.com/webdoc/avrassembler/avrassembler.wb_CP.html