资源描述:
《实现io端口直接位定义操作的一个示例(An example of implementing IO port direct bit definition operation)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、实现io端口直接位定义操作的一个示例(AnexampleofimplementingIOportdirectbitdefinitionoperation)IAR-Csoftwarehasapowerfulsimulationfunction,buttheregisterdefinitionisverycumbersomeoperation,ASMcoderedundancyandcompiled,inordertosolvethisproblem,amethodofselfdefinedmoderatoroperationdefinition,beginnerscanre
2、fertothedefinition,andthismethodcanbeappliedtoallregisterbitoperationdefinition.Atotaloffourbitoperationsareimplemented,suchassetting--Set_Bit,clearing--Clr_Bit,takingreversebitCom_Bit,andtestingbitTest_Bit,Andeachbitoperationdefinitionneedsonlya3byteASMinstructionsequence,whichissimplean
3、ddirect//*****************************************************//P00bitoperationdefinition#defineSet_P00(P0=P0
4、0x1)#defineClr_P00(P0=P0&~0x1)#defineCom_P00(P0=P0^0x1)#defineTest_P00(P0&0x1)//P01bitoperationdefinition#defineSet_P01(P0=P0
5、0x2)#defineClr_P01(P0=P0&~0x2)#defineCom_P01(P0=P0^0x
6、2)#defineTest_P01(P0&0x2)//P02bitoperationdefinition#defineSet_P02(P0=P0
7、0x4)#defineClr_P02(P0=P0&~0x4)#defineCom_P02(P0=P0^0x4)#defineTest_P02(P0&0x4)//P03bitoperationdefinition#defineSet_P03(P0=P0
8、0x8)#defineClr_P03(P0=P0&~0x8)#defineCom_P03(P0=P0^0x8)#defineTest_P03(P0&0x8)//P04bitoper
9、ationdefinition#defineSet_P04(P0=P0
10、0x10)#defineClr_P04(P0=P0&~0x10)#defineCom_P04(P0=P0^0x10)#defineTest_P04(P0&0x10)//P05bitoperationdefinition#defineSet_P05(P0=P0
11、0x20)#defineClr_P05(P0=P0&~0x20)#defineCom_P05(P0=P0^0x20)#defineTest_P05(P0&0x20)//P06bitoperationdefinition#defineSet_P06
12、(P0=P0
13、0x40)#defineClr_P06(P0=P0&~0x40)#defineCom_P06(P0=P0^0x40)#defineTest_P06(P0&0x40)//P07bitoperationdefinition#defineSet_P07(P0=P0
14、0x80)#defineClr_P07(P0=P0&~0x80)#defineCom_P07(P0=P0^0x80)#defineTest_P07(P0&0x80)//*************************************//P1portoperationbitdefinition/
15、/P10bitoperationdefinition#defineSet_P10(P1=P1
16、0x1)#defineClr_P10(P1=P1&~0x1)#defineCom_P10(P1=P1^0x1)#defineTest_P10(P1&0x1)//P11bitoperationdefinition#defineSet_P11(P1=P1
17、0x2)#defineClr_P11(P1=P1&~0x2)#defineCom_P11(P1=P1^0x2)#defineTest_P11(P1&0x2)//P12bitoperati