sw=dat/10; //Get the ten digits
write_1602com(er+add); //er is the value specified in the header file 0x80+0x40
write_1602dat(0x30+sw); //Number + 30 to get the LCD1602 display code of the number
write_1602dat(0x30+gw); //Number + 30 to get the LCD1602 display code of the number
}
//-------------------------------------
//Year, month, day display subfunction
void write_nyr(uchar add,uchar dat) //Write year, month, and day to LCD, with display position addend and display data, two parameters
{
flying gw,sw;
gw=dat%10; //Get the unit digit
sw=dat/10; //Get the ten digits
write_1602com(yh+add); //Set the display position to the first position + add
write_1602dat(0x30+sw); //Number + 30 to get the LCD1602 display code of the number
write_1602dat(0x30+gw); //Number + 30 to get the LCD1602 display code of the number
}
//------------------------------------
//Lunar calendar display subfunction
void write_nl(uchar add,uchar dat) // write hours, minutes, seconds to LCD, with display position add and display data, two parameters
{
flying gw,sw;
//gw=dat%10; //Get the unit digit
//sw=dat/10; //Get the ten digits
gw=dat%16; //Get the unit digit
sw=dat/16; //Get the ten digits
write_1602com(er+add); //er is the value specified in the header file 0x80+0x40
// write_1602dat(0x30+sw); //Number + 30 to get the LCD1602 display code of the number
// write_1602dat(0x30+gw); //Number + 30 to get the LCD1602 display code of the number
write_1602dat('0'+sw); //Number + 30 to get the LCD1602 display code of the number
write_1602dat('0'+gw); //Number + 30 to get the LCD1602 display code of the number
}
//-------------------------------------------
void write_week(uchar week) // write week function
{
write_1602com(yh+0x0c); //Display position of the day of the week character
switch(week)
{
case 1:write_1602dat('M'); //When the week number is 1, display
write_1602dat('O');
write_1602dat('N');
break;
case 2:write_1602dat('T'); //Display when the week data is 2
write_1602dat('U');
write_1602dat('E');
break;
case 3:write_1602dat('W'); //Display when the week data is 3
write_1602dat('E');
write_1602dat('D');
break;
case 4:write_1602dat('T'); //The week data is 4 and is displayed
write_1602dat('H');
write_1602dat('U');
break;
case 5:write_1602dat('F'); //Display when the week data is 5
write_1602dat('R');
write_1602dat('I');
break;
case 6:write_1602dat('S'); //Display when the week data is 6
write_1602dat('T');
write_1602dat('A');
break;
case 0:write_1602dat('S'); //Display when the day of the week is 7
write_1602dat('U');
write_1602dat('N');
break;
}
write_1602dat(' ');
}
//****************Keyboard scanning related functions**************************
void keyscan()
{
uint nian_temp;
if(seeNL_NZ==0)
{
delay(9);
if(seeNL_NZ==0)
{
led1=0;
collection=0;
if(timeron==1)
{
TR2=~TR2;
if(TR2==0)
{
buzzer=1;
}
}
else
{
if((setn==0)&&(setNZn==0)) //Can only be pressed when not in timing mode
{
buzzer=0; //The buzzer beeps once
delay(20);
buzzer=1;
if(TR1==1)
{
TR1=0;
}
else
{
T_NL_NZ++;
if(T_NL_NZ==3)
{
set=0;
setNZn=0;
T_NL_NZ=0;
}
}
}
}
while(seeNL_NZ==0);
}
}
if(set==0)//---------------set is function key (setting key)--------------------
{
delay(9); //delay, used to eliminate jitter
if(set==0) //Confirm the button is pressed again after delay
{
led1=0;
collection=0;
do
{
if(add==0)
zdkg=1;
if(dec==0)
nzkg=1;
}
while((!set)||(!add)||(!dec));
if((nzkg==1)||(zdkg==1))
{
if(nzkg==1)
{
NZK=~NZK;
if(NZK==0)
{
TR2=0;
buzzer=1;
}
}
else
{
if(zdkg==1)
{
ZDK=~ZDK;
if(ZDK==0)
{
TR1=0;
buzzer=1;
}
}
}
if(((NZK==1)&&(nzkg==1))||((ZDK==1)&&(zdkg==1)))
{
buzzer=0;
delay(10);
buzzer=1;
}
else
{
buzzer=0;
delay(5);
buzzer=1;
delay(5);
buzzer=0;
delay(5);
buzzer=1;
}
nzkg=0;
zdkg=0;
}
else
{
buzzer=0; //The buzzer beeps once
delay(20);
buzzer=1;
if(T_NL_NZ==0x02) //Prove that the alarm is set
{
setNZn++;
if(setNZn==4) //The alarm is set successfully, return to normal display and turn on the alarm
{
setNZn=0;
set=0;
// timerOn=1;
}
switch(setNZn)
{
case 0: //Normal display of date and time
write_1602com(0x0c); //Set the cursor not to flash?
write_1602com(er); //Write position of fixed symbol for time display?
for(a=0;a<16;a++)
write_1602dat(NZd[a]); //Write the fixed symbol for display time, two colons
write_sfm(8,nz_shi); //Alarm time
write_sfm(11,nz_fen); //Alarm minutes
write_sfm(14,nz_miao); //alarm seconds
break;
case 3: //The alarm clock second cursor flashes
write_1602com(er+15); //Set the button to be pressed once, and the cursor will be displayed at the second position //er+0x09;
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
- 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!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- 【i.MX6ULL】Driver Development 8——Interrupt Method to Detect Buttons
- Transparent LED display classification
- 2019 TI E-Sports Evaluation Table
- ADC12 usage in MSP430F5XXX
- EEWORLD University ---- Live Replay: Microchip Timberwolf? Audio Processor Online Seminar
- [This week's topic] What kind of questions will be asked in the control class this year? Bonus!
- How to tell whether an operational amplifier is a current feedback type or a voltage feedback type
- Hello everyone, I have a question about serial communication level conversion, please help
- What are the measures to cut off interference propagation paths in PCB design?
- Level 2 PC Technician-FIELD ENGINEER