en:examples:setup:windows
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:examples:setup:windows [2010/02/04 17:23] – raivo.sell | en:examples:setup:windows [2020/07/20 12:00] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| ===== Installation ===== | ===== Installation ===== | ||
| - | You need the following software which can be downloaded from manufacturers homepage or acquired from the CD supplied with the HomeLab | + | You need the following software which can be downloaded from manufacturers homepage or acquired from the CD supplied with the HomeLab |
| **1. AVR Studio** | **1. AVR Studio** | ||
| Line 19: | Line 19: | ||
| **3. HomeLab library** | **3. HomeLab library** | ||
| - | HomeLab library is a set of functions designed for HomeLab | + | HomeLab library is a set of functions designed for HomeLab |
| **4.. Virtual COM port driver** | **4.. Virtual COM port driver** | ||
| Line 27: | Line 27: | ||
| {{ : | {{ : | ||
| - | According to number of virtual ports defined | + | According to number of virtual ports previously |
| ===== Creating new project ===== | ===== Creating new project ===== | ||
| - | Writing | + | In order to write a program for the controller you need to create the project space. The project includes typically different files like source codes, header files, compiled program files, etc. It is strongly |
| Following steps have to be completed when creating new project with the help of wizard. | Following steps have to be completed when creating new project with the help of wizard. | ||
| Line 37: | Line 37: | ||
| **1.** Open AVR Studio and press //New Project//. If the dialog box is not opened automatically select //Project - New project// from the menu bar. Press //Next//. | **1.** Open AVR Studio and press //New Project//. If the dialog box is not opened automatically select //Project - New project// from the menu bar. Press //Next//. | ||
| - | {{ : | + | {{ : |
| - | **2.** Next dialog box is about compiler and initial settings. Select AVR GCC compiler. On the left, insert the name of the project and main source file name. The source file name should have extension " | + | **2.** Next dialog box is about compiler and initial settings. Select AVR GCC compiler. On the left, insert the name of the project and main source file name. The source file name should have extension " |
| NB! If AVR GCC is missing on the compiler list, it is not properly installed. In that case the WinAVR software have to be installed before starting to write C source code. | NB! If AVR GCC is missing on the compiler list, it is not properly installed. In that case the WinAVR software have to be installed before starting to write C source code. | ||
| - | {{ : | + | {{ : |
| - | **3.** On the next dialog box you have to select the debugger platform and microcontroller. HomeLab | + | **3.** On the next dialog box you have to select the debugger platform and microcontroller. HomeLab |
| - | {{ : | + | {{ : |
| **4.** Now the project space is created and new window will open where you can start to write the program source code. | **4.** Now the project space is created and new window will open where you can start to write the program source code. | ||
| Line 53: | Line 53: | ||
| {{ : | {{ : | ||
| - | **5.** | + | **5.** |
| - | {{ : | + | {{ : |
| - | **6.** For using HomeLab library functions the software have be properly | + | **6.** For using HomeLab library functions the software have to be properly |
| - | {{ : | + | {{ : |
| - | If object // | + | If object // |
| ===== Setting' | ===== Setting' | ||
| - | If the development environment | + | 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 connected | + | **1.** Connect the programmer with ATmega128 board. Be sure that the programmer is correctly |
| Insert simple C source code: | Insert simple C source code: | ||
| Line 77: | Line 77: | ||
| int main(void) | int main(void) | ||
| { | { | ||
| - | // pin PB7 to output | + | // Pin PB7 to output |
| DDRB = 0x80; | DDRB = 0x80; | ||
| - | // endless | + | // Endless |
| while (true) | while (true) | ||
| { | { | ||
| - | // pin PB7 invertion | + | // Pin PB7 invertion |
| PORTB ^= 0x80; | PORTB ^= 0x80; | ||
| hw_delay_ms(500); | hw_delay_ms(500); | ||
| Line 92: | Line 92: | ||
| [{{ : | [{{ : | ||
| - | Compile the project with //Build// command (keyboard F7). Be sue that the compilation succeeded. For this you should see the following message on the message window. | + | 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. |
| < | < | ||
| Line 100: | Line 100: | ||
| **2.** Open the controller window //Tools -> Program AVR -> Auto Connect//. Be sure that the tab //Program// is open. | **2.** Open the controller window //Tools -> Program AVR -> Auto Connect//. Be sure that the tab //Program// is open. | ||
| - | {{ : | + | {{ : |
| - | If the described window does not open and // | + | If the described window does not open and // |
| - | {{ : | + | {{ : |
| - | **3.** On the programmer window insert into // | + | **3.** On the programmer window insert into // |
| OK | OK | ||
| Line 118: | Line 118: | ||
| Leaving programming mode.. OK | Leaving programming mode.. OK | ||
| - | According to the program the on-board LED (PB7) should start flashing. If it works like this you have successfully set up your programming environment and completed your first program. Congratulations! | + | According to the program the on-board LED (PB7) should start flashing. If the program |
| {{: | {{: | ||
| Line 124: | Line 124: | ||
| ===== Debugger ===== | ===== Debugger ===== | ||
| - | [{{ : | + | [{{ : |
| - | Programmi silumiseks (inglise keeles // | + | Debugging a program means searching errors from the program. For that programs called debuggers are created, they 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 program, contents of the registers and the sequence of executing the program. Debugging is especially important while dealing with more complex programs where it is often difficult to find errors. With microcontrollers, it 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 registers. Two conditions must be met for using a debugger: microcontroller must support debugging and you must have necessary hardware – JTAG programmer which allows debugging. Cheaper 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 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 code. When implementation of the program reaches the break point, the 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, | ||
| - | ===== Ujukoma-arvude kasutamine | + | ===== The usage of floating-point variables |
| - | Mõnikord tekib vajadus | + | 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.** | + | **1.** |
| - | **2.** | + | **2.** |
| - | **3.** | + | **3.** |
en/examples/setup/windows.1265297003.txt.gz · Last modified: (external edit)
