EasyManua.ls Logo

Microchip Technology dsPIC30F - Page 71

Microchip Technology dsPIC30F
738 pages
Print Icon
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...
© 2004 Microchip Technology Inc. DS70050C-page 3-11
Section 3. Data Memory
Data Memory
3
3.3.2 W Address Register Selection
The X address space pointer W register (XWM) to which modulo addressing is to be applied, is
stored in MODCON<3:0> (see Register 3-1). The XMODSRT, XMODEND, and the XWM
register selection are shared between the X RAGU and X WAGU. Modulo addressing is enabled
for X data space when XWM is set to any value other than 15 and the XMODEN bit is set
(MODCON<15>). W15 cannot be used as the pointer for modulo addressing because it is the
dedicated software stack pointer.
The Y address space pointer W register (YWM) to which modulo addressing is to be applied, is
stored in MODCON<7:4> (see Register 3-2). Modulo addressing is enabled for Y data space
when YWM is set to any value other than 15 and the YMODEN bit is set (MODCON<14>).
3.3.3 Modulo Addressing Applicability
Modulo addressing can be applied to the effective address (EA) calculation associated with the
selected W register. It is important to realize that the address boundary tests look for addresses
equal to or greater than the upper address boundary for incrementing buffers and equal to or less
than the lower address boundary for decrementing buffers. Address changes may, therefore,
jump over boundaries and still be adjusted correctly. Remember that the automatic adjustment
of the W register pointer by the modulo hardware is uni-directional. That is, the W register pointer
may not be adjusted correctly by the modulo hardware when the W register pointer for an
incrementing buffer is decremented and vice versa. The exception to this rule is when the buffer
length is an even power of 2 and the start and end addresses can be chosen to meet the
-boundary requirements for both incrementing and decrementing modulo buffers.
A new EA can exceed the modulo buffer boundary by up to the length of the buffer and still be
successfully corrected. This is important to remember when the Register Indexed ([Wb + Wn])
and Literal Offset ([Wn + lit10]) Addressing modes are used. The user should remember that
the Register Indexed and Literal Offset Addressing modes do not change the value held in the
W register. Only the indirect with Pre- and Post-modification Addressing modes ([Wn++],
[Wn--], [++Wn], [--Wn]) will modify the W register address value.
Note: A write to the MODCON register should not be followed by an instruction that
performs an indirect read operation using a W register. Unexpected results may
occur. Some instructions perform an implicit indirect read. These are:POP,
RETURN, RETFIE, RETLW and ULNK.

Table of Contents

Other manuals for Microchip Technology dsPIC30F