Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| microcontrollertechnik:tips_for_prgramming [2026/03/08 20:41] – [Stepper Motor Driver] mexleadmin | microcontrollertechnik:tips_for_prgramming [2026/03/08 20:46] (current) – removed mexleadmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Tips for Programming ====== | ||
| - | |||
| - | * If the task involves hardware-software co-design, the creation of the software or the software system development can already begin in parallel with the schematic design or directly afterwards. | ||
| - | * First, think about | ||
| - | * **what** the software has to do (higher-level tasks), | ||
| - | * and in **which sequence** it should do so | ||
| - | * Then you can consider | ||
| - | * how these individual tasks can be assigned to **C functions**, | ||
| - | * how the C functions depend on one another, | ||
| - | * which interfaces the C functions require between each other (data type, value range, name) | ||
| - | * **Only then should you think about what the code looks like**. A look at the datasheets and application notes of the µControllers and chips can help here. These often already provide algorithms or code snippets. | ||
| - | |||
| - | ===== Software System Design ===== | ||
| - | If you do not yet know exactly how the software or the hardware to be used will be applied, the following tips should help: | ||
| - | * Do not search for the component only in German. The number of results increases many times over if you search in English. [[https:// | ||
| - | * Also use image search if you do not know the exact term. | ||
| - | * If terms are unclear, the following search terms can also help: // '' | ||
| - | |||
| - | ===== Requirements for Evaluation ===== | ||
| - | |||
| - | The [[vorgaben_fuer_die_softwareentwicklung|Requirements for Programming]] contain notes on what the submitted code should look like. | ||
| - | |||
| - | ===== Common Errors and Debugging ===== | ||
| - | |||
| - | * Tips on debugging and common mistakes can be found in the [[microcontrollertechnik: | ||
| - | * Try to test your program after every small change whenever possible. If you change three things and only test afterwards, you will not know which change caused the issue! | ||
| - | *{{microcontrollertechnik: | ||
| - | |||
| - | ===== General ===== | ||
| - | * A good introduction to embedded software development can be found in the book [[https:// | ||
| - | * The hardware does not need to be fully completed in order to start programming. If you want to use a microcontroller from the ATmega family, you can already develop and test software with the MiniMEXLE, MEXLE2020, or Simulide. | ||
| - | * Tips for the {{ : | ||
| - | * If you need large tables, you should store the data in program memory (EEPROM) and not in data memory (SRAM). As a rule, the program memory is larger by a factor of 5 to 10. | ||
| - | * There is no [[http:// | ||
| - | * If you search the web for solutions, note that Arduinos generally use C%%++%% (e.g. file.cpp). In most cases this is not directly compatible. On the other hand, the concepts can still be adopted. | ||
| - | * for(x = 0 ; x < 400 ; x%%++%%) : If x is defined as an 8-bit integer, this loop will run forever... | ||
| - | * Variable types must be taken into account in calculations, | ||
| - | |||
| - | ===== Serial Interfaces ===== | ||
| - | * Programming an AVR chip via USB (if the chip supports this) is done using the tool [[https:// | ||
| - | * If you want to control an external component via a microcontroller, | ||
| - | * If another I2C interface is required, you can find [[https:// | ||
| - | |||
| - | ===== Programming the ST7565 in the ERC 128 64 - 1 Display ===== | ||
| - | * The {{ laborausstattung: | ||
| - | * In the {{ grundlagen_der_digitaltechnik: | ||
| - | * The commands that can be used via SPI are described in the datasheet. | ||
| - | * Via SPI, the display can only be written to. Reading is not possible. | ||
| - | * Read the manufacturer' | ||
| - | * Pay attention to the mounting orientation when controlling the display. | ||
| - | |||
| - | ===== Using Ports ===== | ||
| - | * The following must be observed if you want or need to use JTAG ports differently - e.g. PF4..7 on the ATMEGA16U4 - (JTAG ports = ports to which the programming hardware is connected): The JTAG ports cannot be used directly without further action. The JTAG interface must first be disabled using the following code: \\ < | ||
| - | MCUCR |=(1<< | ||
| - | MCUCR |=(1<< | ||
| - | </ | ||
| - | * For time-critical output of consecutive bits (e.g. for controlling [[elektronik_labor: | ||
| - | * If you use an external oscillator or crystal, two ports are used for this (ports XTAL = " | ||
| - | |||
| - | ====== Simulide ====== | ||