\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{bladabuska} \pdfinfo{ /Title (avr-programming-part-i-assembly.pdf) /Creator (Cheatography) /Author (bladabuska) /Subject (AVR Programming - Part I: Assembly Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{008000} \definecolor{LightBackground}{HTML}{F7FBF7} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{AVR Programming - Part I: Assembly Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{bladabuska} via \textcolor{DarkBackground}{\uline{cheatography.com/173176/cs/37345/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}bladabuska \\ \uline{cheatography.com/bladabuska} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 27th February, 2023.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{The Assemby Basics (copy)}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Introduction}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{This Cheat Sheet is part of the Bladabuska's AVR Cheat Sheet Collection. This cheat sheet shows the basic syntax of the Assembly language for AVRs. All information in this cheat sheet is related to the AVR Assembler v2.0 from Microchip Technology Incorporated (formerly Atmel Corporation). The Assembly language for AVR microcontrollers is not case sensitive.% Row Count 8 (+ 8) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Note:}} If you use a different assembler software, you must adapt the information to your software.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{The Assemby Basics}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Comment}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Everything between a semicolon (;) and the end of the line is a comment and is ignored by the Assembler software. Comments are primarily used for code documentation, and to disable code sections for debugging purpose.% Row Count 5 (+ 5) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Line continuation}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{A backslash character (\textbackslash{}) placed at the end of a line is used to inform the preprocessor and the Assembler that the command continues on the next line.% Row Count 4 (+ 4) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Label Field}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{A label is a text identifier that starts with a letter (a-z or A-Z), a question mark (?) or an underscore character (\_), followed by zero or more letters, numbers, dollar signs (\$), question marks (?), or underscore characters (\_). Labels cannot contain spaces and must end with a colon character (:).% Row Count 7 (+ 7) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Integer constant}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Integer constants starts by a number or a radix specifier. If an integer starts with a non-zero number character (1-9), than no radix is specified and the integer is considered to be expressed in the decimal number system. Integers in binary notation must start with "0b", in hexadecimal notation with "0x" and in octal notation with a leading zero (0). No spaces are allowed inside the number, but underscore characters (\_) can be placed inside the number to increase readability.% Row Count 11 (+ 11) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.368 cm} x{1.656 cm} x{2.952 cm} x{1.224 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{Character constants}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{4}{x{8.4cm}}{Character constants are characters or escape sequences enclosed in single quotes ('). They and can be used anywhere an integer expression is allowed.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \{\{ac\}\}{\bf{sequence}} & \{\{ac\}\}{\bf{name}} & \{\{ac\}\}{\bf{symbol}} & \{\{ac\}\}{\bf{number}} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \textbackslash{}0 & Null \seqsplit{Character} & \{\{ac\}\}NUL & \{\{ac\}\}0x00 \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} \textbackslash{}a & Alert Bell & \{\{ac\}\}BEL & \{\{ac\}\}0x07 \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \textbackslash{}b & \seqsplit{Backspace} & \{\{ac\}\}BS & \{\{ac\}\}0x08 \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} \textbackslash{}t & \seqsplit{Horizontal} Tab & \{\{ac\}\}HT & \{\{ac\}\}0x09 \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} \textbackslash{}n & Line Feed "or newline" & \{\{ac\}\}LF & \{\{ac\}\}0x0A \tn % Row Count 17 (+ 3) % Row 7 \SetRowColor{white} \textbackslash{}v & Vertical Tab & \{\{ac\}\}VT & \{\{ac\}\}0x0B \tn % Row Count 19 (+ 2) % Row 8 \SetRowColor{LightBackground} \textbackslash{}f & Form Feed & \{\{ac\}\}FF & \{\{ac\}\}0x0C \tn % Row Count 21 (+ 2) % Row 9 \SetRowColor{white} \textbackslash{}r & Carriage Return & \{\{ac\}\}CR & \{\{ac\}\}0x0D \tn % Row Count 23 (+ 2) % Row 10 \SetRowColor{LightBackground} \textbackslash{}\textbackslash{} & \seqsplit{Backslash} & \{\{ac\}\}\textbackslash{} & \{\{ac\}\}0x5C \tn % Row Count 25 (+ 2) % Row 11 \SetRowColor{white} \textbackslash{}xHH & \seqsplit{Hexadecimal} Number & \{\{colspan=2\}\}Where {\emph{H}} is the digit in hexadecimal notation (0-9,A-F) & \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{1.368 cm} x{1.656 cm} x{2.952 cm} x{1.224 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{Character constants (cont)}} \tn % Row 12 \SetRowColor{LightBackground} \textbackslash{}000 & Octal Number & \{\{colspan=2\}\}Where {\emph{o}} is the digit in octal notation (0-7) & \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{String constant}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{A string\textasciicircum{}7\textasciicircum{} is any number of characters enclosed in double quotes (") taken literally, no escape sequences are recognized, and it is not NULL-terminated. Quoted strings may be concatenated according to the ANSI C convention (space character) or with the backslash character (line continuation) to form long strings and multiple line-spanning strings.% Row Count 8 (+ 8) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\textasciicircum{}7\textasciicircum{} Strings can only be used in conjun​ction with the {\bf{DB}} directive or with the {\bf{MESSAG​E}}, {\bf{W​ARN​ING​}} or {\bf{ERROR}} directives.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.128 cm} x{2.812 cm} x{2.66 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Operators}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{An operator is a (single or multiple) character(s) that executes an operation in one or more operands. Unary operators takes only one operand, placed after the operator. Binary operators takes two operands and are placed between then. The ternary conditional operator takes three operands. Operators can be grouped with paranthesis to receive maximum precedence.} \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} \{\{ac\}\}{\bf{Operator}} & \{\{ac\}\}{\bf{Operation}} & \{\{ac\}\}{\bf{Precedence\textasciicircum{}3\textasciicircum{}}} \tn % Row Count 10 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{\{\{ac\}\}{\bf{Arithmetic Operators}}} \tn % Row Count 11 (+ 1) % Row 3 \SetRowColor{white} \{\{ac\}\}+ & Addition & \{\{ac\}\}12 \tn % Row Count 12 (+ 1) % Row 4 \SetRowColor{LightBackground} \{\{ac\}\}- & Subtraction & \{\{ac\}\}12 \tn % Row Count 13 (+ 1) % Row 5 \SetRowColor{white} \{\{ac\}\}- & Unary minus & \{\{ac\}\}14 \tn % Row Count 14 (+ 1) % Row 6 \SetRowColor{LightBackground} \{\{ac\}\}\% & Modulo\textasciicircum{}4\textasciicircum{} & \{\{ac\}\}13 \tn % Row Count 15 (+ 1) % Row 7 \SetRowColor{white} \{\{ac\}\}* & \seqsplit{Multiplication} & \{\{ac\}\}13 \tn % Row Count 16 (+ 1) % Row 8 \SetRowColor{LightBackground} \{\{ac\}\}/ & Division & \{\{ac\}\}13 \tn % Row Count 17 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{3}{x{8.4cm}}{\{\{ac\}\}{\bf{Bitwise Operators}}} \tn % Row Count 18 (+ 1) % Row 10 \SetRowColor{LightBackground} \{\{ac\}\}\textasciitilde{} & Bitwise NOT & \{\{ac\}\}14 \tn % Row Count 19 (+ 1) % Row 11 \SetRowColor{white} \{\{ac\}\}\& & Bitwise AND & \{\{ac\}\}8 \tn % Row Count 20 (+ 1) % Row 12 \SetRowColor{LightBackground} \{\{ac\}\}| & Bitwise OR & \{\{ac\}\}6 \tn % Row Count 21 (+ 1) % Row 13 \SetRowColor{white} \{\{ac\}\}\textasciicircum{} & Bitwise XOR & \{\{ac\}\}7 \tn % Row Count 22 (+ 1) % Row 14 \SetRowColor{LightBackground} \{\{ac\}\}\textless{}\textless{} & Shift Left & \{\{ac\}\}11 \tn % Row Count 23 (+ 1) % Row 15 \SetRowColor{white} \{\{ac\}\}\textgreater{}\textgreater{} & Shift Right & \{\{ac\}\}11 \tn % Row Count 24 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{\{\{ac\}\}{\bf{Logic Operators}}} \tn % Row Count 25 (+ 1) % Row 17 \SetRowColor{white} \{\{ac\}\}! & Logical NOT & \{\{ac\}\}14 \tn % Row Count 26 (+ 1) % Row 18 \SetRowColor{LightBackground} \{\{ac\}\}\&\& & Logical AND & \{\{ac\}\}5 \tn % Row Count 27 (+ 1) % Row 19 \SetRowColor{white} \{\{ac\}\}|| & Logical OR & \{\{ac\}\}4 \tn % Row Count 28 (+ 1) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{\{\{ac\}\}{\bf{Relational Operators}}} \tn % Row Count 29 (+ 1) % Row 21 \SetRowColor{white} \{\{ac\}\}\textless{} & Less than & \{\{ac\}\}10 \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.128 cm} x{2.812 cm} x{2.66 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{Operators (cont)}} \tn % Row 22 \SetRowColor{LightBackground} \{\{ac\}\}\textgreater{}= & Less than or equal to & \{\{ac\}\}10 \tn % Row Count 2 (+ 2) % Row 23 \SetRowColor{white} \{\{ac\}\}\textgreater{} & Greater than & \{\{ac\}\}10 \tn % Row Count 3 (+ 1) % Row 24 \SetRowColor{LightBackground} \{\{ac\}\}\textgreater{}= & Greater than or equal to & \{\{ac\}\}10 \tn % Row Count 5 (+ 2) % Row 25 \SetRowColor{white} \{\{ac\}\}== & Equal to & \{\{ac\}\} \tn % Row Count 6 (+ 1) % Row 26 \SetRowColor{LightBackground} \{\{ac\}\}!= & Different from & \{\{ac\}\} \tn % Row Count 7 (+ 1) % Row 27 \SetRowColor{white} \mymulticolumn{3}{x{8.4cm}}{\{\{ac\}\}{\bf{Ternary Conditional Operator}}} \tn % Row Count 8 (+ 1) % Row 28 \SetRowColor{LightBackground} \{\{ac\}\}? : & Ternary Conditional\textasciicircum{}5\textasciicircum{} & \{\{ac\}\}3 \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{\textasciicircum{}3\textasciicircum{} The higher the precedence, the higher the priority. \newline \textasciicircum{}4\textasciicircum{} This operator was introduced in AVR Assembler v2.0. \newline \textasciicircum{}5\textasciicircum{} This operator was introduced in AVR Assembler v2.1.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Assembler directive}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Assembler directives starts with a dot (.). They are used to guide the Assembler software on how to understand or implement some part of the code. Assembly directives can be used to define macros, code segments, conditional sections and symbols, to reserve memory space for data, and to implement debug features.\textasciicircum{}7\textasciicircum{}% Row Count 7 (+ 7) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\textasciicircum{}7\textasciicircum{} Refer to the {\bf{Assembler Directives Table}} to a complete list of available Assembler directives.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Function}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Functions are built-in macro functions that can be used to evaluate code.} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{LOW(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the low byte (bits 7-0) of an expression.} \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{HIGH(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the second byte (bits 15-8) of an expression.} \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{BYTE2(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the second byte (bits 15-8) of an expression.} \tn % Row Count 11 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{BYTE3(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the third byte (bits 23-16) of an expression.} \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{BYTE4(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the fourth byte (bits 31-24) of an expression.} \tn % Row Count 17 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{LWRD(expresion)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the low word (bits 15-0) of an expression.} \tn % Row Count 20 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{HWRD(expresion)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the second word (bits 31-16) of an expression.} \tn % Row Count 23 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{PAGE(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns bits 21-16 of an expression.} \tn % Row Count 25 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{EXP2(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns 2 to the power of expression.} \tn % Row Count 27 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{LOG2(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the integer part of a log2(expression).} \tn % Row Count 29 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{INT(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Truncates a floating point expression to integer.} \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Function (cont)}} \tn % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{FRAC(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Extracts fractional part of a floating point expression.} \tn % Row Count 3 (+ 3) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Q7(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Converts a fractional floating point expression to a form suitable for the multiplication instructions. (Sign + 7-bit fraction)} \tn % Row Count 7 (+ 4) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Q15(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Converts a fractional floating point expression to a form suitable for the multiplication instructions. (Sign + 15-bit fraction)} \tn % Row Count 11 (+ 4) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{ABS(expression)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the absolute value of a constant expression.} \tn % Row Count 14 (+ 3) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{DEFINED(symbol)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns 1 if symbol was previously defined (using .SET, .DEF, or .EQU directives), 0 otherwise. Normally used in conjunction with .IF and .ELIF directives. It does not require parentheses around its argument.} \tn % Row Count 20 (+ 6) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{STRLEN(string)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Returns the length of a string constant, in bytes.} \tn % Row Count 23 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Assembler Directives Table}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Source Segments}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.CSEG\textasciicircum{}A\textasciicircum{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Defines the start of a CODE segment. CODE segments have their own location counter (in words), starting at 0.} \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.DSEG\textasciicircum{}A\textasciicircum{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Defines the start of a DATA segment. DATA segments have their own location counter (in bytes), starting at the first address after the I/O registers (0x60 or 0x100, depending on the number of peripherals).} \tn % Row Count 11 (+ 6) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.ESEG\textasciicircum{}A\textasciicircum{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Defines the start of an EEPROM segment. EEPROM segments have their own location counter (in bytes), starting at 0.} \tn % Row Count 15 (+ 4) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.ORG \textless{}address\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Sets the location counter (of the segment were it was pĺaced) to an absolute value.} \tn % Row Count 18 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Reserve Memory Space}}} \tn % Row Count 19 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.BYTE\textasciicircum{}LC\textasciicircum{} \textless{}number\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Reserves a number of BYTES in SRAM or EEPROM memories. The directive takes one parameter, which is the number of bytes to reserve.} \tn % Row Count 23 (+ 4) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.DB\textasciicircum{}LD\textasciicircum{} \textless{}list\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Reserves a number of BYTES in PROGRAM or EEPROM memory.} \tn % Row Count 26 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.DW\textasciicircum{}LD\textasciicircum{} \textless{}list\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Reserves a number of WORDS (2 BYTES) in PROGRAM or EEPROM memory.} \tn % Row Count 29 (+ 3) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.DD\textasciicircum{}LD\textasciicircum{} \textless{}list\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Reserves a number of DOUBLE-WORDS (4 BYTES) in PROGRAM or EEPROM memory.} \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Assembler Directives Table (cont)}} \tn % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.DQ\textasciicircum{}LD\textasciicircum{} \textless{}list\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Reserves a number of QUAD-WORDS (8 BYTES) in PROGRAM or EEPROM memory.} \tn % Row Count 3 (+ 3) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{User Defined Symbols}}} \tn % Row Count 4 (+ 1) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.EQU \textless{}symbol\textgreater{}=\textless{}expression\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Assigns a user defined symbol to a value or expression. A symbol assigned to a value by the EQU directive is a constant and {\bf{cannot be}} changed or redefined.} \tn % Row Count 9 (+ 5) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.SET \textless{}symbol\textgreater{}=\textless{}expression\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Assigns a user defined symbol to a value or expression. A symbol assigned to a value by the SET directive {\bf{can be}} changed or redefined later in the program.} \tn % Row Count 14 (+ 5) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.DEF \textless{}symbol\textgreater{}=\textless{}register\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Assigns a user defined symbol to a register. A register can have several symbolic names attached to it. A symbol {\bf{can be}} redefined later in the program.} \tn % Row Count 19 (+ 5) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.UNDEF \textless{}symbol\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Undefine a symbol previously defined with the DEF directive. This provides a way to obtain a simple scoping of register definitions, avoiding warnings about register reuse.} \tn % Row Count 24 (+ 5) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Macro Definition}}} \tn % Row Count 25 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.MACRO \textless{}name\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Defines the start of the macro. It takes the macro name as a parameter. A macro is marked with a + in the opcode field of the listfile.} \tn % Row Count 29 (+ 4) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.ENDMACRO/.ENDM} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Defines the end of a macro definition. ENDM is a synonym to ENDMACRO directive.} \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Assembler Directives Table (cont)}} \tn % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{File Management}}} \tn % Row Count 1 (+ 1) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.INCLUDE \textless{}file\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Tells the Assembler to start reading from a specified file. The Assembler then assembles the specified file until end of file (EOF) or an EXIT directive is encountered.} \tn % Row Count 6 (+ 5) % Row 21 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.EXIT} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Tells the Assembler to stop assembling the file. If an EXIT directive appears in an included file, the Assembler continues from the line following the INCLUDE directive in the file containing the INCLUDE directive.} \tn % Row Count 12 (+ 6) % Row 22 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Conditional Assembly}}} \tn % Row Count 13 (+ 1) % Row 23 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.IFDEF \textless{}symbol\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}If the symbol is defined, it will include code untill the corresponding ELSE directive.} \tn % Row Count 16 (+ 3) % Row 24 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.IFNDEF \textless{}symbol\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}If the symbol is not defined, it will include code untill the corresponding ELSE directive.} \tn % Row Count 19 (+ 3) % Row 25 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.IF \textless{}expression\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}If expression is evaluated different from 0, it will include code untill the corresponding ELSE, ELIF or ENDIF directive.} \tn % Row Count 23 (+ 4) % Row 26 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.ELIF \textless{}expression\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}It will include code until the corresponding ENDIF (or the next ELIF at the same level), if the expression is true, and the initial IF clause and its following ELIF clauses (if any) are also false.} \tn % Row Count 29 (+ 6) % Row 27 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.ELSE} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}It will include code until the corresponding ENDIF, if the initial IF clause and its following ELIF clauses (if any) are also false.} \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Assembler Directives Table (cont)}} \tn % Row 28 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.ENDIF} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Defines the end for the conditional IF, IFDEF, or IFNDEF directives.} \tn % Row Count 3 (+ 3) % Row 29 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Assembler Program Output}}} \tn % Row Count 4 (+ 1) % Row 30 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.MESSAGE\textasciicircum{}I\textasciicircum{} \textless{}string\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Output a message string.} \tn % Row Count 6 (+ 2) % Row 31 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.WARNING\textasciicircum{}I\textasciicircum{} \textless{}string\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Outputs a warning string, but does not halt assembling.} \tn % Row Count 9 (+ 3) % Row 32 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.ERROR\textasciicircum{}I\textasciicircum{} \textless{}string\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Outputs an error message string and halts the assembling.} \tn % Row Count 12 (+ 3) % Row 33 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Listfile Generation Control}}} \tn % Row Count 13 (+ 1) % Row 34 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.LIST} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Turn the listfile generation ON. The listfile is a combination of assembly source code, addresses, and opcodes. Listfile generation is turned on by default.} \tn % Row Count 18 (+ 5) % Row 35 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.NOLIST} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Turn listfile generation OFF.} \tn % Row Count 20 (+ 2) % Row 36 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.LISTMAC} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Turn macro expansion on. It tells the Assembler that when a macro is called, the expansion of the macro is to be shown on the listfile generated by the Assembler. The default is that only the macro-call with parameters is shown in the listfile.} \tn % Row Count 27 (+ 7) % Row 37 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Special Funcitons}}} \tn % Row Count 28 (+ 1) % Row 38 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.CSEGSIZE = \textless{}value\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}This directive is used to specify the size of the program memory block at the SRAM memory. This directive can only be used with {\emph{AT94K Series Field Programmable System Level Integrated Circuit Devices}}.} \tn % Row Count 34 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Assembler Directives Table (cont)}} \tn % Row 39 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{.OVERLAP\textasciicircum{}V\textasciicircum{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}This directive is for projects with special needs and should normally not be used.} \tn % Row Count 3 (+ 3) % Row 40 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{.NOOVERLAP\textasciicircum{}V\textasciicircum{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}This directive is for projects with special needs and should normally not be used.} \tn % Row Count 6 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\textasciicircum{}A\textasciicircum{} All segments of the same type will be concatenated into one single segment of that type when assembled. \newline \textasciicircum{}C\textasciicircum{} Cannot be used inside CODE segments. \newline \textasciicircum{}D\textasciicircum{} Cannot be used inside DATA segments. \newline \textasciicircum{}I\textasciicircum{} My be used in conditional assembly, \newline \textasciicircum{}L\textasciicircum{} In order to be able to refer to the reserved location, the directive should be preceded by a LABEL. \newline \textasciicircum{}V\textasciicircum{} Introduced in AVR Assembler v2.1.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Preprocessor Directives}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Preprocessor directives are lines whose first non-empty character is a hash symbol (\#). They are used to issue commands to the preprocessor.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Macro Definition}}} \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\#define \textless{}name\textgreater{} {[}\textless{}value\textgreater{}{]}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Define a preprocessor object-like macros that basically define a constant. If value is not specified, it is set to 1.} \tn % Row Count 8 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\#define \textless{}name({[}\textless{}arg\textgreater{}, \textless{}...\textgreater{}{]})\textgreater{} {[}\textless{}value\textgreater{}{]}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Define a preprocessor function-like macros that do parameter substitution. This macro must be called with the same number of arguments it is defined with. The left parenthesis must appear immediately after name (no spaces between), otherwise it will be interpreted as part of the value of a object-like macro. If value is not specified, it is set to 1.} \tn % Row Count 17 (+ 9) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\#undef \textless{}name\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Undefine macro name previously defined with a \#define directive. If name is not previously defined, the .undef directive is silently ignored.} \tn % Row Count 21 (+ 4) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Conditional Assembly}}} \tn % Row Count 22 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\#ifdef \textless{}name\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}All the following lines until the corresponding \#endif, \#else, or \#elif are conditionally assembled if name is previously \#defined. Shorthand for \#if defined (name).} \tn % Row Count 27 (+ 5) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\#ifndef \textless{}name\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}All the following lines until the corresponding \#endif, \#else, or \#elif are conditionally assembled if name is not \#defined. Shorthand for \#if !defined (name).} \tn % Row Count 32 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Preprocessor Directives (cont)}} \tn % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\#if \textless{}expression\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}All the following lines until the corresponding \#endif, \#else, or \#elif are conditionally assembled if expression evaluates to true (not equal to 0). Any undefined symbols used in expression are silently evaluated to 0.} \tn % Row Count 6 (+ 6) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\#elif \textless{}expression\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}All the following lines until the corresponding \#endif, \#else, or \#elif are conditionally assembled if expression evaluates to true (not equal to 0),and all previous \#if or \#elif expressions were evaluated to false. Any undefined symbols used in expression are silently evaluated to 0.} \tn % Row Count 14 (+ 8) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\#else} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}All the following lines until the corresponding \#endif are conditionally assembled if all previous \#if or \#elif expressions were evaluated to false.} \tn % Row Count 19 (+ 5) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\#endif} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Terminates a conditional block initiated with an \#if, \#ifdef, or \#ifndef directive.} \tn % Row Count 22 (+ 3) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Preprocessor Program Output}}} \tn % Row Count 23 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\#message \textless{}string\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Outputs string to standard output, but does not affect assembler error or warning counters.} \tn % Row Count 26 (+ 3) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\#warning \textless{}string\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Outputs string to standard error, and increments the assembler warning counter.} \tn % Row Count 29 (+ 3) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\#error \textless{}string\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Outputs string to standard error, increments the assembler error counter, and prevents the program of being successfully assembled.} \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Preprocessor Directives (cont)}} \tn % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{File Management}}} \tn % Row Count 1 (+ 1) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\#include "file"} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Include a file, searching in the current working directory first, then searching in the built-in known place.} \tn % Row Count 5 (+ 4) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\#include \textless{}file\textgreater{}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Include a file, searching in the built-in known place only, unless the current working directory is explicitly specified with a dot (.) entry in the include path.} \tn % Row Count 10 (+ 5) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{ac\}\}{\bf{Empty Directive}}} \tn % Row Count 11 (+ 1) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\#} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Does nothing. The line is removed by the preprocessor.} \tn % Row Count 14 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Note:}} \#pragma preprocessor directives will be treated in a separate topic.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Preprocessor Pre-defined Macros}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\_\_AVRASM\_VERSION\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. AVR Assembler version, encoded as (1000*major + minor)} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\_\_CORE\_VERSION\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}STRING. AVR core version.} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\_\_CORE\_coreversion\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. AVR core version value of the coreversion. For example: \_\_CORE\_V2\_\_} \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\_\_DATE\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}STRING. Build date in the format "Jun 28 2004".} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\_\_TIME\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}STRING. Build time in the format: "HH:MM:SS".} \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\_\_CENTURY\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. Build time century (tipically 20).} \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\_\_YEAR\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. Build time year, less century (0-99).} \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\_\_MONTH\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. Build time month (1-12).} \tn % Row Count 18 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\_\_DAY\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. Build time day (1-31).} \tn % Row Count 20 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\_\_HOUR\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. Build time hour (0-23).} \tn % Row Count 22 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\_\_MINUTE\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. Build time minute (0-59).} \tn % Row Count 24 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\_\_SECOND\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. Build time second (0-59).} \tn % Row Count 26 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\_\_FILE\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}STRING. Sorce file name.} \tn % Row Count 28 (+ 2) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\_\_LINE\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. Current line number in source file.} \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Preprocessor Pre-defined Macros (cont)}} \tn % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\_\_PART\_NAME\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}STRING. AVR part name.} \tn % Row Count 2 (+ 2) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\_\_partname\_\_} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}INTEGER. AVR part name value of the partname For example: \_\_ATmega8\_\_} \tn % Row Count 5 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Preprocessor directive}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Any line whose first non-empty character is a hash symbol (\#). It is used to issue command to the preprocessor, a software that runs before calling the Assembler program.\textasciicircum{}2,3,4\textasciicircum{}% Row Count 4 (+ 4) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\textasciicircum{}2\textasciicircum{} Refer to the {\bf{Preprocessor Directives Table}} for a complete list of available preprocessor directives. \newline \textasciicircum{}3\textasciicircum{} Refer to the {\bf{Preprocessor Pre-Defined Macro Table}} for a complete list of available preprocessor pre-defined macros. \newline \textasciicircum{}4\textasciicircum{} Refer to the {\bf{Preprocessor Pragma Directives}} for a complete list of available preprocessor pragma directives.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}