Cerradura electronica

download Cerradura electronica

If you can't read please download the document

description

Mikroc

Transcript of Cerradura electronica

sbit LCD_RS at RB4_bit; //** Estos son los pines del lcd dirigidos al puerto D del Pic;sbit LCD_EN at RB5_bit; //En MikroC Pro se utilizan estos comandos; asi se puede controlar elsbit LCD_D4 at RB0_bit; // lcd con el puerto(s) y pines que se deseen......puedes hacer de esto una libreria .h ;sbit LCD_D5 at RB1_bit;sbit LCD_D6 at RB2_bit;sbit LCD_D7 at RB3_bit;sbit LCD_RS_Direction at TRISB4_bit;sbit LCD_EN_Direction at TRISB5_bit;sbit LCD_D4_Direction at TRISB0_bit;sbit LCD_D5_Direction at TRISB1_bit;sbit LCD_D6_Direction at TRISB2_bit;sbit LCD_D7_Direction at TRISB3_bit; // fin del Bloque de configuracion del lcd;char keypadPort at PORTD;unsigned short k=0,l=0,i=0,numero[4],contrasena[4]; //variables de control que cambian su valor seudun el boton del teclado;unsigned short contador,clave[5],apagar,apago[5],memoria[5]={'3','3','2','2','2'}, kp;char oldstate = 0; char J = 0;char *txt1 = "Ingrese Contrasea";char *txt2 = " Correcto ";char *txt3 = "Intentelo otra vez";char *txt4 = "Incorrecto";char *txt5 = " Alarma";char *txt6= "Buen viaje";void main() { // Keypad_Init(); // Initialize Keypad EN PORTB Lcd_Init(); // Initialize LCD on PORTD, Lcd_Cmd(_LCD_CLEAR); // LIMPIA LA PANTALLA DE LA LCD trisc=0xFF; trisa=0b000010; // INICIAMOS CON LOS PINES DE SALIDA EN CERO kp = 0; // INICIAMOS LA VARIABLE DE KP EN CERO Pa: do { //delay_ms(3000); Sub: // INICIAMOS PROGRAMA apagar=0; if(portc.F0==1) { // delay_ms(3000); Lcd_Cmd(_LCD_CLEAR); // LIMPIAMOS LA PANTALLA DE LA LCD Lcd_Cmd(_LCD_cursor_off); // APAGAMOS EL CURSOR DE LA LCD Res: Lcd_Out(1,1,"Bienvenido"); // MANDAMOS EL TEXTO Bienvenido AL REGLON UNO COLUMNA UNO if (portC.F2==1){ Aqui: Lcd_Out(2,1, txt1); clave[0]='0';clave[1]='0';clave[2]='0';clave[3]='0';clave[4]='0'; // LE ASIGNAMOS LA LETRA CERO while(contador !=5) { //AL ARRELO EN SUS ESPACIOS for(contador=0 ; contador