virtuality 0 9 июля, 2006 Опубликовано 9 июля, 2006 · Жалоба Перейти что ли на WinAVR? Блин, CodeVision удобен, больше похож на среду разработки, чем WinAVR. Вот как например в WinAVR узнать размер получившейся программы? КОнсоль выдает Total 17900, хотя это не соответствует истине - файл заливается в Mega16 без проблем. Существуют ли библиотеки для WinAVR для работы с 1-Wire ? Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
shevek 0 9 июля, 2006 Опубликовано 9 июля, 2006 · Жалоба Существуют ли библиотеки для WinAVR для работы с 1-Wire ? Да на avrfreaks.org Перейти что ли на WinAVR? Блин, CodeVision удобен, больше похож на среду разработки, чем WinAVR. Озадачен примерно темже, только в плане что выбрать для работы на С++ с AVR, правда я выбираю в большей степени между IAR и avr-gcc. Как мне показалось IAR распространен больше, но WinAvr будет легче изучать (ибо ни gcc ни make для меня не новость, только с avrlibc разобраться) Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
virtuality 0 9 июля, 2006 Опубликовано 9 июля, 2006 · Жалоба Я конечно понимаю, что переползать с одного комплятора на другой муторно и требует усидчивости, но все же - бесят элементарные проблемы. Как было просто в CodeVision #include <delay.h> //// void main () { delay_us(500); } в WinAVR вроде тоже есть такая библиотека, и функция так же обзывается, но #include <avr/delay.h> //// void main () { delay_us(500); } Выдает ошибку undefined refefrence delay_us Ну что с этим делать. P.S. У кого-нить есть рабочий пример для датчика DS18B20 для WinAVR Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
shevek 0 9 июля, 2006 Опубликовано 9 июля, 2006 · Жалоба Ну что с этим делать. Загляните в delay.h, там все описано. Эта фунция обьявлена как: void _delay_us(double __us) Она кстати и в документации на avr-libc также упоминаются. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
beer_warrior 0 10 июля, 2006 Опубликовано 10 июля, 2006 · Жалоба КОнсоль выдает Total 17900, хотя это не соответствует истине - файл заливается в Mega16 без проблем. m32sound.elf : section size addr .text 972 0 .data 8 8388704 .bss 69 8388712 .noinit 0 8388781 .eeprom 0 8454144 .stab 3672 0 .stabstr 3628 0 Total 8349 Код это .text, .data .bss .noinit - данные, .eeprom надеюсь понятно. Блин, CodeVision удобен, больше похож на среду разработки, По умолчанию WinAVR включает Programmers Notepad (под которым кстати пишу и под ARM и под РС и HTML).Нет особых сложностей прицепить его под любой другой редактор кода, хоть под Visual Studio. Главное, чтобы редактор позволял подключать внешние программы и захватывал их выход. в WinAVR вроде тоже есть такая библиотека В документе avr-libc-user-manual очень подробно рассмотрены все функции, а также фокусы с секциями, встраиванием ассемблера etc. Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться
niccom 0 10 июля, 2006 Опубликовано 10 июля, 2006 · Жалоба Перейти что ли на WinAVR? Блин, CodeVision удобен, больше похож на среду разработки, чем WinAVR. Вот как например в WinAVR узнать размер получившейся программы? КОнсоль выдает Total 17900, хотя это не соответствует истине - файл заливается в Mega16 без проблем. Существуют ли библиотеки для WinAVR для работы с 1-Wire ? После компиляции в окне Programmer Notepad text data bss dec hex filename 9412 0 405 9817 2659 dvdavtomat.elf По моему все ясно Для задержек изучите нижеуказанный хидер /include/util/delay.h заодно посмотрите как ассемблер юзать в WinAVR А библиотек столько написано что вы приятно удивитесь скачав и распаковав http://hubbard.engr.scu.edu/embedded/avr/avrlib #ifndef _UTIL_DELAY_H_ #define _UTIL_DELAY_H_ 1 #include <inttypes.h> /** \defgroup util_delay <util/delay.h>: Busy-wait delay loops \code #define F_CPU 1000000UL // 1 MHz //#define F_CPU 14.7456E6 #include <util/delay.h> \endcode \note As an alternative method, it is possible to pass the F_CPU macro down to the compiler from the Makefile. Obviously, in that case, no \c \#define statement should be used. The functions in this header file implement simple delay loops that perform a busy-waiting. They are typically used to facilitate short delays in the program execution. They are implemented as count-down loops with a well-known CPU cycle count per loop iteration. As such, no other processing can occur simultaneously. It should be kept in mind that the functions described here do not disable interrupts. In general, for long delays, the use of hardware timers is much preferrable, as they free the CPU, and allow for concurrent processing of other events while the timer is running. However, in particular for very short delays, the overhead of setting up a hardware timer is too much compared to the overall delay time. Two inline functions are provided for the actual delay algorithms. Two wrapper functions allow the specification of microsecond, and millisecond delays directly, using the application-supplied macro F_CPU as the CPU clock frequency (in Hertz). These functions operate on double typed arguments, however when optimization is turned on, the entire floating-point calculation will be done at compile-time. \note When using _delay_us() and _delay_ms(), the expressions passed as arguments to these functions shall be compile-time constants, otherwise the floating-point calculations to setup the loops will be done at run-time, thereby drastically increasing both the resulting code size, as well as the time required to setup the loops. */ #if !defined(__DOXYGEN__) static inline void _delay_loop_1(uint8_t __count) __attribute__((always_inline)); static inline void _delay_loop_2(uint16_t __count) __attribute__((always_inline)); static inline void _delay_us(double __us) __attribute__((always_inline)); static inline void _delay_ms(double __ms) __attribute__((always_inline)); #endif /** \ingroup util_delay Delay loop using an 8-bit counter \c __count, so up to 256 iterations are possible. (The value 256 would have to be passed as 0.) The loop executes three CPU cycles per iteration, not including the overhead the compiler needs to setup the counter register. Thus, at a CPU speed of 1 MHz, delays of up to 768 microseconds can be achieved. */ void _delay_loop_1(uint8_t __count) { __asm__ volatile ( "1: dec %0" "\n\t" "brne 1b" : "=r" (__count) : "0" (__count) ); } /** \ingroup util_delay 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) ); } #ifndef F_CPU /* prevent compiler error by supplying a default */ # warning "F_CPU not defined for <util/delay.h>" # define F_CPU 1000000UL #endif /** \ingroup util_delay Perform a delay of \c __us microseconds, using _delay_loop_1(). The macro F_CPU is supposed to be defined to a constant defining the CPU clock frequency (in Hertz). The maximal possible delay is 768 us / F_CPU in MHz. */ void _delay_us(double __us) { uint8_t __ticks; double __tmp = ((F_CPU) / 3e6) * __us; if (__tmp < 1.0) __ticks = 1; else if (__tmp > 255) __ticks = 0; /* i.e. 256 */ else __ticks = (uint8_t)__tmp; _delay_loop_1(__ticks); } /** \ingroup util_delay Perform a delay of \c __ms milliseconds, using _delay_loop_2(). The macro F_CPU is supposed to be defined to a constant defining the CPU clock frequency (in Hertz). The maximal possible delay is 262.14 ms / F_CPU in MHz. */ void _delay_ms(double __ms) { uint16_t __ticks; double __tmp = ((F_CPU) / 4e3) * __ms; if (__tmp < 1.0) __ticks = 1; else if (__tmp > 65535) __ticks = 0; /* i.e. 65536 */ else __ticks = (uint16_t)__tmp; _delay_loop_2(__ticks); } #endif /* _UTIL_DELAY_H_ */ Цитата Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты Поделиться