if(yue==0&&tiaozheng[4]==3&&tiaozheng[5]==1) tiaozheng[4]=0,tiaozheng[5]=1;
change=0;
aj3=0; //Press and release button 1, day++
}
if(aj3==1&&ms2>=700) changan=1,ms2=0; //Detect long press time 0.5s
if(aj3==1&&changan==1&&ms2>=100)//快加
{
tiaozheng[5]++;
if(tiaozheng[5]==10) tiaozheng[4]++,tiaozheng[5]=0;
if(runnian==1&&yue==2&&tiaozheng[4]==3) tiaozheng[4]=0,tiaozheng[5]=1;
if(runnian==0&&yue==2&&tiaozheng[4]==2&&tiaozheng[5]==9) tiaozheng[4]=0,tiaozheng[5]=1;
if(yue==1&&tiaozheng[4]==3&&tiaozheng[5]==2) tiaozheng[4]=0,tiaozheng[5]=1;
if(yue==0&&tiaozheng[4]==3&&tiaozheng[5]==1) tiaozheng[4]=0,tiaozheng[5]=1;
ms2=0;
}
if(anjian4==0&&aj4==0)//Detect key 4
{
delay(5);
if(anjian4==0) aj4=1,ms2=0;
}
if(anjian4==1&&aj4==1)
{
tiaozheng[5]--;
if(tiaozheng[5]>100) tiaozheng[4]--,tiaozheng[5]=9;
if(runnian==1&&yue==2&&tiaozheng[4]==0&&tiaozheng[5]==0) tiaozheng[4]=2,tiaozheng[5]=9;
if(runnian==0&&yue==2&&tiaozheng[4]==0&&tiaozheng[5]==0) tiaozheng[4]=2,tiaozheng[5]=8;
if(yue==1&&tiaozheng[4]==0&&tiaozheng[5]==0) tiaozheng[4]=3,tiaozheng[5]=1;
if(yue==0&&tiaozheng[4]==0&&tiaozheng[5]==0) tiaozheng[4]=3,tiaozheng[5]=0;
change=0;
aj4=0; //Press and release button 1, day--
}
if(aj4==1&&ms2>=700) changan=1,ms2=0; //Detect long press time 0.5s
if(aj4==1&&changan==1&&ms2>=100)//快减
{
tiaozheng[5]--;
if(tiaozheng[5]>100) tiaozheng[4]--,tiaozheng[5]=9;
if(runnian==1&&yue==2&&tiaozheng[4]==0&&tiaozheng[5]==0) tiaozheng[4]=2,tiaozheng[5]=9;
if(runnian==0&&yue==2&&tiaozheng[4]==0&&tiaozheng[5]==0) tiaozheng[4]=2,tiaozheng[5]=8;
if(yue==1&&tiaozheng[4]==0&&tiaozheng[5]==0) tiaozheng[4]=3,tiaozheng[5]=1;
if(yue==0&&tiaozheng[4]==0&&tiaozheng[5]==0) tiaozheng[4]=3,tiaozheng[5]=0;
ms2=0;
}
if(anjian2==0&&aj2==0)//Detect key 2
{
delay(5);
if(anjian2==0) aj2=1;
}
if(anjian2==1&&aj2==1)
{
aj2=0;
cd=13;
ms1=0; //Press and release button 2 to go to level 13 menu
}
if(anjian1==0&&aj1==0)//Detect key 1
{
delay(5);
if(anjian1==0) aj1=1;
}
if(anjian1==1&&aj1==1)
{
aj1=0;
cd=3;
xieshijian(tiaozheng[0]*10+tiaozheng[1],tiaozheng[2]*10+tiaozheng[3],tiaozheng[4]*10+tiaozheng[5],tiaozheng[6]*10+tiaozheng[7],tiaozheng[8]*10+tiaozheng[9],tiaozheng[10]*10+tiaozheng[11],shijian[12]);
ms1=0; //Press and release button 1 to go to level 3 menu
}
}
while(cd==16) //Menu 16 Set alarm 1 on/off
{
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,1,27,27,28,28,28);
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,1,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;
nao_kaiguan++;
}
if(anjian4==0&&aj4==0)//Detect key 4
{
delay(5);
if(anjian4==0) aj4=1;
}
if(anjian4==1&&aj4==1)
{
aj4=0;
nao_kaiguan++;
}
if(nao_kaiguan>1) nao_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(0x0200);
IapProgram(0x0200, nao_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=17; //Go to menu 17
IapErase(0x0200);
IapProgram(0x0200, nao_kaiguan); //Write switch value
}
}
while(cd==17) //Menu 17 Set alarm 1 hour
{
if(ms1>0&&ms1<300) xianshi(27,nao_shi/10,nao_shi%10,27,27,nao_fen/10,nao_fen%10,27);
if(ms1>300&&ms1<600) xianshi(27,28,28,27,27,nao_fen/10,nao_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)
{
nao_shi++;
if(nao_shi==25) nao_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)//快加
{
nao_shi++;
if(nao_shi==25) nao_shi=0;
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_shi--;
if(nao_shi<0) nao_shi=24;
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_shi--;
if(nao_shi<0) nao_shi=24;
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(0x0400);
IapProgram(0x0400, nao_shi); //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=18; //Go to menu 18
IapErase(0x0400);
IapProgram(0x0400, nao_shi); //Write hour value
}
}
while(cd==18) //Menu 18 Set alarm for 1 minute
{
if(ms1>0&&ms1<300) xianshi(27,nao_shi/10,nao_shi%10,27,27,nao_fen/10,nao_fen%10,27);
if(ms1>300&&ms1<600) xianshi(27,nao_shi/10,nao_shi%10,27,27,28,28,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)
{
nao_fen++;
if(nao_fen==60) nao_fen=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)//快加
{
nao_fen++;
if(nao_fen==60) nao_fen=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!
- Effects of ESR and ESL in Decoupling Applications
- The new computer I bought can't be turned on, please help
- Solution to the failure of IAR programming MSP430
- Display community logo on three-color E-Ink Gizmo
- 【GD32450I-EVAL】UART
- Simple VGA driver for MicroPython
- How to solve CAN bus test problems
- Fudan Micro FM33LG0xx Series Data Summary
- How to use a computer
- DSP program optimization --- Detailed explanation of CCS optimization options