/****为了简单起见,调整时间是只添加了s1和s2,删除了s3的功能,若调过了可通过s2循环一圈 ****/
/****From Brandon 2016-09-17 ****/
/****关键点:按键扫描和定时器0的中断程序比较生疏,需再看 ****/
#include<reg51.h>
sbit LCD_rs=P1^0;
sbit LCD_rw=P1^1;
sbit LCD_en=P2^5;
sbit s1=P3^0;
sbit rd=P3^7;
sbit wr=P3^6;
sbit s2=P3^1;
sbit s3=P3^2;
unsigned char code table[]=" 2016-9-15 THU";
unsigned char code table1[]=" 00:00:00";
unsigned char num,count,s1num;
char miao,shi,fen; //
void Delay(unsigned char i)
{
unsigned char j,k;
for(j=i;j>0;j--)
for(k=110;k>0;k--);
}
void LCD_Write_com(unsigned char a)
{
LCD_rs=0;
Delay(5);
LCD_rw=0;
Delay(5);
P0=a;
Delay(5);
LCD_en=1;
Delay(5);
LCD_en=0;
}
void LCD_Write_data(unsigned char b)
{
LCD_rs=1;
Delay(5);
LCD_rw=0;
Delay(5);
P0=b;
LCD_en=1;
Delay(5);
LCD_en=0;
Delay(5);
}
void LCD_init()
{
Delay(15); <
/****From Brandon 2016-09-17 ****/
/****关键点:按键扫描和定时器0的中断程序比较生疏,需再看 ****/
#include<reg51.h>
sbit LCD_rs=P1^0;
sbit LCD_rw=P1^1;
sbit LCD_en=P2^5;
sbit s1=P3^0;
sbit rd=P3^7;
sbit wr=P3^6;
sbit s2=P3^1;
sbit s3=P3^2;
unsigned char code table[]=" 2016-9-15 THU";
unsigned char code table1[]=" 00:00:00";
unsigned char num,count,s1num;
char miao,shi,fen; //
void Delay(unsigned char i)
{
unsigned char j,k;
for(j=i;j>0;j--)
for(k=110;k>0;k--);
}
void LCD_Write_com(unsigned char a)
{
LCD_rs=0;
Delay(5);
LCD_rw=0;
Delay(5);
P0=a;
Delay(5);
LCD_en=1;
Delay(5);
LCD_en=0;
}
void LCD_Write_data(unsigned char b)
{
LCD_rs=1;
Delay(5);
LCD_rw=0;
Delay(5);
P0=b;
LCD_en=1;
Delay(5);
LCD_en=0;
Delay(5);
}
void LCD_init()
{
Delay(15); <