• PUDN用户
    了解作者
  • Others
    开发工具
  • 48KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 40
    下载次数
  • 2011-08-02 23:26
    上传日期
基于AT89S51单片机的红外遥控密码锁;单片机;密码锁;红外;报警;AT24C02
AT89S51-remote-control-locks.rar
  • AT89S51 microcontroller based infrared
  • 程序
  • MIMASUO.lnp
    62B
  • 44key.c
    1.8KB
  • STARTUP.A51
    6.2KB
  • STARTUP.OBJ
    749B
  • 1602.c
    3KB
  • 2402.c
    5.2KB
  • MIMASUO
    28.7KB
  • MIMASUO.LST
    17.2KB
  • MIMASUO.c
    6.2KB
  • hongwai.c
    2.2KB
  • MIMASUO.Opt
    1.8KB
  • MIMASUO.M51
    40.2KB
  • MIMASUO.Uv2
    2.1KB
  • MIMASUO_Opt.Bak
    1.8KB
  • STARTUP.LST
    13.7KB
  • MIMASUO.plg
    172B
  • MIMASUO.hex
    6.9KB
  • MIMASUO.OBJ
    33.7KB
内容介绍
#include <reg52.h> #include <intrins.h> #include<absacc.h rel='nofollow' onclick='return false;'> #include"44key.c" #include"1602.c" #include"2402.c" #include"hongwai.c" #define DEFAULT 0 #define UNLOCK 1 #define INPUT_PASSWORD 14 #define SET_PASSWORD 15 #define TRUE 1 #define FALSE 0 uchar zhi,flag=0,flag1=0; uchar counter1=0; sbit BEEP=P0^0; sbit red=P0^1; sbit yellow=P0^2; sbit green=P0^3; unsigned char password[8]={1,2,3,4,5,6,7,8}; char code input[]="Input Password:"; char code old_password[]="Old Password:"; char code new_password[]="New Password:"; char code confirm[]="Input Again:"; unsigned char guess[8]={0,0,0,0,0,0,0,0}; unsigned char temp[8] ={0,0,0,0,0,0,0,0}; unsigned char temp1[8]={0,0,0,0,0,0,0,0}; uchar keyscan(); int ifkeydown(); void beep() { BEEP=0; delay2(1); BEEP=1; } int get_password() { uchar counter; for(counter=0;counter<9;counter++) { delay2(50); if(counter<8) { do{ displayonechar(counter,1,'_'); delay2(100); if(flag1) { while(RE_DATA); CheckRE(); keyvalue=Recived_Data; } else { while(!ifkeydown()); keyscan(); } } while(keyvalue==0xff); if((keyvalue!=13)&&(keyvalue!=12)) { // displayonechar(counter,1,'*'); displayonechar(counter,1,dis_num[keyvalue]); guess[counter]=keyvalue; } if(keyvalue==13) { if(counter>0) { displayonechar(--counter,1,'_'); guess[counter]=0x00; // displayonechar(counter,1,' '); counter--; } } if(keyvalue==12) { flag1=0; coordinate(0,1); return( 0); } } if(counter==8) { do{ if(flag1==1) { while(RE_DATA); CheckRE(); keyvalue=Recived_Data; } else { while(!ifkeydown()); keyscan(); } }while((keyvalue!=13)&&(keyvalue!=12)); if(keyvalue==13) { displaymorechar(counter,1," "); displayonechar(--counter,1,'_'); guess[counter]=0x00; // displayonechar(counter,1,' '); counter--; } if(keyvalue==12) { flag1=0; return(1); } } } } int check_password() { char i; i=0; ClearLCD(); while ((guess[i]==password[i]) && (i < 8)) i++; if (i==8) return(TRUE); else return(FALSE); } int input_new_password() { unsigned char i,j; ClearLCD(); displaymorechar(0,0,new_password); if(get_password()) { for(i=0;i<8;i++) temp[i]=guess[i]; } else return(FALSE); ClearLCD(); displaymorechar(0,0,confirm); if(get_password()) { for(i=0;i<8;i++) temp1[i]=guess[i]; } else return(FALSE); i=0; while(!(keyscan()==12)); ClearLCD(); while ((temp1[i]==temp[i]) && (i < 8)) i++; if (i==8) { for(j=0;j<8;j++) { password[j]=temp[j]; } write_page_data_to_24C02(0xA0,0,password); return(TRUE); } else return(FALSE); } void display() { int k=0; switch (keyvalue) { case INPUT_PASSWORD : loop: ClearLCD(); displaymorechar(0,0,input); delay2(50); if(get_password()) { if ( check_password() ) { green=0; displaymorechar(0,0,"Right!"); delay3(3000); ClearLCD(); green=1; } else { red=0; displaymorechar(0,0,"Wrong!"); k++; delay3(30000); red=1; if(k==3) { flag=1; EA=1; ClearLCD(); displaymorechar(0,0,"wait a moment"); while(1); } goto loop; } } else { red=0; ClearLCD(); displaymorechar(0,0,"error!"); delay3(30000); ClearLCD(); red=1; } break; case SET_PASSWORD : //beep(); ClearLCD(); displaymorechar(0,0,old_password); if(get_password()) { if ( check_password() ) if( input_new_password() ) { displaymorechar(2,0,"password has"); displaymorechar(2,1,"been changed!"); } else { yellow=0; ClearLCD(); displaymorechar(0,0,"Fail!"); delay3(30000); yellow=1; } else red=0; displaymorechar(0,0,"Wrong!"); delay3(3000); ClearLCD(); red=1; } else { red=0; ClearLCD(); displaymorechar(0,0,"error!"); delay3(3000); ClearLCD(); red=1; } break; } } void time0(void) interrupt 1 { TR0=0; TH0=0x3C; TL0=0xB0; if(flag) { counter1++; if(counter1==100) { TR0=1; EA=1; flag=0; counter1=0; ClearLCD(); displaymorechar(0,0,"rest success!"); delay3(30000); (*(void(*)())0)(); } } TR0=1; } void main (void) { int i; RE_DATA=1; TMOD=0x01; TH0=0x3C; TL0=0xB0; TR0=1; ET0=1; EA=0; ClearLCD(); startset(); displaymorechar(4,0,"welcome"); displaymorechar(3,1,"mi ma suo"); read_page_data_from_24C02(0xA0,0); for(i=0;i<8;i++) { password[i]=a[i]; } while(1) { if(RE_DATA==0) { flag1=1; CheckRE(); keyvalue=Recived_Data; display(); } displaymorechar(4,0,"welcome"); keyscan(); display(); } }
评论
    相关推荐
    • Study_IR_Remote_Control.rar
      资料包含源码,硬件图,红外相关资料等,本学习型红外遥控器,通过学习一次遥控器的编码,即可脱离原遥控器来遥控...这个源码实用的AT24C32保存,可以保存15个遥控编码,通过修改代码也可以开发出很多功能的遥控器!
    • AT89C51.rar
      本次毕业设计的题目是用AT89C51实现电话远程控制家用电器,该系统主要是由AT89C51单片机、DTMF解码芯片MT8870、语音芯片ISD2560和存储芯片24C02组成。可以用电话机或手机在任何地方、任何时刻通过此系统来远程控制...
    • Remote_receiver.rar
      单片机遥控系统是将红外遥控技术和单片机应用技术相结合的一种方案。...而且本系统还设计有学习NEC红外编码遥控器的功能,通过红外接收解码电路,把遥控器的键码还原并储存起来,再利用查找对比的方法便能够识别不同的...
    • Telephone-remote-controller-.zip
      (1)控制系统能对家中电器实现远程控制; (2)控制系统可以实现双方通信; ... (4)控制系统有语音功能提示,以方便主人操作;...(5)控制系统有声音监听功能,随时了解家中情况;...(6)控制系统外加了电器延时开、关的功能。
    • demo52259IIC_AT24C02.rar
      demo52259的通过IIC向AT24C02写入数据,包括初始化和配置,通过这个例程,初学者可以很快掌握
    • Book_AT89Cx051.zip
      AT89x2051 code library and sample. it s very useful for beginner. include i2c library, one wire communication, remote, sound, LCD etc. enjoy ^^".
    • AT24RF08C.zip
      AT24RF08c的官方文档,内有引脚,封装,驱动方式,全英文说明
    • remote-intelligent-home-control.rar
      本程序是基于51单片机的远程智能家居控制的C51代码,通信模块使用的是TC35。
    • STM32F103RBT6系统原理图
      STM32F103RBT6系统原理图,包括最小系统、LCD、AT24C02、DS18B20、REMOTE、LED、按键等硬件资源,可作开发参考,欢迎下载!
    • Proteus7.12.rar
      Proteus7.12完美破解版.rar电路仿真软件很好用可以仿真单片数字模拟电路