This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:examples:setup:linux [2010/04/01 13:06] – mikk.leini | en: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 | + | or graphical installation software (such as Ubuntu software center or Synaptic |
| - | **2. Homelab | + | **2. HomeLab |
| - | The library simplifies the writing of program code, since lower-level functions are ready-made. Visit the Homelab | + | The library simplifies the writing of program code, since lower-level functions are ready-made. Visit the HomeLab |
| 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, | + | If you have problems with packet dependencies, |
| 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 | + | 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: | ||
| {{ : | {{ : | ||
| - | **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. |
| {{ : | {{ : | ||
| - | **3.** Next, the project must be configured for Homelab | + | **3.** Next, the project must be configured for HomeLab |
| - | NB! As the Homelab | + | NB! As the HomeLab |
| {{ : | {{ : | ||
| - | Apply settings on the // | + | Apply settings on the // |
| {{ : | {{ : | ||
| Line 83: | Line 83: | ||
| ===== Writing and testing a program ===== | ===== Writing and testing a program ===== | ||
| - | After the configurations steps are done, it is time programm. | + | After the configurations steps are done, it is time to programm. |
| **1.** Connect the programmer with Controller module. Double-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. | **1.** Connect the programmer with Controller module. Double-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. | ||
| Line 97: | Line 97: | ||
| int main(void) | int main(void) | ||
| { | { | ||
| - | // Viigu PB7 seadmine väljundiks | + | // Set pin PB7 as an output |
| DDRB = 0x80; | DDRB = 0x80; | ||
| Line 103: | 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 118: | Line 118: | ||
| If everything was done correctly the red LED on the Controller board should blink periodically, | If everything was done correctly the red LED on the Controller board should blink periodically, | ||
| - | ===== Using floating point numbers ===== | + | ===== Using floating-point numbers ===== |
| - | Sometimes it is neccessary to use floating point numbers in program. To calculate with them and use them with // | + | Sometimes it is neccessary to use floating-point numbers in program. To calculate with them and use them with // |
| **1.** Open the //Project Configurations// | **1.** Open the //Project Configurations// | ||