As Weddington, Eric wrote: > Ok so the above works, but now a question about some theoretical > aspects of this. In practice, the MCUCR register is in the I/O > space, therefore it can be accessed with IN/OUT instructions. The > macro above works, but it *explicitly* specifies the OUT > instruction. But what if there were an AVR device where MCUCR were > *not* in the I/O space?
I think you're hosed in that case anyway (depending on how the "within four clock cycles" restriction is to be interpreted). Accessing the memory space takes two cycles per instruction, so IMHO you would want to have the to respective STS instructions back to back then, just to be on the safe side. That means you'll need another temporary variable then, so you can preset both bit patterns in temp registers, and then fire the two STS instructions. The advantage (if you'd like to call it so :) of my suggested code snippet here is that it will fail assembly in case MCUCR is not in the OUT-accessible address space, while your code will compile but fail to work correctly (again, depending on hour the "four clock cycles" are measured). -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) _______________________________________________ AVR-libc-dev mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
