ms2=0;
}
if(anjian4==0&&aj4==0)//Detect key 4
{
delay(5);
if(anjian4==0) aj4=1,ms2=0;
}
if(anjian4==1&&aj4==1)
{
nao_fen--;
if(nao_fen<0) nao_fen=59;
change=0;
aj4=0; //Press and release button 1, hours--
}
if(aj4==1&&ms2>=700) changan=1,ms2=0; //Detect long press time 0.5s
if(aj4==1&&changan==1&&ms2>=100)//快减
{
nao_fen--;
if(nao_fen<0) nao_fen=59;
ms2=0;
}
if(anjian1==0&&aj1==0)//Detect key 1
{
delay(5);
if(anjian1==0) aj1=1;
}
if(anjian1==1&&aj1==1)
{
aj1=0;
cd=4;
IapErase(0x0600);
IapProgram(0x0600, nao_fen); //Write hour value
}
if(anjian2==0&&aj2==0)//Detect key 2
{
delay(5);
if(anjian2==0) aj2=1;
}
if(anjian2==1&&aj2==1)
{
aj2=0;
cd=20; //Go to menu 20
IapErase(0x0600);
IapProgram(0x0600, nao_fen); //Write hour value
}
}
while(cd==19) //Menu 19 Set temperature switch
{
if(wendu_kaiguan==0)
{
if(ms1>0&&ms1<300) xianshi(32,33,34,33,27,0,37,37);
if(ms1>300&&ms1<600) xianshi(32,33,34,33,27,28,28,28);
if(ms1>600) ms1=0;
}
if(wendu_kaiguan==1)
{
if(ms1>0&&ms1<300) xianshi(32,33,34,33,27,27,0,38);
if(ms1>300&&ms1<600) xianshi(32,33,34,33,27,27,28,28);
if(ms1>600) ms1=0;
}
if(anjian3==0&&aj3==0)//Detect key 3
{
delay(5);
if(anjian3==0) aj3=1;
}
if(anjian3==1&&aj3==1)
{
aj3=0;
wendu_kaiguan++;
}
if(anjian4==0&&aj4==0)//Detect key 4
{
delay(5);
if(anjian4==0) aj4=1;
}
if(anjian4==1&&aj4==1)
{
aj4=0;
wendu_kaiguan++;
}
if(wendu_kaiguan>1) wendu_kaiguan=0;
if(anjian1==0&&aj1==0)//Detect key 1
{
delay(5);
if(anjian1==0) aj1=1;
}
if(anjian1==1&&aj1==1)
{
aj1=0;
cd=0;
IapErase(0x0800);
IapProgram(0x0800, wendu_kaiguan); //Write switch value
}
}
while(cd==20) //Menu 20 Select alarm 1, 2
{
if(s==0)
{
if(nao_kaiguan==0)
{
if(ms1>0&&ms1<300) xianshi(30,31,1,27,27,0,37,37);
if(ms1>300&&ms1<600) xianshi(30,31,28,27,27,0,37,37);
if(ms1>600) ms1=0;
}
if(nao_kaiguan==1)
{
if(ms1>0&&ms1<300) xianshi(30,31,1,27,27,27,0,38);
if(ms1>300&&ms1<600) xianshi(30,31,28,27,27,27,0,38);
if(ms1>600) ms1=0;
}
}
if(s==1)
{
if(nao2_kaiguan==0)
{
if(ms1>0&&ms1<300) xianshi(30,31,2,27,27,0,37,37);
if(ms1>300&&ms1<600) xianshi(30,31,28,27,27,0,37,37);
if(ms1>600) ms1=0;
}
if(nao2_kaiguan==1)
{
if(ms1>0&&ms1<300) xianshi(30,31,2,27,27,27,0,38);
if(ms1>300&&ms1<600) xianshi(30,31,28,27,27,27,0,38);
if(ms1>600) ms1=0;
}
}
if(anjian1==0&&aj1==0)//Detect key 1
{
delay(5);
if(anjian1==0) aj1=1;
}
if(anjian1==1&&aj1==1) aj1=0,cd=4,ms1=0; //Press and release button 1 to go to level 4 menu
if(anjian2==0&&aj2==0)//Detect key 2
{
delay(5);
if(anjian2==0) aj2=1;
}
if(anjian2==1&&aj2==1)
{
aj2=0;
if(s==1) cd=21; //Press and release button 2 to go to level 21 menu
if(s==0) cd=16; //Press and release button 2 to go to level 16 menu
}
if(anjian3==0&&aj3==0)//Detect key 3
{
delay(5);
if(anjian3==0) aj3=1;
}
if(anjian3==1&&aj3==1)
{
aj3=0;
s=1;
}
if(anjian4==0&&aj4==0)//Detect key 4
{
delay(5);
if(anjian4==0) aj4=1;
}
if(anjian4==1&&aj4==1)
{
aj4=0;
s=0;
}
}
while(cd==21) //Menu 21 Set alarm 2 on/off
{
if(nao2_kaiguan==0)
{
if(ms1>0&&ms1<300) xianshi(30,31,2,27,27,0,37,37);
if(ms1>300&&ms1<600) xianshi(30,31,2,27,27,28,28,28);
if(ms1>600) ms1=0;
}
if(nao2_kaiguan==1)
{
if(ms1>0&&ms1<300) xianshi(30,31,2,27,27,27,0,38);
if(ms1>300&&ms1<600) xianshi(30,31,2,27,27,27,28,28);
if(ms1>600) ms1=0;
}
if(anjian3==0&&aj3==0)//Detect key 3
{
delay(5);
if(anjian3==0) aj3=1;
}
if(anjian3==1&&aj3==1)
{
aj3=0;
nao2_kaiguan++;
}
if(anjian4==0&&aj4==0)//Detect key 4
{
delay(5);
if(anjian4==0) aj4=1;
}
if(anjian4==1&&aj4==1)
{
aj4=0;
nao2_kaiguan++;
}
if(nao2_kaiguan>1) nao2_kaiguan=0;
if(anjian1==0&&aj1==0)//Detect key 1
{
delay(5);
if(anjian1==0) aj1=1;
}
if(anjian1==1&&aj1==1)
{
aj1=0;
cd=4;
IapErase(0x0c00);
IapProgram(0x0c00, nao2_kaiguan); //Write switch value
}
if(anjian2==0&&aj2==0)//Detect key 2
{
delay(5);
if(anjian2==0) aj2=1;
}
if(anjian2==1&&aj2==1)
{
aj2=0;
cd=22; //Go to menu 22
IapErase(0x0c00);
IapProgram(0x0c00, nao2_kaiguan); //Write switch value
}
}
while(cd==22) //Menu 22 Set alarm 2 hours
{
if(ms1>0&&ms1<300) xianshi(27,nao2_shi/10,nao2_shi%10,27,27,nao2_fen/10,nao2_fen%10,27);
if(ms1>300&&ms1<600) xianshi(27,28,28,27,27,nao2_fen/10,nao2_fen%10,27);
if(ms1>600) ms1=0;
if(ms1>300&&changan==1) ms1=0;
if(anjian3==0&&aj3==0)//Detect key 3
{
delay(5);
if(anjian3==0) aj3=1,ms2=0;
}
if(anjian3==1&&aj3==1)
{
nao2_shi++;
if(nao2_shi==25) nao2_shi=0;
change=0;
aj3=0; //Press and release button 1, hours++
}
if(aj3==1&&ms2>=700) changan=1,ms2=0; //Detect long press time 0.5s
if(aj3==1&&changan==1&&ms2>=100)//快加
{
nao2_shi++;
if(nao2_shi==25) nao2_shi=0;
ms2=0;
}
if(anjian4==0&&aj4==0)//Detect key 4
{
delay(5);
if(anjian4==0) aj4=1,ms2=0;
Previous article:Stepper Motor Control and Simulation Based on 51 Single Chip Microcomputer
Next article:51 MCU 12864 display electronic password lock source code
- 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!
- China's chips look forward to new breakthroughs
- Hiring embedded software engineer
- dsp28335 AD sampling DMA transfer
- EEWORLD University ---- Webinar - How to quickly design power rails for Xilinx FPGA and SoC
- EEWORLD University----simulink video tutorial
- Interleaved CCM Totem Pole Bridgeless Power Factor Correction (PFC) Reference Design
- What are the common types of LED dimming power supplies and their working principles?
- MSP430 FAQ: FLASH storage
- Touch IC-Three new ways of human-computer interaction (1)
- Experience in using TI DSP/BIOS and CCS