Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[3.14.83.223] |
|
Сообщ.
#1
,
|
|
|
С контроллерами работаю, всё писал на чистом ASMe, решил попробовать писать на Си, нашёл прогу IAR для AVR версия 2.31b. Ни чё не пойму чё к чему (с английским не в ладах).Пытался разобраться сам но - Может литература есть?
Посмотрел аналогичную тему для PIC, но то что интересует не нашёл. Конкретно интересует синтаксис САМОЙ проги IAR, как и с чего начинать писать какие переменные, каким образом организовывать прерывания, как размещать данные в той или оной области памяти, как работать с массивами чисел, двух-трёх байтными числами и если я знаю что мне проше будет какой либо кусок написатьь на асме как это организовать, короче уйма вопросов......... Для примера хорошо бы было посмотреть прогу передачи и приёма через УСАПП, с сравнением принятых данных с данными которые уже зашиты в проц. Помогите пажалуста И с таймером ещё чёнить |
Сообщ.
#2
,
|
|
|
Большая часть вопросов решится после прочтения какой-нибудь книжки по C. Общий принцип работы с внутренностями МК такой же, как и в теме Разбираемся с IAR Отличия в деталях - названия SFR'ов и т.д.
|
Сообщ.
#3
,
|
|
|
С Си то ж разобрался, чё к чему,с МК то ж знаком (пару лет програмирую, везде одна и таже гарвардская архитектура). Нужен какойнить ДАТАШИТ по этой проге, иль консультация хорошая (надеюсь получу ) что где и как, куда нажать после каких действий и всё такое........
А то что ты предлагаешь посмотреть,я уже смотрел и не раз...... А что такое SFR? |
Сообщ.
#4
,
|
|
|
Цитата *serg* @ SFR - special function register. Регистры управления "нутром" микроконтроллера(UART'ы, таймеры и т.д.)А что такое SFR? Ну если с основами знаком, то спрашивай, чего непонятно. Добавлено Цитата *serg* @ "По этой" - это какой? Help у IAR'а лежит в папке doc Нужен какойнить ДАТАШИТ по этой проге |
Сообщ.
#5
,
|
|
|
АААААА, ну насчёт регистров то я в крсах. Папки DOC у меня нет почемуто.
Интересует какие есть функции в IAR, какие в этих функциях команды и за что они отвечают? |
Сообщ.
#6
,
|
|
|
Что, папки avr\doc нет?
Специфичные встроенные функции таковы: Цитата Есть еще некоторое количество специфичных функций(в основном, связанные с работой с различными типами памяти). Остальные функции стандартны, найдешь их в соответствующий заголовочных файлах The following section gives reference information about each intrinsic function. --------------------------------------------------------------------------- __delay_cycles(unsigned long int); Makes the compiler generate code that takes the given amount of cycles to perform, that is it inserts a time delay that lasts the specified number of cycles. Note: The specified value must be a constant integer expression and not an expression that is evaluated at runtime. --------------------------------------------------------------------------- void __disable_interrupt(void); Disables interrupts by inserting the DI instruction. --------------------------------------------------------------------------- void __enable_interrupt(void); Enables interrupts by inserting the EI instruction. --------------------------------------------------------------------------- unsigned char __extended_load_program_memory(unsigned char __farflash *); Returns one byte from code memory. Use this intrinsic function to access constant data in code memory. --------------------------------------------------------------------------- signed int __fractional_multiply_signed(signed char, signed char); Generates a FMULS instruction. --------------------------------------------------------------------------- signed int __fractional_multiply_signed_with_unsigned(signed char, unsigned char); Generates a FMULSU instruction. --------------------------------------------------------------------------- unsigned int __fractional_multiply_unsigned(unsigned char, unsigned char); Generates a FMUL instruction. --------------------------------------------------------------------------- void __indirect_jump_to(unsigned long); Jumps to the address specified by the argument by using the IJMP or EIJMP instruction, depending on the generic processor option. -v0 to -v4 use IJMP, and -v5 and -v6 use EIJMP. --------------------------------------------------------------------------- void __insert_opcode(unsigned short); Inserts a DW unsigned directive. --------------------------------------------------------------------------- unsigned char __load_program_memory(unsigned char __flash *); Returns one byte from code memory. The constants must be placed within the first 64 Kbytes of memory. --------------------------------------------------------------------------- signed int __multiply_signed(signed char, signed char); Generates a MULS instruction. --------------------------------------------------------------------------- signed int __multiply_signed_with_unsigned(signed char, unsigned char); Generates a MULSU instruction. --------------------------------------------------------------------------- unsigned int __multiply_unsigned(unsigned char, unsigned char); Generates a MUL instruction. --------------------------------------------------------------------------- void __no_operation(void); Generates a NOP instruction. --------------------------------------------------------------------------- void __require(void *); Sets a constant literal as required. One of the prominent features of the IAR XLINK Linker is its ability to strip away anything that is not needed. This is a very good feature since it reduces the resulting code size to a minimum. However, in some situations you may want to be able to explicitly include a piece of code or a variable even though it is not directly used. The argument to __require could be a variable, a function name, or an exported assembler label. It must, however, be a constant literal. The label referred to will be treated as if it would be used at the location of the __require call. Example In the following example, the copyright message will be included in the generated binary file even though it is not directly used. #include <intrinsics.h> char copyright[] = "Copyright 2003 by XXXX"; void main(void) { __require(copyright); [... the rest of the program ...] } --------------------------------------------------------------------------- void __restore_interrupt(unsigned char oldState); This intrinsic function will restore the interrupt flag to the specified state. Note: The value of oldState must be the result of a call to the __save_interrupt --------------------------------------------------------------------------- unsigned int __reverse(unsigned int); This intrinsic function reverses the byte order of the value given as parameter. Avoid using __reverse in complex expressions as it might introduce extra register copying. signed int __reverse( signed int); unsigned long __reverse(unsigned long); signed long __reverse( signed long); void __far * __reverse(void __far *); /* Only on -v4 and -v6 */ void __huge * __reverse(void __huge *); /* Only on -v4 and -v6 */ void __farflash * __reverse(void __farflash *); /* Only on -v2 through -v6 with > 64k flash memory */ void __hugeflash * __reverse(void __hugeflash *); /* Only on -v2 through -v6 with > 64k flash memory */ --------------------------------------------------------------------------- unsigned char __save_interrupt(void); This intrinsic function will save the state of the interrupt flag in the byte returned. This value can then be used for restoring the state of the interrupt flag with the __restore_interrupt intrinsic function. unsigned char oldState; oldState = __save_interrupt(); __disable_interrupt(); /* Critical section goes here */ __restore_interrupt(oldState); --------------------------------------------------------------------------- __segment_begin(segment); Returns the address of the first byte of the named segment. The named segment must be a string literal that has been declared earlier with the #pragma segment directive. See #pragma segment, page 161. If the segment was declared with a memory attribute memattr, the type of the __segment_begin function is pointer to memattr void. Otherwise, the type is a default pointer to void. Example #pragma segment="MYSEG" __huge ... __segment_begin("MYSEG") Here the type of the __segment_begin intrinsic function is void __huge *. --------------------------------------------------------------------------- __segment_end(segment); Returns the address of the first byte after the named segment. The named segment must be a string literal that has been declared earlier with the #pragma segment directive. See #pragma segment, page 161. If the segment was declared with a memory attribute memattr, the type of the __segment_end function is pointer to memattr void. Otherwise, the type is a default pointer to void. Example #pragma segment="MYSEG" __huge ... __segment_end("MYSEG") Here the type of the __segment_end intrinsic function is void __huge *. --------------------------------------------------------------------------- void __sleep(void); Inserts a sleep instruction, SLEEP. To use this intrinsic function, make sure that the instruction has been enabled in the MCUCR register. --------------------------------------------------------------------------- unsigned char __swap_nibbles(unsigned char); Swaps bit 0-3 with bit 4-7 of the parameter and returns the swapped value. --------------------------------------------------------------------------- void __watchdog_reset(void); Inserts a watchdog reset instruction. |
Сообщ.
#7
,
|
|
|
Спасибо попробую разобраться
|