/*------------------------------------------------------------------------------------- 通用MCU8位16位24位32位变量定义头文件MCUBIT.H 分别在PICC,Keil C51,WINAVR,IAR 430上通过编译 HotPower@126.com 2004.11.3 于西安大雁塔村队部 --------------------------------------------------------------------------------------*/ typedef struct { unsigned BIT00: 1; unsigned BIT01: 1; unsigned BIT02: 1; unsigned BIT03: 1; unsigned BIT04: 1; unsigned BIT05: 1; unsigned BIT06: 1; unsigned BIT07: 1; }MCUBIT8;//定义一个只能按8位域寻址的新变量类型
typedef union { MCUBIT8 BIT;//可以按8位域寻址 unsigned char BYTE;//可以按字节寻址 }MCUBITBYTE;//定义一个既能按8位域寻址也可按字节寻址的新变量类型
typedef struct { unsigned BIT00: 1; unsigned BIT01: 1; unsigned BIT02: 1; unsigned BIT03: 1; unsigned BIT04: 1; unsigned BIT05: 1; unsigned BIT06: 1; unsigned BIT07: 1; unsigned BIT08: 1; unsigned BIT09: 1; unsigned BIT10: 1; unsigned BIT11: 1; unsigned BIT12: 1; unsigned BIT13: 1; unsigned BIT14: 1; unsigned BIT15: 1; }MCUBIT16;//定义一个只能按16位域寻址的新变量类型
typedef union { MCUBIT16 BIT;//可以按16位域寻址 unsigned int WORD;//可以按字寻址 }MCUBITWORD;//定义一个既能按16位域寻址也可按字寻址的新变量类型
typedef struct { unsigned BIT00: 1; unsigned BIT01: 1; unsigned BIT02: 1; unsigned BIT03: 1; unsigned BIT04: 1; unsigned BIT05: 1; unsigned BIT06: 1; unsigned BIT07: 1; unsigned BIT08: 1; unsigned BIT09: 1; unsigned BIT10: 1; unsigned BIT11: 1; unsigned BIT12: 1; unsigned BIT13: 1; unsigned BIT14: 1; unsigned BIT15: 1; unsigned BIT16: 1; unsigned BIT17: 1; unsigned BIT18: 1; unsigned BIT19: 1; unsigned BIT20: 1; unsigned BIT21: 1; unsigned BIT22: 1; unsigned BIT23: 1; }MCUBIT24;//定义一个只能按24位域寻址的新变量类型
typedef struct { unsigned int WORD;//低16位 unsigned char HBYTE;//高8位 }MCUHWORD;//定义一个一字半新变量类型
typedef union { MCUBIT24 BIT;//可以按24位域寻址 MCUHWORD HWORD;//可以按一字半寻址 }MCUBITHWORD;//定义一个既能按24位域寻址也可按一字半寻址的新变量类型
typedef struct { unsigned BIT00: 1; unsigned BIT01: 1; unsigned BIT02: 1; unsigned BIT03: 1; unsigned BIT04: 1; unsigned BIT05: 1; unsigned BIT06: 1; unsigned BIT07: 1; unsigned BIT08: 1; unsigned BIT09: 1; unsigned BIT10: 1; unsigned BIT11: 1; unsigned BIT12: 1; unsigned BIT13: 1; unsigned BIT14: 1; unsigned BIT15: 1; unsigned BIT16: 1; unsigned BIT17: 1; unsigned BIT18: 1; unsigned BIT19: 1; unsigned BIT20: 1; unsigned BIT21: 1; unsigned BIT22: 1; unsigned BIT23: 1; unsigned BIT24: 1; unsigned BIT25: 1; unsigned BIT26: 1; unsigned BIT27: 1; unsigned BIT28: 1; unsigned BIT29: 1; unsigned BIT30: 1; unsigned BIT31: 1; }MCUBIT32;//定义一个只能按32位域寻址的新变量类型
typedef union { MCUBIT32 BIT;//可以按32位域寻址 unsigned long DWORD;//可以按双字寻址 }MCUBITDWORD;//定义一个既能按32位域寻址也可按双字寻址的新变量类型
|
用户377235 2013-7-19 10:31