資源描述:
《KEIL C51 使用結(jié)構(gòu),變量與位變量對(duì)比》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、KEILC51使用結(jié)構(gòu),變量與位變量對(duì)比測(cè)試環(huán)境:優(yōu)化等級(jí):8程序說(shuō)明:程序中含其它代碼,只對(duì)比添加部分。變量在Isr.c文件中定義,在Isr.h文件聲明為全局變量,在Main.c文件主循環(huán)中調(diào)用。1.使用結(jié)構(gòu)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個(gè)標(biāo)志都使用的編譯結(jié)果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分區(qū)temp的第1頁(yè)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分區(qū)temp的第2頁(yè)C:0x2454540FANLA,#0x0FC:0x245630E007JNB0xE0.0,C:2460106:CLR_Flag4();