⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 typedef.h

📁 电能表源码
💻 H
字号:
/********************************************************


********************************************************/
#ifndef _TYPEDEF_H_
#define _TYPEDEF_H_
#define CPU_BIT	 16

#if CPU_BIT	== 16
//-------------------------------
typedef unsigned char 	uint8;
//------------------------------
typedef signed char  	int8;
//------------------------------
typedef	unsigned int 	uint16;
//------------------------------
typedef	signed int 		int16;
//------------------------------
typedef	unsigned long 	uint32;
//------------------------------
typedef	signed long		int32;
//------------------------------
typedef	uint16			bool;
//------------------------------
//typedef signed long long 	int64;

//typedef unsigned long long uint64;

//------------------------------
typedef union
{
	uint16 word;
	uint8  byte[2];
}Word16;

typedef union
{
	uint32 lword;
	uint16 word[2];
	uint8  byte[4];	
}Word32;

typedef union
{
	Word32 word;
	uint8  byte;
}Word40;

struct gbit_def {
        char    b0:1;
        char    b1:1;
		char    b2:1;
		char    b3:1;
		char    b4:1;
		char    b5:1;
		char    b6:1;
		char    b7:1;
};

union gbyte_def {
     struct gbit_def bite;
	 char   byte;
};

struct bit_define {
        unsigned char    b0:1;
        unsigned char    b1:1;
		unsigned char    b2:1;
		unsigned char    b3:1;
		unsigned char    b4:1;
		unsigned char    b5:1;
		unsigned char    b6:1;
		unsigned char    b7:1;
};

union byte_define {
     struct bit_define  bite;
	 unsigned char      byte;
};

//=======================================================核心数据结构体
struct coredata_tablestruct
  { unsigned int     codedataID;         //数据项编号
    unsigned char     datalong;           //数据长度
    unsigned char     stortype;           //数据存贮类型
    unsigned int      dataaddr;           //数据存贮地址
    unsigned char     datatype;           //数据存贮格式
	unsigned char     w_r_ctype;          //可否读写
  };

#ifndef true
#define true 1
#endif

#ifndef false
#define false 0
#endif



#endif







#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -