TIME[4]--;
if((TIME[4]&0x0f)==0x0f)
{
TIME[4]&=0xf0;
TIME[4]|=0x09;
}
if(TIME[4]==0x00)
TIME[4]=0x12;
LCD12864_WriteCmd(0x90+3);
Ds1302Write(0,'0'+TIME[4]);
LCD12864_WriteData('0'+TIME[4]/16);//month
LCD12864_WriteData('0'+(TIME[4]&0x0f));
}break;
case 7: //year
{
TIME[6]--;
if((TIME[6]&0x0f)==0x0f)
{
TIME[6]&=0xf0;
TIME[6]|=0x09;
}
if(TIME[6]==0xf9)
TIME[6]=0x99;
LCD12864_WriteCmd(0x90+1);
Ds1302Write(0,'0'+TIME[6]);
LCD12864_WriteData('0'+TIME[6]/16);//year
LCD12864_WriteData('0'+(TIME[6]&0x0f));
}break;
}//switch
}
}
}
} //while
}
//==================================Interrupt handling function==============================//
// is an interrupt after the number of errors reaches a certain number
void init_irq1()interrupt 1 using 0
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
a++;
if(a>=20)
{
a=0; //When a is greater than or equal to 20, it means one second has passed
miao--; //After five incorrect attempts, the screen will be locked for 1 minute before you can enter the password
clock(3,miao);
}
if(miao<=0)
{
TR0=0;
miao=59; //When the countdown is completed, reset the time to one minute, which is 60
LCD12864_SetWindow(2,0," ");
LCD12864_SetWindow(3,0," ");
LCD12864_SetWindow(2,1,"Single-Chip Microcomputer Laboratory"); //Write the first line of information. This information will not be changed in the main loop, so write it before while
LCD12864_SetWindow(3,1,"Enter the eight-digit password");
flag_time2=0;
}
}
//================================Password input (password modification)=============================//
void MIMA_input()
{
unsigned char i=0,m,k=1,flag7 = 1;
if(flag5 == 1)
{
if(k2 == 0)
{
delay(5);
if(k2 == 0) //If the scan is a valid key value, process it
{
flag7 = 0;
flag8 = 1;
if(i == 0)
LCD12864_WriteCmd(0x01); //When inputting the first character, you need to clear the line to facilitate viewing the password
if(p==1) //Change personal password
{
LCD12864_SetWindow(0,0,"Modify personal password");
LCD12864_SetWindow(1,2,"New Password");
LCD12864_SetWindow(2,1,"Please enter password");
LCD12864_WriteCmd(0x0c);
}
if(p==0) //Change the administrator password
{
LCD12864_SetWindow(0,0,"Change administrator password");
LCD12864_SetWindow(1,2,"New Password");
LCD12864_SetWindow(2,1,"Please enter password");
LCD12864_WriteCmd(0x0c);
}
for(i = 0; i < 8 ; i++) //The password is 8 digits. If it is greater than 8 digits, no more key input will be performed.
{
delay(10);
m=0XFF;
while(m==0XFF)
{
m=KeyPro(); //Scan the keyboard
if(m == 11)
{
delay(20);
if(m == 11)
{
i= -1; //Count clear
LCD12864_SetWindow(2,0," ");
}
}
}
delay(10);
if(m != 11)
{
if(m >= 10)
{
i--;
}
if(i==0)
LCD12864_SetWindow(2,0,"* ");
if( m>=0 && m<10 ) //Set the password to 0~9.
{
LCD12864_char(2,i,'*'); //Asterisk (*)
if(p == 1)
{
……………………
Previous article:Design of 51 single chip microcomputer intelligent clock
Next article:Application of CH375_CH376 USB disk read and write module on 51 single chip microcomputer
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- New breakthrough! Ultra-fast memory accelerates Intel Xeon 6-core processors
- New breakthrough! Ultra-fast memory accelerates Intel Xeon 6-core processors
- Consolidating vRAN sites onto a single server helps operators reduce total cost of ownership
- Consolidating vRAN sites onto a single server helps operators reduce total cost of ownership
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- 5V/1A mobile phone charging circuit adds charging control switch and light indication
- DSP28335 implements high frequency filtering through FFT transformation
- Solving VCNL4020-GS08
- Have you ever thought about using the 3 IO ports of a microcontroller to control 6 LED lights?
- The center main control circuit board PCB was finished today and sent to the manufacturer for board making.
- Error: Can't route source node of type max_io to destination node ...
- STM32 timer triggers ADC to collect data and send it to the host computer
- [RVB2601 Creative Application Development] Recording Box
- Harbin Engineering University 1999 Digital and Analog Circuits Postgraduate Entrance Examination Questions
- The new Tektronix AFG31000 arbitrary wave function generator has all the functions you want!