Documente Academic
Documente Profesional
Documente Cultură
PASO 3
MICROCONTROLADORES Y MICROPROCESADORES
Grupo 309696_16
Trabajo presentado a:
Tutor: Ing. Joan Sebastin Bustos M.
CEAD - Dosquebradas
Octubre de 2017
Ejrcicio 1 Debe sensar la temperatura ambiente y si est menor o igual de 30 grados el
led verde se encender y dar un solo sonido cada 2 segundos , si la temperatura esta
entre los 30 y 38 grados se encender un led amarillo , y si supera los 39 grados hasta
los 50 grados
El led rojo se prendera y debe dar una alarma constante y prenderse el ventilador hasta
que baje la temperatura menor o igual a 20 grados.
#include <16F877a.h>
//#device=16
#device adc=10
#fuses hs,nowdt
#use delay(clock=4m)
#include <lcd.c>
#byte trisb=0x88
#byte trisb=0x88
float temperatura;
void main ()
setup_adc_ports(RA0_analog);
setup_adc(ADC_CLOCK_INTERNAL);
setup_COUNTERS(RTCC_INTERNAL.rtcc_div_1);
set_adc_channel(0);
lcd_init();
lcd_gotoxy(1,1);
printf(lcd_putc,"victorcardona");
lcd_gotoxy(1,2);
delay_ms(2000);
lcd_putc("\f");
while(true)
temperatura=(float)read_adc()/2;
lcd_gotoxy(1,1);
printf(lcd_putc,"temp:%fgrados",temperatura);
delay_ms(200);
if(temperatura>=30&&temperatura<=38)
output_low(pin_a1);
output_low(pin_a3);
output_high(pin_a2);
output_high(pin_e0);
output_low(pin_a5);
lcd_gotoxy(5,2);
printf(lcd_putc,"motor:off");
delay_ms(200);
if(temperatura>=39)
output_low(pin_a1);
output_low(pin_a2);
output_high(pin_a3);
output_high(pin_e0);
output_high(pin_a5);
lcd_gotoxy(5,2);
printf(lcd_putc,"motor:on");
delay_ms(200);
}
if(temperatura<=30)
output_high(pin_a1);
output_high(pin_e0);
output_low(pin_a2);
output_low(pin_a3);
lcd_gotoxy(5,2);
printf(lcd_putc,"motor:off");
delay_ms(200);
}
Con la temperatura menor de 30 grados se enciende el led verde
El cual deber en un display 16X2 desplegar el nombre del curso, numero de grupo y los
nombres uno por uno de los integrantes del grupo seguido del nmero de cedula los
cuales cambiaran al presionar cada uno de los 5 pulsadores (1 al 5 igual nmero de
integrantes)
#INCLUDE <16F877A.H>
#INCLUDE <LCD.C>
#USE FAST_IO(C)
INT VALOR, J;
//-------------------------------------------------//
//Programa principal
VOID MAIN ()
set_tris_a (0b11111000);
LCD_GOTOXY (J,1);
DELAY_MS (100);
DELAY_MS (2000);
DELAY_MS (100);
WHILE (true)
{
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_PUTC ("CARLOSSALAZAR");
LCD_GOTOXY (1,2);
DELAY_MS (300);
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_GOTOXY (1,2);
DELAY_MS (300);
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_PUTC ("DIEGOPEREZ");
LCD_GOTOXY (1,2);
DELAY_MS (300);
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_PUTC ("ALEXANDERMORALES");
LCD_GOTOXY (1,2);
DELAY_MS (300);
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_PUTC ("HERNANFRANCO");
LCD_GOTOXY (1,2);
DELAY_MS (300);
}
#INCLUDE <16F887.H>
#INCLUDE <LCD.C>
#USE FAST_IO(C)
INT VALOR,J;
//-------------------------------------------------//
//Programa principal
VOID MAIN ()
set_tris_a(0b11111000);
FOR (J=16;J>0;J--)
LCD_GOTOXY (J,1);
DELAY_MS (100);
DELAY_MS (2000);
//LA SIGUIENTE RUTINA BORRA EL MENSAJE DE ENTRADA
DELAY_MS (100);
WHILE (true)
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_PUTC ("CARLOSHERNANDEZ");
LCD_GOTOXY (1,2);
DELAY_MS (2000);
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
DELAY_MS (2000);
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_PUTC ("FERNANDOPEREZ");
LCD_GOTOXY (1,2);
PRINTF (LCD_PUTC,"14587643");
DELAY_MS (2000);
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_PUTC ("HERNANFRANCO");
LCD_GOTOXY (1,2);
PRINTF (LCD_PUTC,"14890456");
DELAY_MS (2000);
{
LCD_PUTC ("\f");
LCD_GOTOXY (1,1);
LCD_PUTC ("ALEXANDERMORALES");
LCD_GOTOXY (1,2);
DELAY_MS (2000);
}
https://youtu.be/NARuzlC2ndU
https://youtu.be/yo2TaAzspJo