Special Considerations
5-4
AVR ICE 200 User Guide
5.6
16-bit I/O Access
(Timer 1 and A/D
Converter)
Reading or writing 16-bit values directly from AVR Studio can cause some problems. To
read, for example the counter value from timer 1, a 16-bit value, one of the bytes must
be stored in a temporary register. This temporary register will be corrupted if the 16-bit
value is read when the program execution is stopped.
©
Tip!
Using the following macros (for AVR assembler only) will solve the 16-bit
access problem when using symbolic debugging.
MACROS:
.macro outw
(cli)
out @2,
@0
out @2-1,
@1
(sei)
.endmacro
.macro inw
(cli)
in
@2, @0-1
in
@1, @0
(sei)
.endmacro
USAGE:
inw
r17, r16, TCNT1H
; Reads the counter value
outw
TCNT1H, r17, r16
; Writes the counter value
When using symbolic debugging in C, the entire C line is executed for each set. There-
fore the 16-bit read or write problem will not occur in this situation.
5.7
UART Data
Register
Reading the UART Data Register cleans the RXC bit in the UART Control Register.
Hence, the monitor program does not attempt to read the UART Data Register. There-
fore, the value displayed by AVR Studio for this register does not reflect the real value of
this register.
Содержание AVR ICE 200
Страница 1: ...ICE 200 User Guide ...
Страница 2: ......
Страница 6: ...Preface Read this First 1 2 AVR ICE 200 User Guide ...
Страница 10: ...Introduction 2 4 AVR ICE 200 User Guide ...
Страница 16: ...General Description 3 6 AVR ICE 200 User Guide ...
Страница 36: ...Appendix 6 4 AVR ICE 200 User Guide ...
Страница 37: ...Appendix AVR ICE 200 User Guide 6 5 ...
Страница 38: ...Appendix 6 6 AVR ICE 200 User Guide ...
Страница 39: ......