更高端口 H+ 上的 AVR SBI 或 CBI [英] AVR SBI or CBI on Higher Ports H+

查看:35
本文介绍了更高端口 H+ 上的 AVR SBI 或 CBI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 avr 汇编中使用 CBI 或 SBI 时遇到问题,当使用端口 H 到 L 时.来自文档 [http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_SBI.html] SBI 仅采用 5 位参数,如果我使用端口 H 或更高,来自 _SFR_IO_ADDR(PORTH) 的地址将超出允许范围.有没有其他选择来实现这一目标?谢谢.

I have a problem on using CBI or SBI in avr assembly, when working with Port H through L. From the documentation [http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_SBI.html] the SBI takes parameter of 5 bit only which if I am using port H or higher, the address from _SFR_IO_ADDR(PORTH) will exceed the allowed range. Is there any alternative to achieve this? Thanks.

推荐答案

您需要 LD 值,执行操作位所需的 OR 或 AND,然后 ST 返回值.除非你只需要写一个 1 以便例如清除中断.在这种情况下,您应该直接 ST 适当的值.

You need to LD the value, perform the OR or AND necessary to manipulate the bits, and then ST the value back. Unless you need to only write a 1 in order to e.g. clear an interrupt. In that case you should just ST the appropriate value directly.

这篇关于更高端口 H+ 上的 AVR SBI 或 CBI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆