Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

#include <16F877A.

h>
#device adc=8

#FUSES NOWDT //No Watch Dog Timer


#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for
PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18)
used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES RESERVED //Used to set the reserved FUSE bits

#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);

// TODO: USER CODE!!

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);
}

lcd_gotoxy(1,1); //1,1 INDICA LA CORDENADA DEL COMIENZO


printf(lcd_putc," JOCOBI N:%i E:%i \n",x,y);
lcd_gotoxy(1,2);
printf(lcd_putc," Noviembre 2023 S:%i O:%i ",z,w);
DELAY_MS(40);
x=0;
z=0;
y=0;
w=0;
OUTPUT_BIT(PIN_B0,0);
}
}

You might also like