Hi,
MSP430F5438(1st Board )Sound get Recorded Using MIC_Input_Channel (ADC12INCH_5)in ADC,I had Sent Data coming from ADC12MEM0 to Uart of another MSP430F5438 (Board 2nd).
Data Coming to Uart of Board 2nd are Buffer in RAM (1000bytes),I have to play Coming data Simultaneosly When 1st Board is sending Data.
Please go through this code.put some suggestion to help out.Thanks
This is Audio Record function
void audio_record() {
P6OUT |= BIT4;
P6OUT &= ~BIT5;
P6SEL |= BIT5;
TBCTL = TBSSEL_2; // Use SMCLK as Timer_B source
TBR = 0;
TBCCR0 = 2047; // Initialize TBCCR0 1 microsecond
TBCCR1 = 2047 - 100;
TBCCTL1 = OUTMOD_7;
TBCTL |= MC0;
ADC12CTL2 = ADC12RES_0; // Select 8-bit resolution
ADC12CTL0 = ADC12ON + ADC12SHT0_15;
ADC12CTL1 = ADC12SHP + ADC12CONSEQ_2 + ADC12SSEL_2 + ADC12SHS_3;
//Sequence of channels, once
ADC12MCTL0 = ADC12INCH_5 | ADC12EOS; //VeREF+ and VeREF-
halLcdPrint("recording", OVERWRITE_TEXT);
while (1) {
ADC12CTL0 |= ADC12ENC; //Enable
ADC12CTL0 |= ADC12SC; //Start conversion
ADC12IE = 0X01;
if (adc_flag == 1) {
adc_data = ADC12MEM0;
temp1[0] = (adc_data & 0X0F);
temp1[1] = (adc_data >> 4);
temp1[2] = '\0';
uart_send_string(temp1, 2);
adc_flag = 0;
}
}
}
This is Audio playback Function but using this also I didnot get any output
void audio_Playback() {
P6DIR |= BIT6;
P6OUT &= ~BIT6;
P6SEL |= BIT4;
TBCTL = TBSSEL_2 + TBIE; // Use SMCLK as Timer0_A source,
// Enable overflow interrupt
TBCCR0 = 255; // Set output resolution (8 bit)
// Add 10 counts of headroom for
// loading TBCCR1
TBCCR4 = 255 >> 1; // Default output ~Vcc/2
TBCCTL4 = OUTMOD_7 + CLLD_1; // Reset OUT1 on EQU1, set on EQU0
// Load TBCCR1 when TBR counts to 0
TBCTL |= MC0; // Start Timer_B in UP mode
__bis_SR_register(GIE);
while(1);
TBCTL = 0;
P6SEL &= ~BIT4;
}
#pragma vector=TIMERB1_VECTOR
__interrupt void TIMERB1_ISR(void) {
unsigned int k = 0;
static int counter = 0;
switch (TBIV) {
case 14:
if (++counter > 1) {
counter = 0;
TBCCR4 = audio_buf[k++];
if (k > 999) {
k = 0;
}
P1OUT ^= LED1;
}
}
}
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR(void) {
switch (__even_in_range(ADC12IV, 20)) {
case 6:
P1OUT |= BIT1;
ADC12IFG = 0X00;
adc_flag = 1;
break;
default:
break;
}
}