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/04/01 12:46] 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 =====
  
-To write an AVR program, a project must be created which contains all the necessary files: source codes, header files, compiled program, etc. To clearly seperate projects, a folder for each project should be made (this option is given by the project wizard also).+To write an AVR program, a project must be created which contains all the necessary files: source codes, header files, compiled program, etc. To clearly seperate projects, a folder for each project should be made (this option is also given by the project wizard).
  
 To create a project follow the steps: To create a project follow the steps:
Line 59: Line 59:
 {{  :kit:004_new_project_kontrollerlab.png?500  |}} {{  :kit:004_new_project_kontrollerlab.png?500  |}}
  
-**2.** The project must at least one C file where to write the program code. Files can be added from the //File -> New -> New// menu. In the opening window, select //C source// as a file type and specify the name of the file.+**2.** The project must have at least one C file where to write the program code. Files can be added from the //File -> New -> New// menu. In the opening window, select //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.** Next, the project must be configured for Homelab kit. From 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 specified. Pressing a //Set as default// button makes these configurations as a default for new projects. This is reasonable when working only with Homelab AVR microcontroller. As the HEX and MAP files are also stored as a default it is recommended to use some general name for them, for example "out.hex".+**3.** Next, the project must be configured for HomeLab kit. From 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 specified. Pressing a //Set as default// button makes these configurations as a default for new projects. This is reasonable when working only with HomeLab AVR microcontroller. As the HEX and MAP files are also stored as a default it is recommended to use some general name for them, for example "out.hex".
  
-NB! As the Homelab library can not be added on the //Linker// configuration tab, the command "-lhomelab" must be added behind the name of the MAP file.+NB! As the HomeLab library can not be added on the //Linker// configuration tab, the 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  |}}
  
-Apply settings on the //Compiler// tab as showed on the following screenshot. Before pressing //OK// set compiler configurations also as a default.+Apply settings on the //Compiler// tab as shown on the following screenshot. Before 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.1270125990.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