Currently I am messing a lot with inline assembler. Especially I refer to ports and registers like so:
: [gtccr] "M" (_SFR_IO_ADDR (GTCCR)), [tcnt0] "M" (_SFR_IO_ADDR (TCNT0)), [gtccr_mask] "M" ((1 << TSM) | (1 << PSRSYNC)), [eimsk] "M" (_SFR_MEM_ADDR(EIMSK))
Now instead of using OUT to set GTCCR is used STS to “access it”. This however outputs into PINB. Now the interesting thing is what happens. Obviously PINB is supposed to be read and not to be written. One could assume that the effect is that the command is just ignored. But this is not the case. What happens is that it seems to be ignored but some seconds later the processor starts to behave strange.
Cost me about 2 hours debugging …
Any comments why this bites back only with some delay? This is something I would not have expected at all.