Tip!
Using the following macros (for AVR Assembler only) will solve the
16-bit access problem when using symbolic debugging. If using the macros
both inside and outside an interrupt code, the cli and sei
instruction pair must be included (atomic operation).
MACROS:
.macro outw (cli) out @2, @0 out @2-1, @1 (sei) .endmacro .macro inw (cli) in @2, @0-1 in @1, @0 (sei) .endmacroUSAGE:
inw r17, r16, TCNT1H ; Reads the counter value outw TCNT1H, r17, r16 ; Writes the counter valueWhen using symbolic debugging in C, the entire C line is executed for each set. Therefore the 16-bit read or write problem will not occur in this situation in the real chip.
See Also