问题
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