Professional Documents
Culture Documents
//******************************************************************************
//
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
#include
<16f877A.h>
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
/*
LP
XT
HS
RC
-------------------------------------------------------------------------------WDT
NOWDT
-------------------------------------------------------------------------------PUT
NOPUT
-------------------------------------------------------------------------------PROTECT
NODEBUG
-------------------------------------------------------------------------------BROWNOUT
-------------------------------------------------------------------------------CPD
NOCPD
--------------------------------------------------------------------------------
WRT
NOWRT
-------------------------------------------------------------------------------*/
#fuses
XT,NOWDT,PUT,NOPROTECT,NODEBUG,BROWNOUT,NOLVP,NOCPD,NOWRT
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
#use delay(clock=4000000)
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
#byte puertoa = 0x05
#byte puertob = 0x06
#byte puertoc = 0x07
#byte puertod = 0x08
#byte puertoe = 0x09
//******************************************************************************
void main(void)
{
trisb=0b00000000;
//CONFIGURO PUERTOS
trisc=0b00000001;
puertob=0b00000000;
//INICIALIZO VARIABLES
while(true)
{
if(bit_test(puertoc,0)==1) // tecla pulsada?
{
puertob=0b01110111;
// Display=A
delay_ms(1500);
puertob=0b00111001;
// Display=C
delay_ms(1500);
puertob=0b01111001;
// Display=E
delay_ms(1500);
puertob=0b01110001;
// Display=F
delay_ms(1500);
puertob=0b01110110;
delay_ms(1500);
// Display=H
}
else
{
puertob=0b00000000;
}
}
}
LCD
//LAZO
// Apago el display
//******************************************************************************
//
//******************************************************************************
#include <16f877a.h>
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
/*
LP
XT
HS
RC
-------------------------------------------------------------------------------WDT
NOWDT
-------------------------------------------------------------------------------PUT
NOPUT
-------------------------------------------------------------------------------PROTECT
NODEBUG
-------------------------------------------------------------------------------BROWNOUT
LVP
NOLVP
-------------------------------------------------------------------------------CPD
NOCPD
-------------------------------------------------------------------------------WRT
NOWRT
-------------------------------------------------------------------------------*/
#fuses XT,NOWDT,PUT,NOPROTECT,NODEBUG,BROWNOUT,NOLVP,NOCPD,NOWRT
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
#use delay(clock=4000000)
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
#include <LCD_DyE.h>
//******************************************************************************
//******************************************************************************
//******************************************************************************
//
//******************************************************************************
void main(void)
{
float pi=3.1415926;
int a=255;
int b=18;
trisb=0x00;
trisc=0x00;
trisd=0x00;
trise=0x00;
puertob=0x00;
puertoc=0x00;
puertod=0x00;
puertoe=0x00;
lcd_init();
lcd_gotoxy(1,1); //c,f
printf(lcd_putc,"ALBERTO & ORLANDO");
delay_ms(5000);
lcd_gotoxy(1,2); //c,f
printf(lcd_putc,"%f",pi);
delay_ms(5000);
lcd_send_byte(0,clear_display);
lcd_gotoxy(1,1); //c,f
printf(lcd_putc,"PI=%3f ",pi);
lcd_gotoxy(1,2); //c,f
printf(lcd_putc,"a=%u b=%3u",a,b);
while(true);
}