write_1602com(0x0f); //Set the cursor to blink
break;
case 2: //The alarm clock cursor flashes
write_1602com(er+12); //Set the button to be pressed once, and the cursor will be displayed at the second position //er+0x09;
write_1602com(0x0f); //Set the cursor to blink
break;
case 1: //The cursor flashes when the alarm is on
write_1602com(er+9); //Set the button to be pressed once, and the cursor will be displayed at the second position //er+0x09;
write_1602com(0x0f); //Set the cursor to blink
break;
}
}
else //Proof is to set the time and date
{
if(T_NL_NZ==0)
{
set++;
if(setn==7)
setn=0; //Set the buttons to have 8 functions: seconds, minutes, hours, weekdays, days, months, years, and returns.
switch(setn)
{
case 6: //TR0=0; //turn off the timer
//TR1=0;
write_1602com(er+7); //Set the button to be pressed once, and the cursor will be displayed at the second position //er+0x09;
break;
case 5:
write_1602com(er+4); //Press fen twice to display the cursor //er+0x06
//write_1602com(0x0f);
break;
case 4:
write_1602com(er+1); //Press 3 times, shi
//write_1602com(0x0f);
break;
// case 4: write_1602com(yh+0x0e);//Press 4 times, week
//write_1602com(0x0f);
// break;
case 3: write_1602com(yh+0x0a);//Press 4 times, ri
//write_1602com(0x0f);
break;
case 2: write_1602com(yh+0x07);//Press 5 times, yue
//write_1602com(0x0f);
break;
case 1: TR0=0;
write_1602com(yh+0x04);//Press 6 times, year
write_1602com(0x0f); //Set the cursor to blink
temp=(miao)/10*16+(miao)%10; //seconds data is written into DS1302
write_1302(0x8e,0x00);
write_1302(0x80,0x80|temp);//miao
write_1302(0x8e,0x80);
//write_1602com(0x0f);
break;
case 0:
write_1602com(0x0c); //Press for the 7th time to set the cursor not to blink
// temp=(miao)/10*16+(miao)%10;
write_1302(0x8e,0x00); //Allow writing, disable write protection
write_1302(0x80,0x00|temp); //write miao data to DS1302
write_1302(0x8e,0x80); //Open write protection
TR0=1; //Turn on the timer
break;
}
}
}
}
}
}
//------------------------------Add key add----------------------------
if((setn!=0)&&(setNZn==0))//When set is pressed, the following key will be effective if the number of key presses is not equal to zero.
{
if(add==0) //up key
{
delay(10);
if(add==0)
{
led1=0;
collection=0;
buzzer=0; //The buzzer beeps once
delay(20);
buzzer=1;
while(!add);
switch(setn)
{
case 6:miao++; //Press the setting key once to adjust the seconds
if(miao==60)
miao=0; //If the seconds exceed 59, add 1 and return to zero
write_sfm(0x06,miao); //Let LCD display "plus" the set seconds in the correct position
temp=(miao)/10*16+(miao)%10; //Convert decimal into DCB code required by DS1302
write_1302(0x8e,0x00); //Allow writing, disable write protection
write_1302(0x80,0x80|temp); //Write the adjusted second data BCD code to the second register 80H in DS1302
write_1302(0x8e,0x80); //Open write protection
write_1602com(er+7);//Because the LCD mode is set to write data, the cursor automatically moves to the right, so you need to specify the return
//write_1602com(0x0b);
break;
case 5:fen++;
if(fen==60)
fen=0;
write_sfm(0x03,fen); //Let LCD display the set "plus" data in the correct position
temp=(fen)/10*16+(fen)%10; //Convert decimal to DCB code required by DS1302
write_1302(0x8e,0x00); //Allow writing, disable write protection
write_1302(0x82,temp); //Write the adjusted sub-data BCD code to the sub-register 82H in DS1302
write_1302(0x8e,0x80); //Open write protection
write_1602com(er+4); //Because the LCD mode is set to write data, the pointer automatically increases by one, so here it is written back to the original position
break;
case 4: shi++;
if(shi==24)
it=0;
write_sfm(0x00,shi); //Let LCD display the set hour data in the correct position
temp=(shi)/10*16+(shi)%10; //Convert decimal into DCB code required by DS1302
write_1302(0x8e,0x00); //Allow writing, disable write protection
write_1302(0x84,temp); //Write the adjusted hour data BCD code to hour register 84H in DS1302
write_1302(0x8e,0x80); //Open write protection
write_1602com(er+1); //Because the LCD mode is set to write data, the pointer automatically increases by one, so the cursor needs to return to its original position
break;
/*
case 4:week++;
if(week==8)
week=1;
write_1602com(yh+0x0C); //Specify the position of weekly data display after 'add'
Previous article:51 MCU Proteus simulation 320x240TFT color screen
Next article:Microcontroller breathing light program and waveform demonstration
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- How to select parameters for servo motor inertia size
- The difference between the servo motor moment of inertia and the load moment of inertia
- How to calculate the inertia of servo motor and reducer
- What is the difference between a servo press and a normal press?
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Why does the voltage of C46 become normal after replacing a larger capacitor?
- I'd like to ask if anyone has this tutorial.
- E-sports preparation experience
- CH224K test QC2.0 protocol 9V+E-Mark function
- [Qinheng Trial] Single-step simulation
- [Atria Development Board AT32F421 Review] - Peripheral Review
- MSP430G2553 beginner design experience sharing
- MSP430F123 experience
- About "wired" and "wireless" transmission
- Level conversion