我需要编写 C 代码
DDRB &= ~pins;
内联汇编 (AVR)。我以前从未使用过它。我的尝试:
register uint8_t t1, t2; // temporary registers
__asm__ volatile (
"in %[t1], %[w1_ddr]" "\n\t"
"mov %[t2], %[pins]" "\n\t"
"com %[t2]" "\n\t"
"and %[t1], %[t2]" "\n\t"
"out %[w1_ddr], %[t1]" "\n\t"
: [t1] "+r" (t1),
[t2] "+r" (t2),
[w1_ddr] "+I" (_SFR_IO_ADDR(DDRB))
: [pins] "r" (pins)
);
gcc
给出以下错误lvalue required in asm statement
。我究竟做错了什么?