本帖最后由 CC2530 于 2011-7-11 09:24 编辑
#define LED_1 IO_STM8_OBJECT_DEF(A,3) //LED:A3
#define LED_2 IO_STM8_OBJECT_POLARITY_DEF(B,5,0) //LED:A5,极性负,低电平表示On
uint8 x;
int main()
{
LED_1.MakeOut().Set().Clr().Toggle().MakeInputFloatingWithoutInterrupt().Read(x);
LED_1.Write(!x);
LED_2.MakeOut().On().Off().Toggle().MakeInputFloatingWithoutInterrupt().ReadOnOff(x);
LED_2.WriteOnOff(!x);
while(1);
}
}
SECTION `.near_func.text`:CODE:REORDER:NOROOT(0)
CODE
// 9 int main()
// 10 {
// 11 LED_1.MakeOut().Set().Clr().Toggle().MakeInputFloatingWithoutInterrupt().Read(x);
main:
BSET L:0x5002, #0x3
BSET L:0x5000, #0x3
BRES L:0x5000, #0x3
LD A, L:0x5000
XOR A, #0x8
LD L:0x5000, A
BRES L:0x5002, #0x3
BRES L:0x5003, #0x3
BRES L:0x5004, #0x3
BTJF L:0x5001, #0x3, L:??main_0
MOV L:`x`, #0x1
BRES L:0x5000, #0x3
JRA L:??main_1
??main_0:
CLR L:`x`
BSET L:0x5000, #0x3
// 12 LED_1.Write(!x);
// 13
// 14 LED_2.MakeOut().On().Off().Toggle().MakeInputFloatingWithoutInterrupt().ReadOnOff(x);
??main_1:
BSET L:0x5007, #0x5
BRES L:0x5005, #0x5
BSET L:0x5005, #0x5
LD A, L:0x5005
XOR A, #0x20
LD L:0x5005, A
BRES L:0x5007, #0x5
BRES L:0x5008, #0x5
BRES L:0x5009, #0x5
BTJF L:0x5005, #0x5, L:??main_2
CLR L:`x`
BRES L:0x5005, #0x5
JRA L:??main_3
??main_2:
MOV L:`x`, #0x1
BSET L:0x5005, #0x5
// 15 LED_2.WriteOnOff(!x);
// 16
// 17 while(1);
??main_3:
JRA L:??main_3
|