This example demonstrates how to use the msp_max_q15 API to find the maximum value and index of a real vector.
#include "msp430.h"
#include <math.h>
#include <stdint.h>
#include <stdbool.h>
#include "DSPLib.h"
#define FS 8192
#define SAMPLES 200
#define SIGNAL_FREQUENCY 200
#define SIGNAL_AMPLITUDE 0.6
#define PI 3.1415926536
uint16_t uint16MaxIndex;
volatile uint32_t cycleCount;
extern void initSignal(void);
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
#ifdef __MSP430_HAS_PMM__
PM5CTL0 &= ~LOCKLPM5;
#endif
initSignal();
status =
msp_max_q15(&maxParams, input, &q15MaxVector, &uint16MaxIndex);
__no_operation();
}
void initSignal(void)
{
}