Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ru:examples:setup:windows [2010/09/13 13:26] – created eduardtlmkru:examples:setup:windows [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Installation instructions for Windows ======+====== Среда разработки AVR Studio (Windows) ATMega128 ======
  
-this section contains the information necessary to install AVR development software on Windows operating system.+NB! Руководство по установки новой версии (ATmega2561) находится [[et:examples:setup:windows:v5|здесь]]
  
-===== Installation =====+В ниже приведенном руководстве описывается установка среды разработки AVR для операционной системы Windows, используя платформу разработки AVR Studio-t.
  
-You need the following software which can be downloaded from manufacturers homepage or acquired from the CD supplied with the HomeLab kit.+===== Установка программного обеспечения ===== 
 + 
 +Перед установкой программного обеспечения необходимо добыть  нижеследующее программное обеспечение, с сайта производителя или сайта Домашней Лаборатории или с диска находящегося в чемодане Домашней Лаборатории.
  
 **1. AVR Studio** **1. AVR Studio**
  
-AVR Studio 4 IDE (//Integrated Development Environment//is a base software for writing the source codecompiling it and uploading the program to the controller. AVR Studio can be downloaded from Atmel homepage.+AVR Studio 4 IDE (inglise keeles //Integrated Development Environment//– это программакоторая предназначена для написания программного кода и загрузки его в микроконтроллерПоследняя версия AVR Studio находится на веб-сайте производителя Atmel.
  
 **2. WinAVR** **2. WinAVR**
  
-WinAVR is a GNU-GCC compiler for AVR microcontrollersThis is a freeware which can be downloaded from Sourceforge webpageDuring the installation process WinAVR offers a folder name containing long version number. We suggest to cut the version number from folder name and install it just like shown below:+WinAVR является GNU-GCC компилятором для микроконтроллеров AVR. Это свободное программное обеспечение, которое можно найти на сайте Sourceforge. При инсталляции WinAVR предлагает имя каталога, которое также содержит номер версии, но директория должна быть изменена вручную:
  
   C:\WinAVR   C:\WinAVR
  
-**3. HomeLab library**+**3. Библиотека Домашней Лаборатории**
  
-HomeLab library is a set of functions designed for HomeLab kit and AVR controllersBy using the library the programming is much easier and effectiveLatest version of the library can be downloaded from the HomeLab webpage. This library should be installed in the same folder where WinAVR was installed.+Библиотека Домашней Лаборатории содержит функции, облегчающие использование AVR и устройств комплекта Домашней ЛабораторииПоследняя версия библиотеки находится на сайте Домашней ЛабораторииБиблиотека должна быть обязательно установлена в том же каталоге, где WinAVR.
  
-**4.. Virtual COM port driver**+**4. Драйвер виртуального COM порта**
  
-Driver enables to connect USB JTAG-ICE programmer with your PCDriver have to be installed before connecting the programmerDriver file name is "CDM x.xx.xx.exe"where "x" denotes the version numberAfter installing the driver you can connect the JTAG-ICE programmer through the USB port and let Windows to detect the device automatically. You should see the notice on the windows task bar.+Драйвер позволяет подключить к компьютеру программатор JTAG ICE. Драйвер должен быть установлен до подключения к компьютеру программатораИмя установочной программы 'CDM x.xx.xx.exe»где «х» обозначает версиюЗатем необходимо подключить программатор к компьютеру через USB интерфейс, и позволить Windows выполнит автоматическую установкуВ строке состояния должно появиться примерно такое сообщение:
  
-{{  :examples:install:windows:new_hardware_popup.png?349  |Notice of finding the new device}}+{{  :examples:install:windows:new_hardware_popup.png?349  |Uue pordi leidmise teade}}
  
-According to number of virtual ports previously defined on the particular computer the windows assigns next port number for the new deviceNew COM port name (range number) is generated if the device is plugged in to the same computer using another USB portSome AVR Studio versions can not use the programmer if the COM port number exceeds number 10 and number 4 in case of using it as debuggerTo prevent this situation you can modify the assigned port number in //Device manager// and assign it to the range COM0...COM4. [[en:examples:setup:portissue|See the complete procedure here ]].+В зависимости от того, сколько виртуальных последовательных портов на вашем компьютере уже установлено и введено в эксплуатацию, Windows автоматически установит следующий порядковый номер виртуального портаНовый порядковый номер генерируется и при смене порта USB. Некоторые версии AVR Studio признают программатор ICE JTAG, только в последовательных портах COM1 ... COM9 и функцию отладки позволяют использовать только последовательные порты COM1 ... COM4. Пользователь имеет возможность изменить порядковый номер порта, использую инструмент //Device Manager//.   
 +[[et:examples:setup:portissue|Посмотри процедуру на сайте]].
  
-===== Creating new project =====+===== Создание проекта =====
  
-In order to write a program for the controller you need to create the project space. The project includes typically different files like source codesheader filescompiled program files, etc. It is strongly advised to create new folder for every project (which is offered also by the New Project Wizard).+Для написания AVR программынеобходимо создать новый проекткоторый обычно включает в себя много различных файлов: программный код (ы), файлы заголовков и компилированные программы  т.д. Для того чтобы проекты корректно различались, необходимо для каждого проекта создавать новый каталог.
  
-Following steps have to be completed when creating new project with the help of wizard.+Для создания проекта необходимо пройти следующие этапы:
  
-**1.** Open AVR Studio and press //New Project//If the dialog box is not opened automatically select //Project - New project// from the menu barPress //Next//.+**1.** Открыть AVR Studio и нажать кнопку новый проект (//New Project//)Если окно не открывается автоматически, выберите из меню //Project - New project//Затем нажмите кнопку  //Next//.
  
 {{  :examples:install:windows:studio_welcome.png?400  |}} {{  :examples:install:windows:studio_welcome.png?400  |}}
  
-**2.** Next dialog box is about compiler and initial settingsSelect AVR GCC compilerOn the left, insert the name of the project and main source file name. The source file name should have extension ".c"Two check boxes should be also checkedwhich will create the new folder and initial fileYou should also show the folder where project files will be created. After proper selections press //Next//.+**2.** Откроется окно, в котором необходимо обозначить начальные настройки компилятора и файловВ качестве компилятора выберите AVR GCC и в правом окне введите имя проекта и имя исходного файлаИмя исходного файла должно обязательно иметь расширение “.cНеобходимо так же указать каталоггде будет создаваться соответствующий каталог проектаПосле выбора, нажмите кнопку //Next//.
  
-NB! If AVR GCC is missing on the compiler listit is not properly installed. In that case the WinAVR software have to be installed before starting to write C source code.+NB! Если при выборе компилятора отсутствует AVR GCC , то WinAVR установлен неправильно и это необходимо сделать до того, как писать программу на языке Си.
  
 {{  :examples:install:windows:studio_new_project.png?400  |}} {{  :examples:install:windows:studio_new_project.png?400  |}}
  
-**3.** On the next dialog box you have to select the debugger platform and microcontrollerHomeLab kit is using JTAG ICE as debugger platform and ATmega128 as microcontrollerAfter selections press //Finish//.+**3.** Далее открывается окно, в котором отмечается платформа, используемая для отладки типа микроконтроллераВ Домашней Лаборатории используется в качестве платформы для отладки //JTAG ICE// ICE программатор и микроконтроллер //ATmega128//Для создания проекта нажми кнопку //Finish//.
  
 {{  :examples:install:windows:studio_project_programmer.png?400 |}} {{  :examples:install:windows:studio_project_programmer.png?400 |}}
  
-**4.** Now the project space is created and new window will open where you can start to write the program source code.+**4.** Далее открывается уже пользовательский интерфейс программирования, куда можно начать писать новый исходный код программы.
  
 {{  :examples:install:windows:studio_overview.png?500  |}} {{  :examples:install:windows:studio_overview.png?500  |}}
  
-**5.** You need to set some project parameters before the first compilationThe important parameters are controller frequency and optimization methodHomeLab controller has frequency 14,7456 MHz (14745600 Hz). The frequency can be set in the project properties with Hz (not MHz)//Project -> Configuration Options -> General//Optimization method should left -Os, if there is no need for other methods.+<pagebreak> 
 + 
 +**5.** Перед компиляцией кода, необходимо определить настройки проектаНаиболее важными параметрами является тактовая частота контроллера и метод оптимизации компилятораТактовая частота контроллера Домашней лаборатории 14,7456 МГц (14745600 Гц). Частоту необходимо установить в свойствах проекта в Гц (не МГцв окне //Project -> Configuration Options -> General//Метод оптимизации должен остаться -Os, если нет необходимости использовать другие методы.
  
 {{  :examples:install:windows:studio_project_properties_general.png?400  |}} {{  :examples:install:windows:studio_project_properties_general.png?400  |}}
  
-**6.** For using HomeLab library functions the software have to be properly installedEvery new project requires adding library to list of linked objects. To do that go to //Project -> Configuration Options -> Libraries// and add object "libhomelab.a".+**6.** Для использования домашней лаборатории библиотека функций программного обеспечения должны быть установлены правильноПри каждом проекте необходимо из настроек //Project -> Configuration Options -> Libraries// добавить из списка нужную библиотеку проекта.
  
 {{  :examples:install:windows:studio_project_properties_libraries.png?400  |}} {{  :examples:install:windows:studio_project_properties_libraries.png?400  |}}
  
-If object //libhomelab.a// is missing from the left list the library is not properly installed to the system and it should be reinstalled.+Если объект //libhomelab.a// отсутствует в списке, то библиотека Домашней Лаборатории установлена неправильно
  
-===== Setting's test =====+<pagebreak>
  
-After set up of the development environment it is wise to test it, for ensuring its correctness. Simplest way is to write a short program, compile it and upload to controller. +===== Тестирование установки =====
  
-**1.** Connect the programmer with ATmega128 board. Be sure that the programmer is correctly connected to JTAG connector (cable is directed away from controller boardsee next picture). Connect the controller board supply (small green LED should light up if correct power supply is connected)+После установки среды разработки в первый раз желательно проверить, все ли было сделано правильноПростейший способ это написать короткую программу, скомпилировать ее и загрузить в контроллер.
  
-Insert simple C source code:+**1.** 1. Подключите программатор с платой ATmega128. При подключении проверьте, чтобы программатор был подключен в правильное гнездо (JTAG) (смотри следующее фото). После программатора подключите к плате контроллера питания (если источник питания подключен правильно, то должен загореться маленький зеленый светодиод).
  
 <code c> <code c>
Line 77: Line 82:
 int main(void) int main(void)
 { {
- // Pin PB7 to output+ // Настройка вывода PB7 выходом
  DDRB = 0x80;  DDRB = 0x80;
  
- // Endless cycle+ // Бесконечный цикл
  while (true)  while (true)
  {  {
- // Pin PB7 invertion+ // Инвертирование вывода PB7
  PORTB ^= 0x80;  PORTB ^= 0x80;
  hw_delay_ms(500);  hw_delay_ms(500);
Line 90: Line 95:
 </code> </code>
  
-[{{  :examples:install:windows:studio_quick_buttons.png?267  |Compilation and programmer buttons}}]+[{{  :examples:install:windows:studio_quick_buttons.png?267  |Кнопки компилирования и программатора}}]
  
-Compile the project with //Build// command (keyboard F7). Make sure that the compilation succeeded. For this you should see the following message on the message window.+Скомпилировать программу приказом //Build// (клавиша F7). Убедитесь в том, что компиляция удаласьДля этого должно появиться следующее сообщение:
  
-<code> 
   Build succeeded with 0 Warnings...   Build succeeded with 0 Warnings...
-</code> 
  
-**2.** Open the controller window //Tools -> Program AVR -> Auto Connect//Be sure that the tab  //Program// is open.+<pagebreak> 
 + 
 +**2.** Откройте окно загрузки кода  с помощью //Tools -> Program AVR -> Auto Connect//В результате должно открыться окно загрузки скомпилированного файла в микроконтроллер. Убедитесь, чтобы открытой была карта //Program//.
  
 {{  :examples:install:windows:studio_programmer.png?400  |}} {{  :examples:install:windows:studio_programmer.png?400  |}}
  
-If the described window does not open and //Connection Failed// window is opened instead you do not have proper connection with the board or programmerFirst check that micrcontroller is correctly powered (green LED is on) and the programmer is properly connected to JTAG connectorIf this is OK check the COM port number which is assigned by the Windows. If this is greater than 9, the AVR Studio can not recognize the programmer. Follow the instructions given in the beginning of the chapter and assign the port number between 0 and 4.+Если приведенное выше окно не открывается и появляется окно //Connection Failed//, то отсутствует связь с программаторомСначала необходимо убедиться, что на микроконтроллер приходит питание и подключен правильно программатор (к разъему  JTAG подключен кабелей в правильном направлении)Если с этим все в порядке, то необходимо проверить какой номер СОМ порта назначил Windows для программатораЕсли номер больше чем 9, то программное обеспечение может  не найти его и порту нужно назначить меньший порядковый номер.
  
 {{  :examples:install:windows:studio_project_programmer_port.png?400  |}} {{  :examples:install:windows:studio_project_programmer_port.png?400  |}}
  
-**3.** On the programmer window insert into //Flash//-section textbox //Input HEX File// the location of the compiled program by pressing the "..." buttonCompiled program is usually located in the project folders sub folder //default// and has same name as the project but with the extension ".hex"for example "labor1.hex"After selecting correct file press button //Program// which uploads the program to the controllerIf all went well you should see the following message on the end of the window:+**3.** В окне программатора введите в //Flash//-секцию текстовое поле //Input HEX File// скомпилированный файл. Вы можете сделать это нажатием кнопки "..."Скомпилированный файл обычно находится в подкаталоге проекта //default// и имеет такое же имя, как и проект, но с расширением “.hexк примеру,labor1.hexПосле выбора правильного файла, нажмите на кнопку //Program//, который загрузит выбранную программу в контроллерЕсли все удалось, то в нижней части окна среды программирования появится следующее сообщение:
  
   OK   OK
Line 118: Line 123:
   Leaving programming mode.. OK   Leaving programming mode.. OK
    
-According to the program the on-board LED (PB7) should start flashingIf the program works you have successfully set up your programming environment and completed your first programCongratulations!+Под влиянием программы на плате контроллера должен периодически загораться и гаснуть индикатор состояния PB7. Если программа работает, то программное обеспечение удачно установлено и первый проект сделанПоздравляем!
  
-{{:kit:kit_test.jpg?500|}}+{{:kit:kit_test.jpg?400|}}
  
-===== Debugger =====+===== Использование отладчик =====
  
-[{{  :examples:install:windows:studio_debugger_io_view.png?280|The list of registers in the debugger of the ATmega128.}}]+[{{  :examples:install:windows:studio_debugger_io_view.png?280|Список регистров ATmega128 в отладчике}}]
  
-Debugging a program means searching errors from the programFor that programs called debuggers are createdthey allow to execute the program step by step and stopping it where it is needed.  Such implementation of the program allows checking the values of the variables at any phase of the programcontents of the registers and the sequence of executing the programDebugging is especially important while dealing with more complex programs where it is often difficult to find errorsWith microcontrollersit is important that step-by-step implementation of program is done in the controller, which allows seeing change of real outputs in addition to the values of the registersTwo conditions must be met for using a debuggermicrocontroller must support debugging and you must have necessary hardware – JTAG programmer which allows debuggingCheaper programmers using ISP programming interface may upload compiled program into the controller but not necessarily allow debugging   +Отладкой программы (на английском языке //debugging//) называется поиск ошибок в программеДля этого созданы отдельные средства – отладчики (на английском языке //debugger//)которые позволяют выполнять программу от шага к шагуостанавливаясь в желательных для этого местахТакое выполнение программы позволяет в каждой фазе программы контролировать значение переменных, содержание регистров и порядок выполнения программыНаиболее важно использование отладки при сложных программахгде часто поиск ошибки затрудненДля использования отладчика нужны прежде всего два условияиспользуемый микроконтроллер должен поддерживать отладку и необходимо программное обеспечение поддерживаемое отладку – JTAG программаторБолее дешевые программаторы, которые используют интерфейс программирования ISP, позволяют загружать в контроллер скомпилированную программу, но не позволяют её отладку
-  + 
-To start the program in debugging mode with the AVR Studio, firstly it should be compiled by pressing button //build// (F7) and the compiled program started with the command //Run// (F5). Before that //break points// (F9) can be added to selected palces in  the source codeWhen implementation of the program reaches the break pointthe program is stopped for determining the state of the microcontroller in that pointImplementation of the program may be continued with command //Run// again or use //Step Into// (F11) for implementing the program one command at the time   +Для запуска программы с AVR Studio в режиме отладки необходимо сначала её скомпилировать кнопкой //Build// (клавиша F7) и запустить скомпилированную программу приказом //Run// (клавишей F5).  В программный код можно заранее добавить в желаемые места пункты прерывания (на английском языке //break point//(клавиша F9). Когда выполнение программы дойдет до пункта прерыванияостановиться работа программы, позволяя таким образом выяснить состояние микроконтроллера при достижении в этот пунктВыполнение программы можно заново возобновить приказом //Run// или приказом //Step Into// (клавиша F11).
  
 +===== Использование чисел с плавающей запятой =====
  
-===== The usage of floating-point variables =====+Иногда возникает необходимость в программе AVR использовать чисел с плавающей запятой. Для их вычисления и представления функцией //printf// типа необходимо в настройках проекта сделать следующие изменения: 
  
-Some times in AVR program it is necessary to use floating-point variables. For calculating with them and presenting with //printf//-type functions, the following set-up changes must be done to the configuration of the project: 
  
-**1.** Open the set-up of the project from the menu //Project -> Configuration Options//Add //libprintf_flt.a// and //libm.a// after //libhomelab.a// of the library of HomeLab in the configuration tab //Libraries//. +**1.** Откройте настройки проекта из меню //Project -> Configuration Options//На карте настроек //Libraries//, куда добавлен объект //libhomelab.a// библиотеки Домашней Лаборатории, добавить файлы //libprintf_flt.a// и //libm.a//.
  
-**2.** Next, open tab //Custom Options// and chose //[All files]//Next add lines with "-lprintf_flt" ja "-lm" to the box on the right and line with "-uvfprintf" to the //[Linker Options]// section.+**2.** Затем необходимо открыть карту //Custom Options// и выбрать секцию //[All files]//В правой ячейке добавить строки "-lprintf_flt" и "-lm". В секцию //[Linker Options]// добавить строчку "-uvfprintf".
  
-**3.** Press OK and close configuration window.+**3.** Нажмите ОК и закройте окно настройки.
ru/examples/setup/windows.1284384391.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0