程序实现
.text
.global _start
_start:
@使能GPIOE的外设时钟
LDR R0,=0x50000A28
LDR R1,[R0]
ORR R1,R1,#(0x3<<4)
STR R1,[R0]
@设置PE10为输出
LDR R0,=0x50006000
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
ORR R1,R1,#(0x1<<20)
STR R1,[R0]
@设置PF10为输出
LDR R0,=0x50007000
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
ORR R1,R1,#(0x1<<20)
STR R1,[R0]
@设置PE8为输出
LDR R0,=0x50006000
LDR R1,[R0]
BIC R1,R1,#(0x3<<16)
ORR R1,R1,#(0x1<<16)
STR R1,[R0]
@设置PE10为推完输出
LDR R0,=0x50006004
LDR R1,[R0]
BIC R1,R1,#(0x1<<10)
STR R1,[R0]
@设置PF10为推完输出
LDR R0,=0x50007004
LDR R1,[R0]
BIC R1,R1,#(0x1<<10)
STR R1,[R0]
@设置PE8为推完输出
LDR R0,=0x50006004
LDR R1,[R0]
BIC R1,R1,#(0x1<<8)
STR R1,[R0]
@设置PE10为低速输出**********
LDR R0,=0x50006008
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
STR R1,[R0]
@设置PF10为低速输出**********
LDR R0,=0x50007008
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
STR R1,[R0]
@设置PE8为低速输出**********
LDR R0,=0x50006008
LDR R1,[R0]
BIC R1,R1,#(0x3<<16)
STR R1,[R0]
@设置PE10输出时无上拉无下拉电阻
LDR R0,=0x5000600C
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
STR R1,[R0]
@设置PE10输出时无上拉无下拉电阻
LDR R0,=0x5000700C
LDR R1,[R0]
BIC R1,R1,#(0x3<<20)
STR R1,[R0]
@设置PE10输出时无上拉无下拉电阻
LDR R0,=0x5000600C
LDR R1,[R0]
BIC R1,R1,#(0x3<<16)
STR R1,[R0]
loop:
bl led1_on
bl led2_off
bl led3_off
bl delay
bl led1_off
bl led2_on
bl led3_off
bl delay
bl led1_off
bl led2_off
bl led3_on
bl delay
b loop
led1_on:
LDR R0,=0X50006014
LDR R1,[R0]
ORR R1,R1,#(0x1<<10)
STR R1, [R0]
mov pc,lr
led1_off:
LDR R0,=0X50006014
LDR R1,[R0]
BIC R1,R1,#(0x1<<10)
STR R1, [R0]
mov pc,lr
led2_on:
LDR R0,=0X50007014
LDR R1,[R0]
ORR R1,R1,#(0x1<<10)
STR R1, [R0]
mov pc,lr
led2_off:
LDR R0,=0X50007014
LDR R1,[R0]
BIC R1,R1,#(0x1<<10)
STR R1, [R0]
mov pc,lr
led3_on:
LDR R0,=0X50006014
LDR R1,[R0]
ORR R1,R1,#(0x1<<8)
STR R1, [R0]
mov pc,lr
led3_off:
LDR R0,=0X50006014
LDR R1,[R0]
BIC R1,R1,#(0x1<<8)
STR R1, [R0]
mov pc,lr
delay:
LDR R3,=0x10000000
mm:
cmp r3,#0
subne r3,r3,#1
bne mm
mov pc,lr
.end
实验现象