dsPIC30F Family Reference Manual
DS70050C-page 3-18 © 2004 Microchip Technology Inc.
3.4.4 Bit-Reversed Addressing Code Example
The following code example reads a series of 16 data words and writes the data to a new location
in bit-reversed order. W0 is the read address pointer and W1 is the write address pointer subject
to bit-reverse modification.
; Set XB for 16-word buffer, enable bit reverse addressing
MOV #0x8008,W0
MOV W0,XBREV
; Setup MODCON to use W1 for bit reverse addressing
MOV #0x01FF,W0
MOV W0,MODCON
; W0 points to input data buffer
MOV #Input_Buf,W0
; W1 points to bit reversed data
MOV #Bit_Rev_Buf,W1
; Re-order the data from Input_Buf into Bit_Rev_Buf
REPEAT #15
MOV [W0++],[W1++]
3.5 Control Register Descriptions
The following registers are used to control modulo and bit-reversed addressing:
• MODCON: Modulo Addressing Control Register
• XMODSRT: X AGU Modulo Start Address Register
• XMODEND: X AGU Modulo End Address Register
• YMODSRT: Y AGU Modulo Start Address Register
• YMODEND: Y AGU Modulo End Address Register
• XBREV: X AGU Bit-Reverse Addressing Control Register
A detailed description of each register is provided on subsequent pages.