MIC

External sounds can be detected through MIC.

 

Things to Prepare

CM-530

 

Theory

If more than a certain level of sounds is detected on the MIC circuit, signals are made to I/O Port of the micro controller. External sounds can be detected by sensing the signals.

Refer to controller’s port for port and pin number in 05 MIC\APP\src\main.c

 

Source

int main(void)

{

/* System Clocks Configuration */

RCC_Configuration();

/* NVIC configuration */

NVIC_Configuration();

/* NVIC configuration */

GPIO_Configuration();

SysTick_Configuration();

GPIO_ResetBits(PORT_LED_POWER, PIN_LED_POWER);

 

while(1)

{

if( GPIO_ReadInputDataBit(PORT_MIC, PIN_MIC) != SET)

{

GPIO_ResetBits(PORT_LED_MANAGE, PIN_LED_MANAGE);

GPIO_ResetBits(PORT_LED_PROGRAM, PIN_LED_PROGRAM);

GPIO_ResetBits(PORT_LED_PLAY, PIN_LED_PLAY);

GPIO_ResetBits(PORT_LED_TX, PIN_LED_TX);

GPIO_ResetBits(PORT_LED_RX, PIN_LED_RX);

GPIO_ResetBits(PORT_LED_AUX, PIN_LED_AUX);

mDelay(1000);

}

else

{

GPIO_SetBits(PORT_LED_MANAGE, PIN_LED_MANAGE);

GPIO_SetBits(PORT_LED_PROGRAM, PIN_LED_PROGRAM);

GPIO_SetBits(PORT_LED_PLAY, PIN_LED_PLAY);

GPIO_SetBits(PORT_LED_TX, PIN_LED_TX);

GPIO_SetBits(PORT_LED_RX, PIN_LED_RX);

GPIO_SetBits(PORT_LED_AUX, PIN_LED_AUX);

}

}

return 0;

}

 

Result

When the MIC signals are detected, all LEDs are turned on and off for a second.