













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














AVR specific examples Credit to Dr. Robucci for slide information
▫ HIGH(x) - upper 8 bits of a 16-bit word ▫ Low(x) - lower 8 bits of a 16-bit word ▫ SPH is stack pointer high ▫ SPL is stack pointer low
Syntax: .MACRO macroname Example: .MACRO SUBI16 ; Start macro definition subi @1,low(@0) ; Subtract low byte sbci @2,high(@0) ; Subtract high byte .ENDMACRO ; End macro definition .CSEG ; Start code segment SUBI16 0x1234,r16,r17 ; Sub.0x1234 from r17:r
LOG2(expression) returns the integer part of log2(expression) INT() Truncates a floating point expression to integer (i.e. discards fractional part) FRAC() Extracts fractional part of a floating point expression (i.e. discards integer part). Q7() Converts a fractional floating point expression to a form suitable for the FMUL/FMULS/FMULSU instructions. (sign + 7 - bit fraction) Q15() Converts a fractional floating point to the form returned by the FMUL/FMULS/FMULSY instructions (sign + 15-bit fraction). ABS() Returns the absolute value of a constant expression.
R25 and R