Professional Documents
Culture Documents
MICROPROCESADORES Y CONTROLADORES
Presentado por
Jhon Wuilquer Laguna Castellanos
Cod 1077849519
Incubadora de Huevos
Dos relevos
Procesador PIC16F877A
Procesador PIC18F4520
Cristales
Condensadores
Resistencia 10k
2 Indicadores Led
2 Motores 5v
Transistores
DISPLAY LM020L
DISPLAY LM032L
Termostato
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
# include <16f877a.h>
# device *=16
# device adc=10
# use delay(clock=4M)
# include <lcd.c>
float temperatura;
void main()
{
//*******************************
setup_adc_ports(RA0_ANALOG);//entrada del LM35
setup_adc(ADC_CLOCK_INTERNAL);
setup_COUNTERS(RTCC_internal.rtcc_div_1);//marca de divicion
set_adc_channel(0);
//*******************************
lcd_init();
lcd_gotoxy(1,1);
printf(lcd_putc,"Temp. Incubadora");
delay_ms(4000);
lcd_init();
while(true)
{
temperatura=(float)read_adc()/2;
//********grados centigrados
lcd_gotoxy(5,1);
printf(lcd_putc,"%f",temperatura);
lcd_gotoxy(13,1);
printf(lcd_putc,"Grados");
delay_ms(1000);
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
if(temperatura<=500&&temperatura>=37)
{
output_high(pin_a1);
output_high(pin_a2);
output_low(pin_a3);
lcd_gotoxy(3,2);
printf(lcd_putc,"Extrayendo Peligro");
delay_ms(1000);
}
else
{
output_low(pin_a1);
output_low(pin_a2);
output_high(pin_a3);
lcd_gotoxy(3,2);
printf(lcd_putc,"Optima Temperatura");
delay_ms(1000);
}
}
}
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
setup_adc_ports(AN0|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2|ADC_TAD_MUL_6);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
// TODO: USER CODE!!
//:::::::::::: CONDICIONES INICIALES PUERTOS ::::::::::
set_tris_A(0xC0);
set_tris_C(0xff);
set_tris_B(0x00);
set_tris_D(0x00);
set_tris_E(0xC);
output_C (0xff);
output_B (0x00);
output_A (0xC0);
output_D (0x00);
output_E (0xC);
//:::::::::::::::::::::::::::::::::::::::::::::::::::::
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
sensado_temp();