На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
  
    > Помогите разобраться с IAR для AVR
      С контроллерами работаю, всё писал на чистом ASMe, решил попробовать писать на Си, нашёл прогу IAR для AVR версия 2.31b. Ни чё не пойму чё к чему (с английским не в ладах).Пытался разобраться сам но - :wall: Может литература есть?
      Посмотрел аналогичную тему для PIC, но то что интересует не нашёл.
      Конкретно интересует синтаксис САМОЙ проги IAR, как и с чего начинать писать какие переменные, каким образом организовывать прерывания, как размещать данные в той или оной области памяти, как работать с массивами чисел, двух-трёх байтными числами и если я знаю что мне проше будет какой либо кусок написатьь на асме как это организовать, короче уйма вопросов.........
      Для примера хорошо бы было посмотреть прогу передачи и приёма через УСАПП, с сравнением принятых данных с данными которые уже зашиты в проц.
      Помогите пажалуста
      И с таймером ещё чёнить
        Большая часть вопросов решится после прочтения какой-нибудь книжки по C. Общий принцип работы с внутренностями МК такой же, как и в теме Разбираемся с IAR Отличия в деталях - названия SFR'ов и т.д.
          С Си то ж разобрался, чё к чему,с МК то ж знаком (пару лет програмирую, везде одна и таже гарвардская архитектура). Нужен какойнить ДАТАШИТ по этой проге, иль консультация хорошая (надеюсь получу :) ) что где и как, куда нажать после каких действий и всё такое........
          А то что ты предлагаешь посмотреть,я уже смотрел и не раз......
          А что такое SFR?
            Цитата *serg* @
            А что такое SFR?
            SFR - special function register. Регистры управления "нутром" микроконтроллера(UART'ы, таймеры и т.д.)
            Ну если с основами знаком, то спрашивай, чего непонятно.

            Добавлено
            Цитата *serg* @
            Нужен какойнить ДАТАШИТ по этой проге
            "По этой" - это какой? Help у IAR'а лежит в папке doc
              АААААА, ну насчёт регистров то я в крсах. Папки DOC у меня нет почемуто.
              Интересует какие есть функции в IAR, какие в этих функциях команды и за что они отвечают?
              Сообщение отредактировано: *serg* -
                Что, папки avr\doc нет? :blink:
                Специфичные встроенные функции таковы:
                Цитата

                The following section gives reference information about each intrinsic function.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  __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.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  void __disable_interrupt(void);

                Disables interrupts by inserting the DI instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  void __enable_interrupt(void);

                Enables interrupts by inserting the EI instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  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.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  signed int __fractional_multiply_signed(signed char, signed char);

                Generates a FMULS instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  signed int __fractional_multiply_signed_with_unsigned(signed char, unsigned char);

                Generates a FMULSU instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  unsigned int __fractional_multiply_unsigned(unsigned char, unsigned char);

                Generates a FMUL instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  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.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  void __insert_opcode(unsigned short);

                Inserts a DW unsigned directive.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  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.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  signed int __multiply_signed(signed char, signed char);

                Generates a MULS instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  signed int __multiply_signed_with_unsigned(signed char, unsigned char);

                Generates a MULSU instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  unsigned int __multiply_unsigned(unsigned char, unsigned char);

                Generates a MUL instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  void __no_operation(void);

                Generates a NOP instruction.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  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.
                ExpandedWrap disabled
                  #include <intrinsics.h>
                  char copyright[] = "Copyright 2003 by XXXX";
                  void main(void)
                  {
                  __require(copyright);
                  [... the rest of the program ...]
                  }

                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  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
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  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.
                ExpandedWrap disabled
                  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 */

                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  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.
                ExpandedWrap disabled
                  unsigned char oldState;
                  oldState = __save_interrupt();
                  __disable_interrupt();
                  /* Critical section goes here */
                  __restore_interrupt(oldState);

                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  __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
                ExpandedWrap disabled
                  #pragma segment="MYSEG" __huge
                  ...
                  __segment_begin("MYSEG")

                Here the type of the __segment_begin intrinsic function is void __huge *.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  __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
                ExpandedWrap disabled
                  #pragma segment="MYSEG" __huge
                  ...
                  __segment_end("MYSEG")

                Here the type of the __segment_end intrinsic function is void __huge *.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  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.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  unsigned char __swap_nibbles(unsigned char);

                Swaps bit 0-3 with bit 4-7 of the parameter and returns the swapped value.
                ---------------------------------------------------------------------------
                ExpandedWrap disabled
                  void __watchdog_reset(void);

                Inserts a watchdog reset instruction.
                Есть еще некоторое количество специфичных функций(в основном, связанные с работой с различными типами памяти). Остальные функции стандартны, найдешь их в соответствующий заголовочных файлах
                  Спасибо попробую разобраться
                  0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
                  0 пользователей:


                  Рейтинг@Mail.ru
                  [ Script execution time: 0,0455 ]   [ 15 queries used ]   [ Generated: 27.04.24, 15:10 GMT ]