On Wed, Oct 28, 2009 at 11:14:08AM -0700, df_welch wrote: > I'm mainly an assembly language user and not a heavy weight C user but > this thread has peaked my interest.
I must admit to having a similar relationship with the AVR, thus far. So much can be done with macros that it isn't always necessary to use C. > Basically as shown below in the Data sheet excerpt, a NOP is necessary > following a write to DDRB(n), and prior to seeing the change on pin(n). That sounds very plausible. Having mostly set direction in an .init section, and then used the port much later, I've not experienced it though. If Joerg Desch could possibly post the relevant assembler snippet, either from an objdump or list file, the risk of that could be seen. A dump would also confirm that the expected instructions are there at all. > I'm not sure that this extends to the entire 8 bit family but it might be > worth looking at. ISTR seeing something related in other AVR datasheets, even if only vaguely. Placing a few nops between sbi and cbi also makes it easier to see the output pulse with less sophisticated equipment than Joerg has [1], and could speed up finding the assembler code snippet if no labels exist in the vicinity. [1] I remember doing that on my first AVR project, even at 1MHz, just to give it every chance of working the first time. Erik _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list