AVR SBI or CBI on Higher Ports H+

烈酒焚心 提交于 2019-12-11 05:39:12

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/27477833/avr-sbi-or-cbi-on-higher-ports-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!