EasyManua.ls Logo

Microchip Technology dsPIC30F - Page 70

Microchip Technology dsPIC30F
738 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
dsPIC30F Family Reference Manual
DS70050C-page 3-10 © 2004 Microchip Technology Inc.
An additional condition exists for indirect read operations performed immediately after writing to
the modulo address SFRs:
•XMODSRT
XMODEND
•YMODSRT
YMODEND
If modulo addressing has already been enabled in MODCON, then a write to the X (or Y) modulo
address SFRs should not be immediately followed by an indirect read, using the W register
designated for modulo buffer access from X-data space (or Y-data space). The code segment in
Example 3-3 shows how initializing the modulo SFRs associated with the X-data space, could
lead to unexpected results. A similar example can be made for initialization in Y-data space.
Example 3-3: Incorrect Modulo Addressing Setup
To work around this issue, insert a NOP, or perform any operation other than an indirect read that
uses the W register designated for modulo buffer access, after initializing the modulo address
SFRs. This is demonstrated in Example 3-4. Another alternative would be to enable modulo
addressing in MODCON after initializing the modulo start and end address SFRs.
Example 3-4: Correct Modulo Addressing Setup
MOV #0x8FF4, w0 ;Modulo addressing enabled
MOV w0, MODCON ;in X-data space using w4
;for buffer access
MOV #0x1200, w4 ;XMODSRT is initialized
MOV w4, XMODSRT
MOV #0x12FF, w0 ;XMODEND is initialized
MOV w0, XMODEND
MOV [w4++], w5 ;Incorrect EA generated
MOV #0x8FF4, w0 ;Modulo addressing enabled
MOV w0, MODCON ;in X-data space using w4
;for buffer access
MOV #0x1200, w4 ;XMODSRT is initialized
MOV w4, XMODSRT
MOV #0x12FF, w0 ;XMODEND is initialized
MOV w0, XMODEND
NOP ;See Note below
MOV [w4++], w5 ;Correct EA generated here
Note: Alternatively, execute other instructions that do not perform indirect read operations,
using the W register designated for modulo buffer access.

Table of Contents

Other manuals for Microchip Technology dsPIC30F