📄 var.c
字号:
#include "fun.h"
/***************MAIN.C***************/
bdata uchar flag;
sbit flag_int0=flag^0;
sbit flag_frame=flag^1;
sbit flag_key=flag^2;
sbit flag_change=flag^3;
data uchar num_t1;
data uint last_id;
data uchar hp;
data uchar lp;
/************************数据格式***************************/
//sd2300api中的时间数据格式
data struct bcd1_time
{uchar year,month,day;
uchar week;
uchar hour,minute,second;
}bcd1_realtime;
//时间十进制格式
data struct binary_time
{uchar year,month,day;
uchar hour,minute,second;
}binary_realtime;
//bc728x中的时间数据格式
data struct bcd2_time
{uchar yearh,yearl,monthh,monthl,dayh,dayl;
uchar hourh,hourl,minuteh,minutel,secondh,secondl;
}bcd2_realtime;
//BC728X中的数据格式
data struct bcd
{uchar yearh,yearl,monthh,monthl,dayh,dayl;
uchar days[5];
}bcd_24wcxx;
//24WCXX中的十进制数据格式
data struct binary
{uchar year,month,day;
ulong days;
}binary_24wcxx;
//KEY.C
union
{ulong lf;
struct
{uint f1,f2;}sf;
}data frame;
/*********************每月天数*************************/
//闰年的2月有29天,平年2月只有28天
//闰年的条件:年份数year能被4整除,但不能被100整除;
// 或者年份数year能被400整除
//year%4==0&&year%100!=0||year%400==0;//真为闰年29,假为平年28
//year%4==0//因为2000~2099,
uchar code daytab[2][13]=
{
{0,31,28,31,30,31,30,31,31,30,31,30,31}, //平年
{0,31,29,31,30,31,30,31,31,30,31,30,31} //润年
};
/**********************地址格式***************************/
//24WCXX内部地址
uchar code addrtab[29]=
{0x00,
0x08,0x10,0x18,0x20,0x28,0x30,0x38,
0x40,0x48,0x50,0x58,0x60,0x68,0x70,
0x78,0x80,0x88,0x90,0x98,0xa0,0xa8,
0xb0,0xb8,0xc0,0xc8,0xd0,0xd8,0xe0
};
/*uint code addrtab[29]={0x00,
0x0010,0x0020,0x0030,0x0040,0x0050,0x0060,0x0070,
0x0080,0x0090,0x00a0,0x00b0,0x00c0,0x00d0,0x00e0,
0x00f0,0x0100,0x0110,0x0120,0x0130,0x0140,0x0150,
0x0160,0x0170,0x0180,0x0190,0x01a0,0x01b0,0x01c0
}; */
//片选BC728X的CLK信号
uchar code clktab[29][12]=
{/*00*/{0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7},
/*01*/{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf6,0xf6,0xf6,0xf6,0xf6},
/*02*/{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf5,0xf5,0xf5,0xf5,0xf5},
/*03*/{0xff,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4,0xf4},
/*04*/{0xff,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3,0xf3},
/*05*/{0xff,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2,0xf2},
/*06*/{0xff,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1,0xf1},
/*07*/{0xff,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0},
/*08*/{0xff,0xf0,0xf0,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xef,0xef,0xef},
/*09*/{0xff,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xef,0xee},
/*10*/{0xff,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee,0xee},
/*11*/{0xff,0xed,0xed,0xed,0xed,0xed,0xed,0xed,0xed,0xed,0xed,0xed},
/*12*/{0xff,0xed,0xed,0xed,0xed,0xed,0xec,0xec,0xec,0xec,0xec,0xec},
/*13*/{0xff,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xec,0xeb},
/*14*/{0xff,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb},
/*15*/{0xff,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea},
/*16*/{0xff,0xea,0xea,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9},
/*17*/{0xff,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe9,0xe8},
/*18*/{0xff,0xe8,0xe8,0xe8,0xe8,0xe8,0xe8,0xe8,0xe8,0xe8,0xe8,0xe8},
/*19*/{0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7,0xe7},
/*20*/{0xff,0xe7,0xe7,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6},
/*21*/{0xff,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe6,0xe5},
/*22*/{0xff,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5,0xe5},
/*23*/{0xff,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4,0xe4},
/*24*/{0xff,0xe4,0xe4,0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3},
/*25*/{0xff,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe3,0xe2},
/*26*/{0xff,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2,0xe2},
/*27*/{0xff,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1,0xe1},
/*28*/{0xff,0xe1,0xe1,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0}
};
//BC728X内部寄存器地址
uchar code regtab[29][12]=
{/*00*/{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b},
/*01*/{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x01,0x02,0x03,0x04},
/*02*/{0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x01,0x02,0x03,0x04},
/*03*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x08,0x09,0x0a,0x0b,0x0c},
/*04*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x08,0x09,0x0a,0x0b,0x0c},
/*05*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x08,0x09,0x0a,0x0b,0x0c},
/*06*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x08,0x09,0x0a,0x0b,0x0c},
/*07*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a},
/*08*/{0xff,0x0b,0x0c,0x0d,0x0e,0x0f,0x00,0x01,0x02,0x03,0x04,0x05},
/*09*/{0xff,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x00},
/*10*/{0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b},
/*11*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a},
/*12*/{0xff,0x0b,0x0c,0x0d,0x0e,0x0f,0x00,0x01,0x02,0x03,0x04,0x05},
/*13*/{0xff,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x00},
/*14*/{0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b},
/*15*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a},
/*16*/{0xff,0x0b,0x0c,0x0d,0x0e,0x0f,0x00,0x01,0x02,0x03,0x04,0x05},
/*17*/{0xff,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x00},
/*18*/{0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b},
/*19*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a},
/*20*/{0xff,0x0b,0x0c,0x0d,0x0e,0x0f,0x00,0x01,0x02,0x03,0x04,0x05},
/*21*/{0xff,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x00},
/*22*/{0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b},
/*23*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a},
/*24*/{0xff,0x0b,0x0c,0x0d,0x0e,0x0f,0x00,0x01,0x02,0x03,0x04,0x05},
/*25*/{0xff,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x00},
/*26*/{0xff,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b},
/*27*/{0xff,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a},
/*28*/{0xff,0x0b,0x0c,0x0d,0x0e,0x0f,0x00,0x01,0x02,0x03,0x04,0x05}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -