This example demonstrates how to use the msp_cmplx_add_q15 API to perform addition of two complex source vectors.
#include "msp430.h"
#include <math.h>
#include <stdint.h>
#include <stdbool.h>
#include "DSPLib.h"
#define FS 8192
#define SAMPLES 100
#define SIGNAL_FREQUENCY1 200
#define SIGNAL_AMPLITUDE1 0.6
#define SIGNAL_FREQUENCY2 700
#define SIGNAL_AMPLITUDE2 0.15
#define PI 3.1415926536
volatile uint32_t cycleCount;
extern void initSignal(void);
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
#ifdef __MSP430_HAS_PMM__
PM5CTL0 &= ~LOCKLPM5;
#endif
initSignal();
__no_operation();
}
void initSignal(void)
{
sinParams.
cosOmega =
_Q15(cosf(2*PI*1.5*SIGNAL_FREQUENCY1/FS));
sinParams.
sinOmega =
_Q15(sinf(2*PI*1.5*SIGNAL_FREQUENCY1/FS));
sinParams.
cosOmega =
_Q15(cosf(2*PI*1.5*SIGNAL_FREQUENCY2/FS));
sinParams.
sinOmega =
_Q15(sinf(2*PI*1.5*SIGNAL_FREQUENCY2/FS));
}