Differences

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

Link to this comparison view

Next revision
Previous revision
en:examples:setup:windows [2010/02/03 16:13] – external edit 127.0.0.1en:examples:setup:windows [2020/07/20 09:00] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
-====== Tarkvara Windowsi keskkonnas ======+====== Installation instructions for Windows ======
  
-Järgnev juhend kirjeldab AVR arenduskeskkonna installeerimist ja kasutamist Windowsi operatsioonisüsteemis.+this section contains the information necessary to install AVR development software on Windows operating system.
  
-===== Tarkvara paigaldamine =====+===== Installation =====
  
-Enne paigaldamist tuleks hankida alljärgnev tarkvara kas tootja kodulehelt või Kodulaboriga kaasas olevalt plaadilt.+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 on IDE (lühend inglise keeles //Integrated Development Environment//), milles toimub tarkvara kirjutamine ja mikrokontrollerisse laadimine. AVR Studio leiab selle tootja  Atmeli kodulehelt.+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.
  
 **2. WinAVR** **2. WinAVR**
  
-WinAVR on GNU-GCC kompilaator AVR mikrokontrolleriteleSee on vabavara, mille leiab Sourceforge veebilehelt. WinAVR pakub installeerimisel välja kataloogi nime, mis sisaldab ka versiooni numbrit, kuid kataloog tuleks manuaalselt seada hoopis:+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:
  
   C:\WinAVR   C:\WinAVR
  
-**3. Kodulabori teek**+**3. HomeLab library**
  
-Kodulabori teek sisaldab programmi lihtsustavaid funktsioone AVR ja kodulabori komplekti osade kasutamiseksTeegi viimase versiooni leiab kodulabori veebileheltTeek tuleb kindlasti installeerida samasse kataloogi, kus on WinAVR.+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.
  
-**4.. Virtuaalne COM pordi ajur**+**4.. Virtual COM port driver**
  
-Ajur võimaldab arvutiga ühendada JTAG ICE programmaatoriAjur tuleb installeerida enne programmaatori arvutiga ühendamistInstalleri nimi on "CDM x.xx.xx.exe", kus "x" tähistab versiooniSeejärel tuleb ühendada programmaator arvutiga USB liidese kaudu ja lasta Windows-il teostada automaatne paigaldusOlekuribal peaks nägema umbes sellist teadet.+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 automaticallyYou should see the notice on the windows task bar.
  
-{{  :examples:install:windows:new_hardware_popup.png?349  |Uue pordi leidmise teade}}+{{  :examples:install:windows:new_hardware_popup.png?349  |Notice of finding the new device}}
  
-Sõltuvalt sellest, kui palju virtuaalseid jadaporte on arvutisse eelnevalt paigaldatud ja kasutusele võetud, paigaldab Windows automaatselt järgmise järjekorranumbriga virtuaalpordiUus järjekorranumber genereeritakse ka USB pordi vahetamisel. AVR Studio mõned versioonid tunnevad JTAG ICE programmaatori ära ainult jadaportides COM1...COM9 ja silumise funktsiooni lubavad kasutada ainult jadaportides COM1...COM4. Kasutajal on võimalus pordi järjekorranumbrit muuta, kasutades //Device manager// töövahendit. [[et:examples:setup:portissue|Vaata veebilehelt protseduuri]].+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 ]].
  
-===== Projekti loomine =====+===== Creating new project =====
  
-AVR programmi kirjutamiseks tuleb luua uus projektmis tüüpiliselt sisaldab endas palju erinevaid faile: programmikoodi(e)päisefailekompileeritud programmi jneSelleks et projektid oleks korrektselt eristatavad, tuleks iga projekti jaoks luua uus kataloog (seda võimalust pakub uue projekti loomise abimees).+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 filesetcIt is strongly advised to create new folder for every project (which is offered also by the New Project Wizard).
  
-Uue projekti loomiseks tuleb läbida järgmised sammud:+Following steps have to be completed when creating new project with the help of wizard.
  
-**1.** Avada AVR Studio ja vajutada nupule uus projekt (//New Project//)Juhul kui vastav aken automaatselt ei avane, valida menüüst //Project - New project//Pärast sobivat sisestust vajutada nupule //Next//.+**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//.
  
-{{  :examples:install:windows:studio_welcome.png?500  |}}+{{  :examples:install:windows:studio_welcome.png?400  |}}
  
-**2.** Avaneb aken, kus tuleb märkida kompilaatori ja failide algseadedKompilaatoriks valida AVR GCC ja paremas akna osas sisestada projekti nimi ning algkoodi faili nimiAlgkoodi faili nimi peaks kindlasti lõppema laiendiga ".c"Aknas on võimalik veel märkida valikud automaatseks projekti nimega kataloogi ja algkoodi faili tekitamiseks. Mõlemad valikud on mõistlik ära märkida. Samuti tuleks näidata kataloogkuhu vastav projektikataloog tekitataksePärast valikute tegemist vajutada nupule //Next//.+**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 file. You should also show the folder where project files will be createdAfter proper selections press //Next//.
  
-NB! Kui kompilaatori valikus puudub AVR GCC, siis ei ole WinAVR korrektselt paigaldatud ja seda tuleks enne C-keele programmi kirjutamist kindlasti teha.+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 source code.
  
-{{  :examples:install:windows:studio_new_project.png?500  |}}+{{  :examples:install:windows:studio_new_project.png?400  |}}
  
-**3.** Järgnevalt avaneb aken, kus tuleb märkida kasutatav silumise platvorm ja mikrokontrolleri tüüpKodulaboris on silumise platvormina kasutusel //JTAG ICE// programmaator ja mikrokontrolleriks on //ATmega128//Projekti lõplikuks loomiseks vajutada nupule //Finish//.+**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//.
  
-{{  :examples:install:windows:studio_project_programmer.png?500 |}}+{{  :examples:install:windows:studio_project_programmer.png?400 |}}
  
-**4.** Nüüd avaneb juba programmeerimise kasutajaliides, kuhu saab hakata kirjutama uut programmi lähtekoodi.+**4.** Now the project space is created and new window will open where you can start to write the program source code.
  
 {{  :examples:install:windows:studio_overview.png?500  |}} {{  :examples:install:windows:studio_overview.png?500  |}}
  
-**5.** Enne koodi kompileerimist tuleb määrata projekti seadedOlulisemad seaded on kontrolleri taktsagedus ja kompilaatori optimeerimismeetodKodulabori kontrolleri taktsagedus on 14,7456 MHz ehk 14745600 Hz. See sagedus tuleb hertsides määrata //Project -> Configuration Options -> General// aknasOptimeerimise meetodiks jätta -Os, kui ei ole vajadust just teiste järgi.+**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.
  
-{{  :examples:install:windows:studio_project_properties_general.png?500  |}}+{{  :examples:install:windows:studio_project_properties_general.png?400  |}}
  
-**6.** Kodulabori teegi kasutamine AVR Studio-ga eeldab, et see on tarkvara paigaldamise juhendi kohaselt süsteemi paigaldatudIga projekti korral tuleb teek projekti seadetest //Project -> Configuration Options -> Libraries// lisada lingitavate objektide nimekirja.+**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".
  
-{{  :examples:install:windows:studio_project_properties_libraries.png?500  |}}+{{  :examples:install:windows:studio_project_properties_libraries.png?400  |}}
  
-Kui objekt //libhomelab.a// nimekirjast puudub, siis ei ole kodulabori teek korrektselt süsteemi paigaldatud+If object //libhomelab.a// is missing from the left list the library is not properly installed to the system and it should be reinstalled.
  
-===== Seadistuste testimine =====+===== Setting's test =====
  
-Kui arenduskeskkond on esimest korda paigaldatud ja seadistatudon mõistlik testida, kas kõik sai tehtud õigestiSelleks on lihtsaim viis teha üks väike programmsee ära kompileerida ja laadida kontrollerisse+After set up of the development environment it is wise to test itfor ensuring its correctnessSimplest way is to write a short programcompile it and upload to controller
  
-**1.** Ühendada programmaator ATMega128 plaadigaÜhendamisel kontrollida, et programmaator saab ühendatud õigesse pesasse (JTAG) ja õigetpidi (kaabel on suunatud kontrolleri plaadist eemale vaata järgmist pilti). Peale programmaatori ühendada ka kontrolleri toide (kontrolleri plaadil peab süttima väike roheline LED). Sisestada lihtne C-kood:+**1.** Connect the programmer with ATmega128 boardBe 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 source code:
  
 <code c> <code c>
Line 75: Line 77:
 int main(void) int main(void)
 { {
- // Viigu PB7 seadmine väljundiks+ // Pin PB7 to output
  DDRB = 0x80;  DDRB = 0x80;
  
- // Lõputu tsükkel+ // Endless cycle
  while (true)  while (true)
  {  {
- // Viigu PB7 inverteerimine+ // Pin PB7 invertion
  PORTB ^= 0x80;  PORTB ^= 0x80;
  hw_delay_ms(500);  hw_delay_ms(500);
Line 88: Line 90:
 </code> </code>
  
-[{{  :examples:install:windows:studio_quick_buttons.png?267  |Kompileerimise ja programmaatori nupud}}]+[{{  :examples:install:windows:studio_quick_buttons.png?267  |Compilation and programmer buttons}}]
  
-Kompileerida programm käsuga //Build// (kiirklahv F7) ja kontrollida, et kompileerimine õnnestuksSelleks peab teadete aknasse tekkinud kompilaatori väljundi lõpp olema järgmine: +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.
  
 +<code>
   Build succeeded with 0 Warnings...   Build succeeded with 0 Warnings...
 +</code>
  
-**2.** Avada koodi laadimise aken nupust //Tools -> Program AVR -> Auto Connect//Tulemuseks peaks avanema kompileeritud faili mikrokontrollerisse laadimise aken. Kontrollige, et avatud oleks kaart //Program//.+**2.** Open the controller window //Tools -> Program AVR -> Auto Connect//Be sure that the tab  //Program// is open.
  
-{{  :examples:install:windows:studio_programmer.png?500  |}}+{{  :examples:install:windows:studio_programmer.png?400  |}}
  
-Kui eespool toodud aken ei avane ja avaneb aken //Connection Failed//, siis puudub ühendus programmaatorigaEsmalt tuleks kontrollida, kas mikrokontrolleril on järel toide ja kas programmaator on ühendatud õigesti (JTAG pistikusse, kaabel õiges suunas)Kui see on korras, siis tuleks kontrollida, mis COM pordi numbri on Windows programmaatorile omistanudKui see on suurem 9-stsiis ei pruugi tarkvara seda leida ja pordile tuleb omistada väiksem järjenumber.+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.
  
-{{  :examples:install:windows:studio_project_programmer_port.png?500  |}}+{{  :examples:install:windows:studio_project_programmer_port.png?400  |}}
  
-**3.** Programmaatori aknas sisestada //Flash//-sektsioonis tekstikasti //Input HEX File// kompileeritud fail. Seda saab teha "..." nuppu vajutadesKompileeritud fail asub tavaliselt projekti alamkataloogis //default// ja see on sama nimega, mis projekt, kuid laiendiga ".hex", näiteks "labor1.hex"Pärast õige faili valimist vajutada nupule //Program//, mis laeb valitud programmi kontrollerisseKui kõik õnnestus, tekib programeerimiskeskkonna allosasse teade:+**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:
  
   OK   OK
Line 114: Line 118:
   Leaving programming mode.. OK   Leaving programming mode.. OK
    
-Prorammi mõjul peaks kontrolleri plaadil olev LED PB7 perioodiliselt süttima ja kustumaKui programm töötab, on tarkvara paigaldatud edukalt ja esimene projekt tehtudPalju õnne!+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!
  
 {{:kit:kit_test.jpg?500|}} {{:kit:kit_test.jpg?500|}}
  
-===== Siluri kasutamine =====+===== Debugger =====
  
-[{{  :examples:install:windows:studio_debugger_io_view.png?280|ATmega128 registrite loetelu siluris}}]+[{{  :examples:install:windows:studio_debugger_io_view.png?280|The list of registers in the debugger of the ATmega128.}}]
  
-Programmi silumiseks (inglise keeles //debugging//) nimetatakse vigade otsimist programmistSelleks on loodud eraldi vahendid - silurid (inglise keeles //debugger//)mis võimaldavad programmi täita samm-sammult, peatades seda soovitud kohtadesSelline programmi täitmine võimaldab igas programmi faasis kontrollida muutujate väärtusiregistrite sisusid ja programmi täitmise järjekordaEriti oluline on silumise võimaluse kasutamine keerukamate programmide juures, kus vea põhjust on tihti keeruline otsidaMikrokontrollerite puhul on veel olulineet tarkvara samm-sammult täitmine toimub reaalselt kontrolleris ja võimaldab nii lisaks registrite väärtuste vaatamisele näha ka reaalsete väljundite muutumistSiluri kasutamiseks on eelkõige vaja kahte tingimustkasutatav mikrokontroller peab silumist toetama ja olemas peab olema ka vajalik riistvara - silumist toetav JTAG programmaatorOdavamad programmaatorid, mis kasutavad ISP programmeerimise liidestvõimaldavad laadida kontrollerisse küll kompileeritud programmikuid ei võimalda silumist.+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.    
 +  
 +To start the program in debugging mode with the AVR Studiofirstly 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 code. When implementation of the program reaches the break pointthe program is stopped for determining the state of the microcontroller in that point. Implementation of the program may be continued with command //Run// again or use //Step Into// (F11) for implementing the program one command at the time   
  
-Programmi käivitamiseks siluri režiimis AVR Studio-ga tuleks see esmalt kompileerida nupuga //Build// (kiirklahv F7) ja käivitada kompileeritud programm käsuga //Run// (kiirklahv F5). Programmi lähtekoodi võib enne seda soovitud kohtadele lisada katkestuspunkte (inglise keeles //break point//) (kiirklahv F9). Kui programmi täitmine jõuab katkestuspunktini, peatatakse programmi töö, võimaldades nii uurida mikrokontrolleri olekut sellesse punkti jõudmisel. Programmi täitmist võib jätkata jällegi käsuga //Run// või siis kasutada käskhaaval täitmist käsuga //Step Into// (kiirklahv F11). 
  
-===== Ujukoma-arvude kasutamine =====+===== The usage of floating-point variables =====
  
-Mõnikord tekib vajadus AVR programmis kasutada ujukoma-arveNendega arvutamiseks ja nende esitamiseks //printf//-tüüpi funktsioonidega tuleb projekti seadistustes teha järgmised muudatused:+Some times in AVR program it is necessary to use floating-point variablesFor calculating with them and presenting with //printf//-type functions, the following set-up changes must be done to the configuration of the project:
  
-**1.** Avada projekti seaded menüüst //Project -> Configuration Options//Seadete kaardil //Libraries// tuleb sinna, kuhu on lisatud kodulabori teegi objekt //libhomelab.a//, järgi lisada ka //libprintf_flt.a// ja //libm.a//.+**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//. 
  
-**2.** Seejärel tuleb avada //Custom Options// kaart ja valida //[All files]// sektsioonParempoolsesse kasti lisada read "-lprintf_flt" ja "-lm"//[Linker Options]// sektsiooni lisada rida "-uvfprintf".+**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.
  
-**3.** Vajutada OK ja sulgeda seadete aken.+**3.** Press OK and close configuration window.
en/examples/setup/windows.1265213596.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