This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

collecting ADC output for audio signal as input.

Other Parts Discussed in Thread: MSP430F5438

 Hii I am working on MSP430F5438.

I am trying to take input from MIC and collecting ADC12MEM0 output in a 16 bit unsigned int continously ,and send it on UART.

on UART i got output only  dots(.), am not getting where i made mistake in coding. 

#define AUDIO_PORT_OUT            P6OUT
#define AUDIO_PORT_DIR            P6DIR
#define AUDIO_PORT_SEL          P6SEL
#define MIC_INPUT_PIN              BIT5
#define MIC_PWD_PIN                 BIT4

#define SAM_HLD_TM                    ADC12SHT0_5
#define ADC_ON                              ADC12ON
#define ADC_REF_ON                  ADC12REFON
#define ADC_REF_VOLT              ADC12REF2_5V
#define MULTI_SAM_MODE          ADC12MSC
#define CONV_MODE                  ADC12CONSEQ_2
#define CLK_SRC_SMCLK            ADC12SSEL_3
#define CLK_DIV                              ADC12DIV_5
#define SHP                                         ADC12SHP
#define SMP_HLD_SRC                   ADC12SHS_0
#define START_ADD                       ADC12CSTARTADD_0

#define AUDIO_CH_5                        ADC12INCH_5 
#define REF_VOLT                          ADC12SREF_1
#define ENB_CONV                         ADC12ENC
#define START_CONV                      ADC12SC

void adc_init()
{
halLcdClearScreen();
AUDIO_PORT_OUT |= MIC_INPUT_PIN; //P6.5 OUTPUT HIGH
AUDIO_PORT_DIR &= ~MIC_PWD_PIN; //SET MIC PWD INPUT DIRECTION
AUDIO_PORT_SEL |= MIC_INPUT_PIN; //SELECT PREIPHERAL SIGNSL TO PIN



ADC12CTL0 |= SAM_HLD_TM + ADC_ON + MULTI_SAM_MODE ; //Tsample = 16 clock cycle in sampling period :64MICROSECOND
//ADC CORE ENABLE

ADC12CTL0 |= ADC_REF_ON + ADC_REF_VOLT + ADC12OVIE; //Refrence generator voltage : 2.5V

ADC12CTL1 |= CONV_MODE + CLK_SRC_SMCLK + CLK_DIV + SMP_HLD_SRC + SHP; // Repeated single channel conversion mode
//smclk -clock source
//Clock divider : /5
// sample and hold time source select - adc
//sample-and-hold pulse-mode select - SAMPLING TIMER
ADC12CTL2 = ADC12RES_0; // Select 8-bit resolution

ADC12MCTL0|= AUDIO_CH_5 + IN_REF_VOLT ; // A5 Channel Selected

ADC12IE = 0X01;

ADC12CTL0 |= ENB_CONV + START_CONV ;

}//end of adc main


void adc_conversion()
{

if(adc_flag)
{

adc_mem_audio = ADC12MEM0;

audio_receive_buf[0] = adc_mem_audio >> 8;
audio_receive_buf[1] = adc_mem_audio & 0X00FF;
audio_receive_buf[2] = '\0';

 halUsbSendString(audio_receive_buf,3);
adc_flag = 0;
}
}

pls tell me what i have to change in it..

  • Priyanka Dhomne said:
    on UART i got output only  dots(.), am not getting where i made mistake in coding. 

    Probably none.

    Dots are usually spaceholders for non-printable characters. You are sending the conversion results as binary data to the PC. And the terminal program tries to print them as readable characters. The terminal program does not do any conversion from binary into a readable number. It expects ASCII characters and shows htem. And when no ASCII characters come in, the terminal program will show dots.

    You might want to try a terminal program that can show incoming data as hexadecimal values. then you'll see the binary values asn hexadecimal numbers .

**Attention** This is a public forum