...............
mov r0, #5
bl led_start
..................
.................
led_start:
led_loop:
ldr r3, =0x3FFFF
ldr r2, =0x7FF
str r2, [r1, #oGPIO_DAT]
led_loop_1:
subs r3, r3, #1
bne led_loop_1
ldr r3, =0x3FFFF
mov r2, #0x00
str r2, [r1, #oGPIO_DAT]
led_loop_2:
subs r3, r3, #1
bne led_loop_2
subs r0, r0, #1
bne led_loop
led_exit:
mov pc, lr
该段程序的本意是调用led子程序,让led闪烁几次,次数存储在r0中。但是结果却是每当进入led闪烁程序,就不能退出来了。led一直在闪烁,好像语句subs r0,r0,#1执行后,r0永远不为0,一直跳到led_loop处执行下一次循环。请高手指教一下,是什么地方出了问题啊?在此谢过了!