Professional Documents
Culture Documents
ALARMAA
ALARMAA
h>
#device adc=8
#use delay(clock=1200000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
INT y,x,z,w;
#define LCD_TYPE 2
#include <lcd.c>
void main()
{
lcd_init();
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
x=0,y=0,z=0,w=0;
WHILE(TRUE)
{
if( input(PIN_A0) )
{
x=1;
OUTPUT_BIT(PIN_B0,1);
delay_ms(40);
OUTPUT_BIT(PIN_B0,0);
delay_ms(40);
lcd_gotoxy(1,1);
//printf(lcd_putc," JOCOBI N:%i E:%i \n",x,y); //%i=PARA
IMPRIMIR LA VARIABLE QUE UNO DESEE (EN ESTE CASO ES X)
//DELAY_MS(10);
}
if( input(PIN_A1) )
{
z=1;
OUTPUT_BIT(PIN_B1,1);
delay_ms(40);
OUTPUT_BIT(PIN_B1,0);
delay_ms(40);
lcd_gotoxy(1,1);
//printf(lcd_putc," JOCOBI N:%i E:%i \n",x,y);
//DELAY_MS(10);
}
if( input(PIN_A2) )
{
y=1;
OUTPUT_BIT(PIN_B2,1);
delay_ms(40);
OUTPUT_BIT(PIN_B2,0);
delay_ms(40);
lcd_gotoxy(1,1);
//printf(lcd_putc," JOCOBI N:%i E:%i \n",x,y);
//DELAY_MS(10);
}
if( input(PIN_A3) )
{
w=1;
OUTPUT_BIT(PIN_B3,1);
delay_ms(40);
OUTPUT_BIT(PIN_B3,0);
delay_ms(40);
lcd_gotoxy(1,1);
//printf(lcd_putc," JOCOBI N:%i E:%i \n",x,y);
//DELAY_MS(10);
}