I'm using Arduino IDE 1.8.1 on windows 10 and I'm getting something very strange.
The problem only happens if using util/delay.h and the _delay_ms(), _delay_us() functions.
Removing the include and F_CPU #define and using delay() and delayMicroseconds() solved the problem.
But, as this code will (probably) evolve to an ISR routine I might need to use util/delay.h, I have used it several times, but this is the first time I use _delay_us(), is it broken ???
download util delay.h
Download
https://lpoms.com/2xwcmb
Yes they do.
I was using delay.h because the standard delay() gets confused when you start to mess with the timers, and this program may well go in that direction. I had no idea that such limitation existed with _delay_ms() and _delay_us().
The header file delay.h contains documentation in the form of comments in the file. To open the delay.h file in Atmel Studio, right-click the header file name in the C source file and then click Goto Implementation on the menu that pops up.
f5d0e4f075