资源描述:
《KEIL C51 使用结构,变量与位变量对比》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、KEILC51使用结构,变量与位变量对比测试环境:优化等级:8程序说明:程序中含其它代码,只对比添加部分。变量在Isr.c文件中定义,在Isr.h文件声明为全局变量,在Main.c文件主循环中调用。1.使用结构typedefstruct_IsrFlagType{BYTEFlag0:1;BYTEFlag1:1;BYTEFlag2:1;BYTEFlag3:1;BYTEFlag4:1;BYTEFlag5:1;BYTEFlag6:1;BYTEFlag7:1;}IsrFlagType;externIsrFlagT
2、ypeg_ucFlag;#defineGET_Flag0()(g_ucFlag.Flag0)#defineSET_Flag0()(g_ucFlag.Flag0=1)#defineCLR_Flag0()(g_ucFlag.Flag0=0)//8个标志都使用的编译结果ProgramSize:data=142.1xdata=48code=1229185:if(GET_Flag0())C:0x23FBE54BMOVA,g_ucFlag(0x4B)C:0x23FD30E006JNB0xE0.0,C:240686:
3、CLR_Flag0();87:elseC:0x240054FEANLA,#0xFEC:0x2402F54BMOVg_ucFlag(0x4B),AC:0x24048006SJMPC:240C88:SET_Flag0();89:C:0x2406E54BMOVA,g_ucFlag(0x4B)C:0x24084401ORLA,#0x01C:0x240AF54BMOVg_ucFlag(0x4B),A90:if(GET_Flag1())C:0x240CAF4BMOVR7,g_ucFlag(0x4B)C:0x240E
4、EFMOVA,R7分区temp的第1页C:0x240EEFMOVA,R7C:0x240FC3CLRCC:0x241013RRCAC:0x241130E007JNB0xE0.0,C:241B91:CLR_Flag1();92:elseC:0x2414EFMOVA,R7C:0x241554FDANLA,#0xFDC:0x2417F54BMOVg_ucFlag(0x4B),AC:0x24198006SJMPC:242193:SET_Flag1();94:C:0x241BE54BMOVA,g_ucFlag(0x
5、4B)C:0x241D4402ORLA,#0x02C:0x241FF54BMOVg_ucFlag(0x4B),A95:if(GET_Flag2())C:0x2421AF4BMOVR7,g_ucFlag(0x4B)C:0x2423EFMOVA,R7C:0x242413RRCAC:0x242513RRCAC:0x2426543FANLA,#0x3FC:0x242830E007JNB0xE0.0,C:243296:CLR_Flag2();97:elseC:0x242BEFMOVA,R7C:0x242C54FB
6、ANLA,#0xFBC:0x242EF54BMOVg_ucFlag(0x4B),AC:0x24308006SJMPC:243898:SET_Flag2();99:C:0x2432E54BMOVA,g_ucFlag(0x4B)C:0x24344404ORLA,#0x04C:0x2436F54BMOVg_ucFlag(0x4B),A100:if(GET_Flag3())C:0x2438AF4BMOVR7,g_ucFlag(0x4B)C:0x243AEFMOVA,R7C:0x243B13RRCAC:0x243
7、C13RRCAC:0x243D13RRCAC:0x243E541FANLA,#0x1FC:0x244030E007JNB0xE0.0,C:244A101:CLR_Flag3();102:elseC:0x2443EFMOVA,R7C:0x244454F7ANLA,#0xF7C:0x2446F54BMOVg_ucFlag(0x4B),AC:0x24488006SJMPC:2450103:SET_Flag3();104:C:0x244AE54BMOVA,g_ucFlag(0x4B)C:0x244C4408OR
8、LA,#0x08C:0x244EF54BMOVg_ucFlag(0x4B),A105:if(GET_Flag4())C:0x2450AF4BMOVR7,g_ucFlag(0x4B)C:0x2452EFMOVA,R7C:0x2453C4SWAPAC:0x2454540FANLA,#0x0F分区temp的第2页C:0x2454540FANLA,#0x0FC:0x245630E007JNB0xE0.0,C:2460106:CLR_Flag4();