Está en la página 1de 5

PROYECTO FINAL

CERRADURA ELECTRONICA
 ASIGNATURA:

MICROPROCESADORES
 INTEGRANTES:

o CHIRINOS ACUÑA GUSTAVO

o MERA ALCANTARA MANFRED

o TARRILLO CABRERA JOSUE

 DOCENTE:

ING. JUAN CARLOS ÑAÑEZ AGUILAR


 SEMESTRE:

2017-II

LAMBAYEQUE - 2017
#include <16F877A.h> WHILE (TRUE)

#fuses XT,NOWDT,NOPUT,NOPROTECT {

#use delay (clock=4M) IF (b == 0)

#define LCD_DB4 PIN_D4 {

#define LCD_DB5 PIN_D5 lcd_putc ("\f POR");

#define LCD_DB6 PIN_D6 lcd_putc ("\n FAVOR");

#define LCD_DB7 PIN_D7 delay_ms (600);

#define LCD_RS PIN_D2 lcd_putc ("\fINGRESE SU CLAVE");

#define LCD_E PIN_D3 }

#include <lcd1.c> // Libreria del lcd IF (e == 1)

#include <kbd1.c> // Libreria del teclado matricial {

#rom 0x2100={'1','2','3','4'} // escribir en la memoria eeprom lcd_putc ("\f INGRESE");

delay_ms (500);

int i; //contador del arreglo clave lcd_putc ("\fCLAVE CORRECTA:");

int a; //contador del arreglo dato

int b=0; //variable por una clave nueva }

int e; // variable por un error output_low (PIN_D0); // VERDE

int j; // contador de los arreglos clave , dato output_low (PIN_D1); // ROJO

int comp; // contador que compara si son iguales los arreglos comp = 0;

char k; // lectura del teclado a = 0;

char dato[4],clave[4]; //dato : almacena los digitos, clave: es la WHILE (a < 4)

contraseña {

void main() k = kbd_getc (); // leer la tecla presiono

{ IF (k != 0)

FOR (i = 0; i < 4; i++) {

{ dato[a] = k; //guarda el caracter al arreglo dato

clave[i] = read_eeprom (i) ; //guarda la constraseña en el a++;


vector clave
lcd_gotoxy (a, 2); // posicion i de la segunda linea
}
lcd_putc ('*') ; //encriptar la clave
lcd_init (); // Inicializa el hardware LCD y el estado interno del
módulo. }

kbd_init (); // Inicializa el driver para usar el teclado matrial }

port_b_pullups (TRUE); // resistencias o internas del pic FOR (j = 0; j < 4; j++)

lcd_putc ("\f PROYECTO"); IF (dato[j] == clave[j])

lcd_putc ("\n FINAL"); {

delay_ms (1000); comp++;

lcd_putc ("\f MICRO"); }

lcd_putc ("\n PROCESADORES"); }

delay_ms (1000);
IF (comp == 4)

lcd_putc ("\f BIENVENIDO!!!! ");

output_high (PIN_D0); // VERDE

output_low (PIN_D1); // ROJO

delay_ms (2000);

b = 0;

ELSE

lcd_putc ("\f-ERROR DE CLAVE-");

e = 1;

b++;

IF (b == 4)

lcd_putc ("\f-----SISTEMA-----");

lcd_putc ("\n----BLOQUEADO----");

output_high (PIN_D1);// ROJO

delay_ms (2000);

b = 0;

output_high (PIN_D1);// ROJO

output_low (PIN_D0);// VERDE

delay_ms (1000);

}
PIC16F877A

LCD 16X2

TECLADO
MATRICIAL
4X4

También podría gustarte