本帖最后由 CC2530 于 2011-7-11 08:57 编辑
#define LED_1 IO_TICC_OBJECT_DEF(0,1) //LED_1::P01
#define LED_2 IO_TICC_OBJECT_POLARITY_DEF(1,5,0) //LED_2::P15,低电平表示ON
uint8 x;
int main(void)
{
LED_1.MakeOut().Set().Clr().Toggle().MakeInHighImpedance().Read(x);
LED_1.Write(!x);
LED_2.MakeOut().On().Off().Toggle().MakeInHighImpedance().ReadOnOff(x);
LED_2.WriteOnOff(!x);
while(1);
}
IAR 8051 7.60编译汇编代码:
RSEG NEAR_CODE:CODE:NOROOT(0)
// 10 int main(void)
main:
// 11 {
; Auto size: 0
// 12
// 13 LED_1.MakeOut().Set().Clr().Toggle().MakeInHighImpedance().Read(x);
ORL 0xfd,#0x2
SETB 0x80.1
CLR 0x80.1
XRL 0x80,#0x2
MOV A,0x80
ORL 0x8f,#0x2
ANL 0xfd,#0xfd
MOV C,0x80.1
JNC ??main_0
CLR 0x80.1
SJMP ??main_1
??main_0:
SETB 0x80.1
// 14 LED_1.Write(!x);
// 15
// 16 LED_2.MakeOut().On().Off().Toggle().MakeInHighImpedance().ReadOnOff(x);
??main_1:
ORL 0xfe,#0x20
CLR 0x90.5
SETB 0x90.5
XRL 0x90,#0x20
MOV A,0x90
ORL 0xf6,#0x20
ANL 0xfe,#0xdf
MOV C,0x90.5
JNC ??main_2
CLR 0x90.5
SJMP ??main_3
??main_2:
SETB 0x90.5
// 17 LED_2.WriteOnOff(!x);
// 18
// 19 while(1);
|