Pumpkin, Inc.

Pumpkin User Forums

MSP430F169 - sound sampling

For issues specific to TI's MSP430 line of ultra-low-power microcontrollers, including compilers (e.g. Quadravox AQ430), IDEs (e.g. IAR Embedded Workbench) and development tools (e.g. TI MSP-FET430 Flash Emulation Tool).

MSP430F169 - sound sampling

Postby meirrot » Mon Apr 17, 2006 9:35 am

Hi all!

I'm trying to sample sound waves through the MSP eval. board , and no matter which sound wave I use - I get incorrect data.
when trying to sample "silence" I get constantly increasing samples.
the code i use is:

#include "msp430x16x.h"


__interrupt void ADC_ISR(void); // Prototype for ISR
long data[10][16];
int count;
float params[81];
int param;
int start_flg = 1;
void main(void)
{
int i,j;

WDTCTL = WDTPW + WDTHOLD; // Stop WDT
DCOCTL |= DCO0 + DCO1 + DCO2 ;

BCSCTL1 = DIVA_0 + RSEL0 + RSEL1 + RSEL2;

P6SEL |= 0x01; // P6.0 = analog input
P6DIR = 0xFE; // Init P6.x
P6OUT = 0xF0; // Set P6.4-7 to logic Hi

// setting the TAs' parameters:
// TAclk = smclk , source freq = 32k
// TA interrupt freq = 1
//
TACTL = TASSEL_1 + TACLR + ID_0; // TACLK = ACLK, clear TAR
TACCTL1 = OUTMOD_3; // TRCCR1 Set/Reset
TACCR0 = 5;
TACCR1 = 4;
ADC12CTL0 &= ~ENC;
ADC12CTL0 = ADC12TOVIE+ADC12OVIE+REFON + REF2_5V + ADC12ON+ SHT0_5; //+MSC; // 2.5V Ref, ADC12 on
ADC12CTL1 = SHS_1 + SHP + CONSEQ_2;//+ ADC12SSEL_1; // Start MEM8, TA1, Rpt Seq
ADC12MCTL0 = SREF_1 + INCH_0;
ADC12IE = 0x0001; // Enable IFGs for ADC12MEM0
ADC12CTL0 |= ENC + ADC12SC; // Enable conversions
TACTL |= MC_1; // Start Timer_A in up mode

for (;
{
_BIS_SR(LPM3_bits + GIE); // Enter LPM3 with ints
}
}


//ADC12 interrupt service routine
ADC12_ISR(ADC_ISR)
__interrupt void ADC_ISR(void)
{


ADC12IFG &= ~0x1;


// add current sample to the folded vector
data[count] = ADC12MEM0;
ADC12MEM0 = 0;
count++;

P1OUT ^= 0x02;

ADC12CTL0 &= ~ENC; // Clear ENC
ADC12CTL0 &= ~REFON; // Turn off VREF

// if this was the last sample of the current time slice

if (count != 3840)
{
ADC12CTL0 |= REFON;
ADC12CTL0 |= ENC; // if sampling wasn't over Re-enable conversions
}
else
{
ADC12CTL0 &= ~ENC + ~ADC12ON;
_NOP();
}

_bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(SR)
}

meirrot
 
Posts: 1
Joined: Sun Apr 16, 2006 11:00 pm

Return to TI's MSP430

Who is online

Users browsing this forum: No registered users and 1 guest

cron