msp430 BMP counter, its getting there

Doing some more testing on my BPM counter,  the beat detection circuit is getting closer and closer.

 

Using NightBass “Sky Ride extended mix(A1)”  I have tested the circuit and finally have some results.  See video below.

The signal is coming from my turntable, through the mixer, and into my low pass filter, then the signal is read by the SD16, every time the threshold is reached the LED is turned on.

 

Test Code

/*****************************************************************************/
//Author- Justin Solarski
//Copyright 2011 justinstech.org
#include
/*****************************************************************************/
volatile unsigned int results = 0;
/*****************************************************************************/
/*****************************************************************************/
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
//basic clock settings
DCOCTL = CALDCO_1MHZ;
BCSCTL1 = CALBC1_1MHZ;
BCSCTL2 |= DIVS_3; //divide smclk/8 125000Hz
//GPIO setup
P2DIR |= BIT7;
P1DIR |= BIT6;
//sd16 settings
SD16CTL = SD16REFON + SD16SSEL_1; // 1.2V ref, SMCLK
//SD16CTL |= SD16XDIV_3; //
SD16INCTL0 = SD16INCH_0; // A1+/- P1.2
SD16CCTL0 = SD16IE; // 256OSR, bipolar offset, interrupt enable
SD16AE = SD16AE0; // P1.0 A0+, A0- = VSS
SD16CCTL0 |= SD16SC; // Set bit to start conversion
_BIS_SR(LPM0_bits + GIE);
}
/*****************************************************************************/
// SD16 ISR
#define THRSHMAX 0xc000 // not used yet
#define THRSHMIN 0x4000 // not used yet
__attribute__((interrupt(SD16_VECTOR)))
void Sd16_Isr(void){ // 0000 - FFFF -- 8000 = halfway point or 1.2V
//P1DIR ^= BIT6;
results = SD16MEM0;
if (results < 0x4000) { //results is less then 0x4000 P1OUT |= BIT6; } else if ( results > 0xc000) { // results greater then 0x9000
P1OUT |= BIT6; }
else { P1OUT = 0; }
}

the code needs to be tweaked a little more to show better results, maybe adding a adjustable threshold would be nice. only a few more things to finish, like calculations of BPM and the 3x 7 segment display. hopefully it will be the majority will be finished sometime this next week, and then clean up and find a nice project box for everything.

once i get the calculations done I will do a bigger write up, explaining how it all works…….Please let me know what you think

Thanks
Justin