реклама на сайте
подробности

 
 
> Как проект в WinAVR переделать под CodeVision?
virtuality
сообщение Jul 4 2006, 15:34
Сообщение #1


Частый гость
**

Группа: Свой
Сообщений: 83
Регистрация: 17-05-06
Пользователь №: 17 190



В аттаче проект для WinAVR. Я же пишу в CodeVision.
Как переделать - даже не знаю с чего начать.

Если не трудно, гляньте одним глазком и подскажите хоть что нибудь.
Прикрепленные файлы
Прикрепленный файл  glcd.rar ( 45.07 килобайт ) Кол-во скачиваний: 99
 
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
virtuality
сообщение Jul 9 2006, 13:29
Сообщение #2


Частый гость
**

Группа: Свой
Сообщений: 83
Регистрация: 17-05-06
Пользователь №: 17 190



Перейти что ли на WinAVR? Блин, CodeVision удобен, больше похож на среду разработки, чем WinAVR. Вот как например в WinAVR узнать размер получившейся программы? КОнсоль выдает Total 17900, хотя это не соответствует истине - файл заливается в Mega16 без проблем.

Существуют ли библиотеки для WinAVR для работы с 1-Wire ?
Go to the top of the page
 
+Quote Post
niccom
сообщение Jul 10 2006, 07:19
Сообщение #3


Участник
*

Группа: Участник
Сообщений: 40
Регистрация: 9-06-05
Пользователь №: 5 868



Цитата(virtuality @ Jul 9 2006, 17:29) *
Перейти что ли на 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_ */
Go to the top of the page
 
+Quote Post

Сообщений в этой теме
- virtuality   Как проект в WinAVR переделать под CodeVision?   Jul 4 2006, 15:34
- - beer_warrior   Хм, там же все на асме....   Jul 4 2006, 18:56
- - virtuality   Ну основной то файл на C. Там интересно сделано - ...   Jul 4 2006, 19:24
- - beer_warrior   Просмотрел еще раз. Куча асмовских файлов и один с...   Jul 4 2006, 19:42
- - virtuality   А вот комплятор видит. Для начала я попытался вклю...   Jul 5 2006, 03:25
- - beer_warrior   Вот это уже дело. функции из avr_libc: strncasecm...   Jul 5 2006, 07:34
- - virtuality   ЦитатаPS Что-то я в архиве этого не нашел - в како...   Jul 6 2006, 09:03
- - beer_warrior   Никогда серьезно не работал с CV, так посмотрел ч...   Jul 6 2006, 11:16
- - vet   Инклудить asm бессмысленно, т.к. этим Вы заставляе...   Jul 6 2006, 11:29
- - virtuality   хм... вот я о том и говорил. В противовес утвержде...   Jul 6 2006, 12:26
- - beer_warrior   ЦитатаВ противовес утверждениям, что нет ничего сп...   Jul 6 2006, 12:58
- - virtuality   glcd.h у меня включен. Через него включаются пресл...   Jul 6 2006, 13:44
- - vet   Только потому, что uint16_t сам получен в результа...   Jul 6 2006, 13:57
- - virtuality   эээ... напрягаем ламерские мозги.... unsigned long...   Jul 6 2006, 14:11
- - Petka   ОФФТОП: как-то переделывал програмку из CV в WinAV...   Jul 6 2006, 17:37
- - virtuality   Код// macro to enter a stack with gcc Вот такая с...   Jul 6 2006, 18:16
- - virtuality   Начинаю ковырять. Выяснил - вот это приводило к п...   Jul 6 2006, 18:33
- - virtuality   Кодtypedef union { uint8_t All; struct { uint8_...   Jul 6 2006, 19:11
|- - vet   Цитата(virtuality @ Jul 6 2006, 23:11) Ко...   Jul 6 2006, 20:48
- - virtuality   Цитатавключать надо заголовочник glcd.h - это объя...   Jul 6 2006, 19:26
|- - tiasur   Цитата(virtuality @ Jul 6 2006, 22:26) А ...   Jul 7 2006, 01:27
- - beer_warrior   Цитата// macro to enter a stack with gcc Набор вся...   Jul 6 2006, 20:05
- - virtuality   Кто такой клетчатый? Киньте пожалуйста ссылочку на...   Jul 6 2006, 20:18
|- - IgorKossak   Цитата(virtuality @ Jul 6 2006, 23:18) Кт...   Jul 7 2006, 07:50
- - beer_warrior   Наш общий друг [banned]123.   Jul 6 2006, 20:31
- - virtuality   Итак, поехали ковырять. Вот что у меня получилось...   Jul 7 2006, 16:30
- - virtuality   Так разобрался я как включать асмы в проект, но пр...   Jul 7 2006, 17:29
- - beer_warrior   ЦитатаВ строке 1257 : syntax error unexpect ...   Jul 7 2006, 18:16
- - virtuality   оххх... Наивный вопрос, но нельзя ли как-нить в W...   Jul 7 2006, 18:28
- - vet   Нет. CV работает только с исходниками.   Jul 7 2006, 21:55
- - shevek   Существуют ли библиотеки для WinAVR для работы с 1...   Jul 9 2006, 14:10
- - virtuality   Я конечно понимаю, что переползать с одного компля...   Jul 9 2006, 16:14
- - shevek   Ну что с этим делать. Загляните в delay.h, там вс...   Jul 9 2006, 17:25
- - beer_warrior   ЦитатаКОнсоль выдает Total 17900, хотя это не соот...   Jul 10 2006, 02:13


Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 24th July 2025 - 03:58
Рейтинг@Mail.ru


Страница сгенерированна за 0.01342 секунд с 7
ELECTRONIX ©2004-2016