树莓派GPIO引脚编程:直接内存访问实现LED闪烁
1. 初始程序与直接操作GPIO的需求
在之前的程序示例中,有如下代码用于控制LED闪烁:
GPIOWrite pin27, high
nanoSleep
GPIOWrite pin27, low
GPIOWrite pin22, high
nanoSleep
GPIOWrite pin22, low
@decrement loop counter and see if we loop
@ Subtract 1 from loop register
@ setting status register.
subs r6, #1
@ If we haven't counted down to 0 then loop
bne loop
_end: mov R0, #0 @ Use 0 return code
mov R7, #1 @ Command code 1 terminates
svc 0 @ Linux command to terminate
pin17: .asciz "17"
pin27: .asciz "27"
pin22: .asciz "22"
low: .asciz "0"
high: .asciz "1"
不过,对于汇编语言程序员来说,这样的示例并不令人满意。汇编编程通常是为了直接操作设备以提高性能,或者执行高级编程语言无法完成的操作。接下来,我们将直接与GP
超级会员免费看
订阅专栏 解锁全文
2382

被折叠的 条评论
为什么被折叠?



