Bit Reverse Complex Library

mikroBasic PRO for PIC32 includes a Bit Reverse Complex Library for DSP engine. All routines work with fractional Q15 format.

Library Routines

BitReverseComplex

Prototype

sub procedure BitReverseComplex(dim indata as ^integer, dim log2N as word)

Description

This function does Complex (in-place) Bit Reverse re-organization.

Parameters
  • indata: pointer to the input complex array.
  • log2N: logarithm with the base 2 of the number of input complex pairs.
Returns

Nothing.

Requires

Nothing.

Example
program BitReverseComp

' 8 pairs of [Re, Im] values
dim   inputSamples as integer[16] ' { 0x4000, 0, 0x4000, 0, 0x4000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
      log2N        as word
' Twiddle factors for 8 pairs complex input values.
const Wn           as integer[8] = (0x7fff,0, 0x5A82, integer(0xA57E), 0, integer(0x8000), integer(0xA57E), integer(0xA57E))

sub procedure Init()

    inputSamples[0] = 0x4000
    inputSamples[1] = 0
    inputSamples[2] = 0x4000
    inputSamples[3] = 0
    inputSamples[4] = 0x4000
    inputSamples[5] = 0
    inputSamples[6] = 0
    inputSamples[7] = 0
    inputSamples[8] = 0
    inputSamples[9] = 0
    inputSamples[10] = 0
    inputSamples[11] = 0
    inputSamples[12] = 0
    inputSamples[13] = 0
    inputSamples[14] = 0
    inputSamples[15] = 0
    log2N = 3
  end sub

main:
  Init()
  FFT(@inputSamples, @Wn, log2N)
  BitReverseComplex(@inputSamples, log2N)
  asm nop end asm
end.
Notes

None.

Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code