Data Transfer Instructions
Data Transfer Instructions
R1
LPM LDS
R0
SPM R2 STS
R31
DATA MEMORY
PROGRAM MEMORY
Bit and Bit Test Instructions
NOTE >>
sbi and cbi don't operate on all I/O registers.
These can only be used for "classic" I/O Ports and other
peripheral registers with addresses from 0 to 31 (0x00 to
0x1F).
Assembler directives
The directives are not translated directly into opcodes. Instead, they are used to
adjust the location of the program in memory,
Define macros
Initialize memory
ldi r16, 0
loop1: inc r16 ;this code differs slightly
out PortB, r16 ;find it
cpi r16, 10
brne loop1
Generating delay using loops
IO PORTS
Atmega8 is having total 3 i/o ports B-D
The AVR I/O Ports are pretty simple to understand. They have a Port register, a
Data Direction register and a Pin register. These are part of every I/O port in every
AVR.
PORT IO REGISTERS
PINB (8bit)
PORTB (8bit)
DDRB (8bit)
Port Diagram
IO instructions
The simplest I/O instructions are in and out.