Crunch

Description

Crunch is a general purpose math library. This library currently supports Fast Fourier Transform.

FFT()

Direction Name Type Description
In pData UDINT Pointer to LREAL[Length] data set
In DataLength UDINT Length of pData array. This data length is required to be a power of 2 and can not exceed 2^15
In SampleFrequency UDINT Sample frequency of the input data
In pBinFrequency LREAL Pointer to an LREAL[Length/2] frequency for each bin
In pAmplitude UDINT Pointer to an LREAL[Length/2] amplitude of frequencies
In pPhase UDINT Pointer to an LREAL[Length/2] phase shift of frequencies
Return index UDINT Index of token in pTokenArray. Returns -1 if not found

Usage

    double Data[1024];
    FFT(&Data, sizeof(Data)/sizeof(Data[0]), SampleFrequency, &BinFrequency, &Amplitude, &Phase);