$$ \newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\dx}{\text{ dx}}
\newcommand{\rang}{\text{rang}}
\newcommand{\s}{\ \ \ \ \ \ }
\newcommand{\arrows}{\s \Leftrightarrow \s}
\newcommand{\Arrows}{\s \Longleftrightarrow \s}
\newcommand{\arrow}{\s \Rightarrow \s}
\newcommand{\c}{\bcancel}
\newcommand{\v}[2]{
\begin{pmatrix}
#1 \\
#2 \\
\end{pmatrix}
}
\newcommand{\vt}[3]{
\begin{pmatrix}
#1 \\
#2 \\
#3 \\
\end{pmatrix}
}
\newcommand{\stack}[2]{
\substack{
#1 \\
#2
}
}
\newcommand{\atom}[3]{
\substack{
#1 \\
#2
}
\ce{#3}
}
$$
AVR Ports
Naming
PORT{A, B, C, D}{1 ... 8}
Letters indicate what port we are talking about, and the numbers denote the pin.
AVR Ports
AVR ports are implemented with tri state buffers.
Setup input/output ports
LDI R16, 0x00 ;Loads R16 with 0b00000000
OUT DDRC,R16 ;Setup C as input
LDI R16, 0xff ;Loads R16 with 0b11111111
OUT PORTC,R16 ;Enable Pull-up resistors
>;Setup B as output
LDI R16, 0x15 ;Loads R16 with 0b11111111
OUT DDRB,R16 ;Set output to 0b00010101
LDI R16, 0xff
OUT DDRB,R16 ;Loads R16 with 0b11111111