Jump to content
  • 0

BASYS MX3 Microphone doesn't change


MiguelD14

Question

Hello,

I was trying to read value from the MX3's microphone. When I'm using the fonction MIC_value() from the library mic.h, I only get value around 512. What is the unit of the value that I receive from this function ? Is it the amplitude of the signal ? Also, in the user guide, they said that if we change the potentiometer, it doesn't change the value that we read at all. I don't understand why.

/* 
 * File:   main.c
 * Author: gout2401
 *
 * Created on 28 juin 2019, 09:47
 */

#include <stdio.h>
#include <stdlib.h>
#include <sys/attribs.h> // include in timer
#include <xc.h> // include in config_bits
#include <time.h> // librairie de base
#include <string.h>
#include "lcd.h"
#include "config.h"
#include "horloge.h"
#include "uart.h"

unsigned short *buffer;
int cntBuf1 = 5;
int ind;
unsigned int value;
char value_aff[5];

void main() {
    ind = 0;
    
    LCD_Init();
    AUDIO_Init(2);
    MIC_Init();
    while(ind < 10000){
        value = MIC_Val();
        sprintf(value_aff,"%d", value);
        LCD_WriteStringAtPos(value_aff, 0, 0);
        
        ind = ind + 1;
        DelayAprox10Us(10000);
    }
    LCD_DisplayClear();
    AUDIO_Close();
    DelayAprox10Us(10);
}

thanks

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hi @MiguelD14,

Welcome to the Digilent Forums!

MIC_VAL returns the digital value corresponding to the MIC analog pin

 as the result of analog to digital conversion performed by the ADC module.

 It can be used to sample the microphone input.

Here is a good thread that discusses what the ADC value means in reference to audio.

Have you tried using a verified demo like the Audio demo?

best regards,

Jon

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...