代码
main文件
#include <STC15F2K60S2.H>
#include "ds1302.h"
#include "iic.h"
#define control(x,y) P0=y;P2=x;P2=0
typedef unsigned char uchar ;
typedef unsigned int uint ;
code unsigned char Seg_Code[] =
{
0xc0, //0
0xf9, //1
0xa4, //2
0xb0, //3
0x99, //4
0x92, //5
0x82, //6
0xf8, //7
0x80, //8
0x90, //9
0xff, //Ãð
0xbf, //- 11
0xc6, //C12
0xa1, //d13
0x86, //E14
0x8e //F
};
uchar Seg_Bit[9]={10,10,10,10,10,10,10,10,10};
uchar interface;
uchar count_key;
uchar hour=0x23,sec=0x09,min=0x59;
uchar hour_save;
uchar min_save;
uchar count_time;
uint input;
uchar input_value;
uint input_save=65522;
bit flag_input;
uchar count_input;
uchar value1;
uchar value2;
bit flag_save;
uchar L[5];
bit flag_big;
bit flag_hour;
uchar hour_show;
uchar min_show;
void Timer2Init(void)
{
AUXR |= 0x04; //?????1T??
T2L = 0x20; //??????
T2H = 0xD1; //??????
AUXR |= 0