Texas Instruments MSP50C6xx User Manual

Page 149

Advertising
background image

Special Filter Instructions

4-63

Assembly Language Instructions

mov

A0,*nextSample

;Replace last sample with newest
sample

mov

*R0,A0

; and update the start of the

mov

*startOfBuff,R0

; circular buffer to here (R0)

First, the overflow mode must be reset. Next, R5 must be loaded with the wrap
around
value of the circular buffer. Wrap around happens automatically. This
tells the processor how many words to step back when the end of the circular
buffer is reached. This value must be negative and equal to N words even
though the buffer is N+1 words long. For example, suppose a four word circular
buffer starts at RAM location 0x0100 and ends at 0x0106 (N = 3). In order to
wrap around from location 0x0106 back to location 0x0100, the value 0x006
must be subtracted from 0x0106, giving 0x0100.

0x0100

TAGGED LOCATION

0x0106

0x0104

0x0102

Go back N words to
wrap around

R0 must point to the current starting point of the circular buffer. R1 must point
to the filter coefficients. The MR register must contain the first filter coefficient,
h[0]. R0 and R1 must be used this way. The filtering operation will not work if
the Rx registers are reversed. The following are the only allowable register
combinations,

R0 points to circular buffer and R1 points to filter coefficients
R2 points to circular buffer and R3 points to filter coefficients

Advertising