User manual

mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
643
Bit Reverse Complex Library
mikroBasic PRO for dsPIC30/33 and PIC24 includes a Bit Reverse Complex Library for DSP engine. All routines work
with fractional Q15 format.
Library Routines
- BitReverseComplex
BitReverseComplex
Prototype
sub procedure BitReverseComplex(dim log2N as word, dim byref ReIm as
word[1024])
Description This function does Complex (in-place) Bit Reverse re-organization.
Parameters - N: buffer length (must be the power of 2).
- ReIm: output sample(from FFT).
Returns Nothing.
Requires Nothing.
Example
dim InputSamples as word[512] ydata ‘ Y data is required by FFT routine
‘ See datasheet for your dsPIC to see Y data space limits.
...
‘ Perform FFT (DFT), 7 stages, 128 samples of complex pairs
‘ Twiddle factors are taken from help
FFT(8, word(@TwiddleCoeff_256), InputSamples)
‘ DFT buttery algorythm bit-reverses output samples.
‘ We have to restore them in natural order.
BitReverseComplex(8, InputSamples)
Notes Input samples must be in Y data space.