Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:examples:setup:linux [2010/03/31 08:41] mikk.leinien:examples:setup:linux [2020/07/20 09:00] (current) – created - external edit 127.0.0.1
Line 17: Line 17:
   sudo apt-get install gcc-avr avrdude avr-libc   sudo apt-get install gcc-avr avrdude avr-libc
  
-or graphical installation software (such as Ubuntu software center or Synaptic packetmanager).+or graphical installation software (such as Ubuntu software center or Synaptic packet manager).
  
-**2. Homelab library**+**2. HomeLab library**
  
-The library simplifies the writing of program code, since lower-level functions are ready-made. Visit the Homelab website and download the file named //Homeland library vX.X.run//, where XX represents the version number. Run the following command to install the library:+The library simplifies the writing of program code, since lower-level functions are ready-made. Visit the HomeLab website and download the file named //Homelab library vX.X.run//, where XX represents the version number. Run the following command to install the library:
  
   sudo sh homelab_library_vX.X.run   sudo sh homelab_library_vX.X.run
Line 33: Line 33:
   sudo dpkg -i kontrollerlab*.deb   sudo dpkg -i kontrollerlab*.deb
  
-If you have problems with packet dependencies, run the commandwhich installs the missing packages:+If you have problems with packet dependencies, run the command which installs the missing packages:
  
   apt-get install –f   apt-get install –f
Line 51: Line 51:
 ===== Creating a new project ===== ===== Creating a new project =====
  
-AVR programmi kirjutamiseks tuleb luua uus projektmis tüüpiliselt sisaldab endas mitmeid erinevaid faileprogrammikoodi(e)päisefailekompileeritud programmi jneSelleks, et projektid oleks korrektselt eristatavadtuleks iga projekti jaoks luua uus kataloog (seda võimalust pakub ka uue projekti loomise abimees).+To write an AVR programa project must be created which contains all the necessary filessource codesheader filescompiled program, etcTo clearly seperate projectsa folder for each project should be made (this option is also given by the project wizard).
  
-Uue projekti loomiseks järgi järgmisi samme:+To create a project follow the steps:
  
-**1.** Avada KontrollerLab (//Rakendused -> Programmeerimine -> KontrollerLab//ning valida ülevalt menüüst //File -> New -> New project//Avaneb aken, kus tuleb määrata projekti asukoht ning //Location//-väljale kirjutada projektifaili nimiToodud näites on loodud eraldi kataloog //../Homelab/blinkingLED///, kus hoitakse kõik näiteprogrammi (vilkuva LED) jaoks loodavad failid eraldi.+**1.** Open KontrollerLab (//Applications -> Programming -> KontrollerLab//and start a new project from the //File -> New -> New project// menu A window opens where the project location must be specifiedIn this example the locations is //../Homelab/blinkingLED///.
  
 {{  :kit:004_new_project_kontrollerlab.png?500  |}} {{  :kit:004_new_project_kontrollerlab.png?500  |}}
  
-**2.** Kuna projekt on esialgu tühi, siis tuleb sellele juurde lisada C-fail, kuhu koodi saaks kirjutadaValida menüü //File -> New -> New//Avaneb faili lisamise akenkus valida //C source// ja määrata faili nimi.+**2.** The project must have at least one file where to write the program codeFiles can be added from the //File -> New -> New// menuIn the opening windowselect //C source// as a file type and specify the name of the file.
  
 {{  :kit:005_new_file_kontrollerlab.png?500  |}} {{  :kit:005_new_file_kontrollerlab.png?500  |}}
  
-**3.** Seadistada KontrollerLabi projekt vastavalt kodulabori riistvaraleValida menüü //Project -> Configure Project//, mispeale kuvatakse projekti seadistamise aken avatuna //Common//-kaardilMäärata protsessoriks (CPUATmega128, taktsageduseks (clock14745600,0 Hz ning loodavate HEX ja MAP failide nimedVajutades nuppu //Set as default//, määrab see hetkeseadistused KontrollerLabis ka kõikide edaspidi loodavate projektide seadistusteksKuna sõltumata projektist jääb kodulabori riistvara  samaks, siis on mõttekas määratagi sisestatud parameetrid vaikimisi parameetriteksSamas jäävad ka KontrollerLabi poolt loodavate väljundfailide (HEX, MAP) nimed samaks. Siinkohal on kaks võimalust: igas projektis muuta HEX faili nime või panna mingi universaalsem nimi (nt out.hex), mis sobiks kõikidele projektidele. Hetkel on võetud teine variant, nii et projekti vahetamisel ei pea väljundfailide nimesid muutma.+**3.** Next, the project must be configured for HomeLab kitFrom the //Project -> Configure Project// menu open the configurations window and select //Common// tab. CPU type should be ATmega128 and the clock should be 14745600,0 Hz. Also the names of the HEX and MAP files should be specifiedPressing a //Set as default// button makes these configurations as a default for new projectsThis is reasonable when working only with HomeLab AVR microcontrollerAs the HEX and MAP files are also stored as a default it is recommended to use some general name for themfor example "out.hex".
  
-NB! Kuna KontrollerLab programmis ei saa korrektselt teeki lisada // Linker // kaardilsiis tuleb Kodulabori teegi lisamine seadistada siin, kirjutades map faili nime taha // -lhomelab //.+NB! As the HomeLab library can not be added on the //Linker// configuration tabthe command "-lhomelab" must be added behind the name of the MAP file.
  
 {{  :kit:006_project_conf_common.png?500  |}} {{  :kit:006_project_conf_common.png?500  |}}
  
-//Compiler// kaardil seadistada kompilaatori sätted, nagu näidatud juuresoleval pildilEnne //OK// vajutamist määrata ka siin sisestatud parameetrid vaikimisi säteteks.+Apply settings on the //Compiler// tab as shown on the following screenshotBefore pressing //OK// set compiler configurations also as a default.
  
 {{  :kit:007_project_conf_compiler.png?500  |}} {{  :kit:007_project_conf_compiler.png?500  |}}
  
-**4.** Seadistada programmaatori sätted, valides menüü //Project -> Configure Programmer////Choose Programmer//-kaardil valida AVRDUDE ning AVR DUDE kaardil määrata programmaatori tüübiks //jtagmkI// ja ühendusliideseks eelnevalt leitud port ///dev/ttyUSBx// (vt programmaatori peatükki). Määrata ka siin seadistatud parameetrid vaikimisi säteteks.+**4.** Configure the programmer by opening the configurations window from the //Project -> Configure Programmer// menu. Choose "AVRDUDE" as a programmer. On the "AVRDUDE" tab set the programmer type to //jtagmkI// and connection port to ///dev/ttyUSBx// (where "x" is the port index). Set these configuration settings also as a default.
  
 {{  :kit:008_programmer_conf.png?500  |}} {{  :kit:008_programmer_conf.png?500  |}}
  
-**5.** Seadistada tekstiredaktori sätted niiet tabulaatorit tõlgendataks 4 tühikuna. See on vajalik, kui juhtutakse lähtefaili avama mõne muu tekstiredaktoriga, mis tõlgendab tabulaatorit teisiti kui KontrollerLab. Sel juhul võib koodi liigendus muutuda, nii et inimese jaoks on kood raskesti jälgitav. Selleks, et seda ei juhtu, valida menüü //Settings -> Configure Editor// ja avanenud aknas vasakult Editing.  Märgi linnuke kasti "Insert spaces instead of tabulators" sisse. Samuti määra tabulaatori laiuseks 4 tühikut.  +**5.** At lastplace the windows in the KontrollerLab as it is more convenient and get ready to write your first program.
- +
-{{  :kit:009_editor_conf.png?500  |}} +
- +
-**6.** Seadista avanenud alamaknad KontrollerLabis oma käe järgi ning kirjuta mingi lihtne programm keskkonna testimiseks. Järgnevas alampeatükis on näitena toodud vilkuva LED programm.+
  
 {{  :kit:010_kontrollerlab.png?500  |}} {{  :kit:010_kontrollerlab.png?500  |}}
  
-===== Seadistuste testimine =====+===== Writing and testing a program =====
  
-Kui arenduskeskkond on esimest korda paigaldatud ja seadistatudon mõistlik testida, kas kõik sai tehtud õigesti. Selleks on lihtsaim viis teha üks väike programm, see ära kompileerida ja laadida kontrollerisse.+After the configurations steps are doneit is time to programm.
  
-**1.** Ühendada programmaator ATMega128 Kontrollerimooduli plaadigaKontrollida, et programmaator saab ühendatud õigesse pistikusse (JTAG) ja õigetpidi (kaabel on suunatud kontrolleri plaadist eemale - vaata järgmist pilti). Pärast programmaatori ühendamist ühendada kontrolleri toide (kontrolleri plaadil peab süttima väike roheline LED).+**1.** Connect the programmer with Controller moduleDouble-check if the programmer is correctly connected with a JTAG socket. The cable must head away from the board (look at the picture). Now connect the power supply and check if the green LED lights on the Controller board.
  
 {{  :kit:kit_test.jpg?500  |}} {{  :kit:kit_test.jpg?500  |}}
  
-**2.** Sisestada lihtne C-kood ja kompileerida see (//compile//). +**2.** Write the following program in the Kontrollerlab file editor window and compile it:
  
 <code c> <code c>
Line 101: Line 97:
 int main(void) int main(void)
 { {
- // Viigu PB7 seadmine väljundiks+ // Set pin PB7 as an output
  DDRB = 0x80;  DDRB = 0x80;
    
Line 107: Line 103:
  while (true)  while (true)
  {  {
- // Viigu PB7 inverteerimine+ // Inverting pin PB7
  PORTB ^= 0x80;  PORTB ^= 0x80;
  hw_delay_ms(500);  hw_delay_ms(500);
Line 114: Line 110:
 </code> </code>
  
-[{{  :kit:011_compile_ignite.png?408  |Tööriistariba}}]+[{{  :kit:011_compile_ignite.png?408  |Toolbar}}]
  
-Veendu, et väljundaknasse tuleb teade "File compiled successfully"Kui annab teate "Error(s) occurred: ", siis kontrollida, et koodi sisestamisel ei ole tehtud mõnd kirjaviga.+Make sure that the output window shows "File compiled successfully" messageIf the "Error(s) occurred: " message is showncheck the program code for mistakes.
  
-**3.** Koodi pealelaadimiseks valida //ignite// käskKui kõik õnnestubsiis väljundaknas viimase reana annab KontrollerLab teate "Project built and uploaded successfully". Kontrolli, et punane LED hakkaks perioodiliselt vilkuma (500 ms põleb, 500 ms on kustund).+**3.** To download the program into the Controller press the //Ignite// buttonAfter the succeful downloadthe "Project built and uploaded successfully" message should be shown.
  
-Kui LED vilgubnii nagu eespool kirjeldatud, on tarkvara paigaldatud edukalt ja esimene labor läbitudPalju õnne!+If everything was done correctly the red LED on the Controller board should blink periodicallywith 1 second interval.
  
-===== Ujukoma-arvude kasutamine =====+===== Using floating-point numbers =====
  
-Mõnikord tekib vajadus AVR programmis kasutada ujukoma-arveNendega arvutamiseks ja nende esitamiseks //printf//-tüüpi funktsioonidega tuleb projekti seadistustes teha järgmised muudatused:+Sometimes it is neccessary to use floating-point numbers in programTo calculate with them and use them with //printf//-typed functions, some modifications in project configuration must be done:
  
-**1.** Avada projekti seaded menüüst //Project -> Configure Project// ning valida //Linker// kaartMärgistada //Linker flags// sektsioonis esimene linnuke (vaata ka juuresolevat pilti).+**1.** Open the //Project Configurations// window and the //Linker// tabCheck the first line in the //Linker flags// list (look at the picture).
  
 {{  :kit:012_linker_fprintf.png?500  |}} {{  :kit:012_linker_fprintf.png?500  |}}
  
-**2.** Vajutada //OK// ja sulgeda seadete aken.+**2.** Press //OK// and close the window.
  
en/examples/setup/linux.1270024909.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