0% found this document useful (0 votes)
136 views5 pages

ADC y DAC Psoc Creator

The document describes a microcontroller project that uses a PSoC microcontroller to control volume levels for an audio output. It includes diagrams of the circuit design in PSoC Creator and on a protoboard. The code written in PSoC Creator is included, which defines functions to increase and decrease the volume level and uses an interrupt service routine to update the volume level displayed on an LCD screen. A link is also provided to a video demonstrating the project.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views5 pages

ADC y DAC Psoc Creator

The document describes a microcontroller project that uses a PSoC microcontroller to control volume levels for an audio output. It includes diagrams of the circuit design in PSoC Creator and on a protoboard. The code written in PSoC Creator is included, which defines functions to increase and decrease the volume level and uses an interrupt service routine to update the volume level displayed on an LCD screen. A link is also provided to a video demonstrating the project.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

UNIVERSIDAD DISTRITAL FRANCISCO JOSÉ DE

CALDAS
PROYECTO N°3 MICROCONTROLADORES
Carlos David Rojas Lozano – 20171005129

I. DIAGRAMA CIRCUITAL:

Diagrama en Psoc Creator:

Figura1. Diagrama circuital en PsocCreator

Montaje circuital:

Figura2. Montaje en protoboard


II. DESARROLLO:
Código Psoc Creator:
*/
#include "project.h"
uint16 audio,audio2;
uint8 volumen=5;
void subir(){

if(volumen<10){

volumen++;
}
CyDelay(100);
subirv_ClearInterrupt();
ISR_mas_ClearPending();

}
void bajar(){

if(volumen>0){

volumen--;
}
CyDelay(100);
bajav_ClearInterrupt();
ISR_menos_ClearPending();
}

CY_ISR(Int_Timer1){

switch (volumen){

case 0:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);

break;
case 1:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
break;
case 2:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;
case 3:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;
case 4:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;
case 5:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;
case 6:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;
case 7:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;
case 8:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;
case 9:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;

case 10:
LCD_ClearDisplay();
LCD_Position(0,1);
LCD_PrintString("VOLUMEN %:");
LCD_PrintNumber(volumen*10);
LCD_Position(1,3);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar(LCD_CUSTOM_0);
break;

}
Timer_1_ReadStatusRegister();
}
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
ADC_Start();
DAC_Start();
LCD_Start();
Timer_1_Start();
ISR_mas_StartEx(subir);
ISR_menos_StartEx(bajar);
ISR_Timer_StartEx(Int_Timer1);

/* Place your initialization/startup code here (e.g. MyInst_Start())


*/

for(;;)
{
audio= ADC_Read16();

audio2=volumen*audio/10;
DAC_SetValue(audio2);

/* Place your application code here. */


}
}

/* [] END OF FILE */

LINK DE LA PRACTICA:

https://youtu.be/ifaA0WJtNXQ

You might also like