Hi list, Like many people I guess, I am using in-lined "nop" asm statements to respect the timing of external devices, when toggling their control lines.
In the case at hand I am driving a text LCD module, and the "Enable" line must be pulsed low for 250ns. void lcd_send_nibble(uint8_t data) { ... //pulse Enable line LCD_PORT |= LCD_E; __asm__ volatile("nop"); __asm__ volatile("nop"); __asm__ volatile("nop"); __asm__ volatile("nop"); LCD_PORT &= ~LCD_E; } My AVR was running at 8MHz, so an instruction cycle of 125ns, so two nop in-lined were spot on, just perfect, and it ran fine. Today I pushed the AVR (ATmega32) up to its maximum of 16MHz. So I now need 4 nops not two. So I did that.. and the LCD doesn't work reliably. Suspecting the problem, I went straight to the generated assembly, and horror, my 4 nop statements have disappeared ! I made a few trials. It appears that up to and including 3 nop statements, GCC leaves them alone. But if I put 4 of them, it removes them all ! Any way to instruct GCC to leave my 4 nops ? Am using avr-gcc 4.3.2 Regards, -- Vince _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list