При пошаговой отладке программы в AVR Studio 6, пройдя функцию _delay_ms(1000); меня перекидывает в файл delay.h на строчку __builtin_avr_delay_cycles(__ticks_dc);.
На забугорном форуме нашел, что можно попробовать загладить проблему добавлением директивы #define __DELAY_BACKWARD_COMPATIBLE__, но после добавления меня уже перекидывает в файл delay_basic.h на вот эту вот функцию:
Код
/** \ingroup util_delay_basic
Delay loop using a 16-bit counter \c __count, so up to 65536
iterations are possible. (The value 65536 would have to be
passed as 0.) The loop executes four CPU cycles per iteration,
not including the overhead the compiler requires to setup the
counter register pair.
Thus, at a CPU speed of 1 MHz, delays of up to about 262.1
milliseconds can be achieved.
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
"1: sbiw %0,1" "\n\t"
"brne 1b"
: "=w" (__count)
: "0" (__count)
);
}
Delay loop using a 16-bit counter \c __count, so up to 65536
iterations are possible. (The value 65536 would have to be
passed as 0.) The loop executes four CPU cycles per iteration,
not including the overhead the compiler requires to setup the
counter register pair.
Thus, at a CPU speed of 1 MHz, delays of up to about 262.1
milliseconds can be achieved.
*/
void
_delay_loop_2(uint16_t __count)
{
__asm__ volatile (
"1: sbiw %0,1" "\n\t"
"brne 1b"
: "=w" (__count)
: "0" (__count)
);
}
Изначально при компиляции выскакивали проблемы из-за файла delay.h но они вылечились добавлением вначале #define F_CPU 12000000UL и в настройках компилятора в AVR/GNU C Compiler-Symbols добавил:
DEBUG
F_CPU 12000000UL
П.С. Микроконтроллер Xmega