I'm trying to replace a PORT |= BITMASK / PORT &= ~BITMASK type of line with pure assembler sbi() and cbi() calls.
My problem is that I can't seem to get it to work using variables, but it does work with constants. For example, THIS works:
__asm__ __volatile__ ( "sbi %0,%1" : : "I" (0x04), "I" (7) );
But THIS fails with an error message: error: impossible constraint in 'asm'
volatile uint8_t *DDR; x = digitalPinToPort (13); DDR = portModeRegister(x); __asm__ __volatile__ ( "sbi %0,%1" : : "I" (DDR), "I" (7) );
Likewise, if I use a variable in place of the "7" (i.e. bit 7), it fails with the same error (impossible constraint).
Anyone have any idea what I'm doing wrong? I'd appreciate some help. Thanks!