📄 datatype.h
字号:
typedef unsigned char BCD1[1];
typedef unsigned char BCD2[2];
typedef unsigned char BCD3[3];
typedef unsigned char BCD4[4];
typedef unsigned char BCD5[5];
typedef unsigned char BCD6[6];
typedef unsigned char BCD7[7];
// 8 unsigned chars
typedef struct
{
BCD1 Sec;
BCD1 Min;
BCD1 Hour;
BCD1 Week;
BCD1 Day;
BCD1 Mon;
unsigned int Year;
} RTC;
typedef union
{
unsigned int w[1];
unsigned char b[2];
} REG;
// 4 Bytes
typedef struct
{
#ifdef DISPLAY_CHANGED
unsigned char DispTime:4;
unsigned char Mode:4;
#else
BCD1 DispTime;
BCD1 Mode;
#endif
REG Reg; // Pages Option
}LCDCTRL;
// 2 Bytes
typedef struct
{
unsigned int FeeNo:2; // Bit[ 1~0]: nn
unsigned int Tmr:14; // Bit[15~2]: hh hhhh mmmm mmmm
} TARILIST;
// 36 bytes
typedef struct
{
BCD4 Fee[5]; // 4*5 bytes
BCD4 RevEC; // 4 bytes
unsigned long WE2PTms; // 4 0.1 kWh 的保存次数
BCD1 Addr_0_1; // 1 0.1 度电所保存的E2POM的地址.
BCD5 Data_0_1; // 5
unsigned int PlsNum; // 2
} CMONBLK;
// 20 bytes
typedef struct
{
BCD4 Fee[5]; // 4*5 bytes
} LMONBLK;
// 10 Bytes
typedef struct
{
BCD2 Tms; // 开盖次数
BCD4 Tmr[2]; // [0]:最近一次开盖时间
// [1]:最近上一次开盖时间
} UNCOVER;
// 7 Bytes
typedef struct
{
BCD4 Tmr; // 最近一次反向起始时间
BCD3 AllTmr; // 总反向时间
}IREV;
// 74 Bytes
typedef struct
{
// 16
TARILIST TariList[8];
// 16
UNCOVER UnCover; // 10
BCD4 ProgDT; // 4
BCD2 ProgTms; // 2
// 16
BCD6 MetID; // 6
BCD6 CustID; // 6
BCD3 MetConst; // 3 [1] 电表常数/100.
BCD1 MetStatus; // 1
// 16
BCD4 ReadDT; // 4
LCDCTRL LcdCtl; // 4
BCD4 IRevTmr; // 最近一次反向起始时间
BCD3 IRevAllTmr; // 总反向时间
BCD1 FeeNo; // 1 当前的费率号
// 10
BCD4 Pswd[2]; // 4*2 [0]是清零密码,[1]是编程密码
BCD2 BillDay; // 2
} CFGGRP;
// 158 Bytes
typedef struct
{
CFGGRP Cfg; // 74
int CfgChk; // 2
CMONBLK CMon; // 36
int CMonChk; // 2
LMONBLK LMon; // 20
int LMonChk; // 2
// 以下变量不需要存入E2PROM.
RTC Clk;
int ClkChk;
unsigned int E2Flgs; // 其中的标志位在I2C中定义.
unsigned int TmpOption;
unsigned long cul_t; // 4
unsigned char SecCtr;
unsigned char PagePtr;
signed char bt_int;
signed char Temp; // 1
//unsigned char TAState;
} SRAM;
typedef struct
{
unsigned int EC:1;
unsigned int Com:1;
unsigned int Half:1;
unsigned int Sec:1;
unsigned int Min:1;
unsigned int Hour:1;
unsigned int Key:1;
unsigned int I2C:1;
unsigned int Disp:1;
unsigned int NoUse:7;
}TASKSTATUS;
typedef struct
{
TASKSTATUS Req;
// TASKSTATUS Start;
// TASKSTATUS Wait;
// TASKSTATUS Stop;
}TASK;
// 48 Bytes
typedef struct
{
unsigned int hByte;
unsigned char ComPtr;
unsigned char ByteCS;
unsigned char ComBit; // 接收发送的位数
unsigned char ComTmr; // 通讯定时
unsigned char ComBuf[42];
}RSREG;
// 50 Bytes
typedef struct
{
REG Reg; // 2
TASK Tsk; // 2
#ifndef DATA_IN_LCDMEM
unsigned char Flgs; // 1
unsigned char KeyTmr; // 1 按键定时
#endif
RSREG RS; // 48 Bytes
}DRAM;
#ifdef DATA_IN_LCDMEM
typedef struct
{
//TASK Tsk; // 2
//REG Reg; // 2
unsigned char Flgs; // 1
unsigned char KeyTmr; // 1 按键定时
}DRAM1;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -