Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| microcontrollertechnik:tipps_fuers_programmieren [2026/03/08 20:39] – mexleadmin | microcontrollertechnik:tipps_fuers_programmieren [2026/03/08 20:39] (current) – old revision restored (2026/03/08 20:36) mexleadmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| - | * If the task involves hardware-software co-design, the creation of the software or the software system development can already begin in parallel | + | * Sofern es sich um eine Aufgabe mit Hardware-Software-Co-Design handelt, kann mit der Erstellung der Software bzw. der Softwaresystem-Entwicklung bereits |
| - | * First, think about | + | * Machen Sie sich dazu zunächst Gedanken, |
| - | * **what** the software has to do (higher-level tasks), | + | * **was** die Software tun muss (übergeordnete Tätigkeiten), |
| - | * and in **which sequence** it should do so | + | * und in **welcher Abfolge** sie das tun soll |
| - | * Then you can consider | + | * Dann können Sie sich überlegen, |
| - | * how these individual tasks can be assigned to **C functions**, | + | * wie diese einzelnen Tätigkeiten |
| - | * how the C functions depend on one another, | + | * wie die C-Funktionen voneinander abhängen, |
| - | * which interfaces the C functions require between each other (data type, value range, name) | + | * welche Schnittstellen die C-Funktionen untereinander benötigen, |
| - | * **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. | + | * **Erst dann sollten Sie überlegen wie der Code aussieht**. Hier hilft ein Blick in die Datenblätter und Application Notes der µController und Chips. Dort sind nicht selten Algorithmen oder Codeschnipsel vorgegeben. |
| ===== Software System Design ===== | ===== 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: | + | Falls Sie noch nicht wissen, wie die Software oder die zu verwende Hardware genau genutzt wird, sollten folgende Tipps helfen: |
| - | * Do not search for the component only in German. The number of results increases many times over if you search | + | * Suchen Sie die Komponente nicht (nur) auf deutsch. Die Ergebnisse vermehren sich um ein Vielfaches, wenn in Englisch gesucht wird. Zur Übersetzung empfiehlt sich [[https:// |
| - | * Also use image search if you do not know the exact term. | + | * Nutzen Sie auch die Bildersuche, |
| - | * If terms are unclear, the following search terms can also help: // '' | + | * Bei unklaren Begriffen, bieten sich auch folgende Suchworte an: // '' |
| - | ===== Requirements for Evaluation | + | ===== Vorgaben für Bewertung |
| - | The [[vorgaben_fuer_die_softwareentwicklung|Requirements for Programming]] contain notes on what the submitted code should look like. | + | Die [[vorgaben_fuer_die_softwareentwicklung|Vorgaben für die Programmierung]] enthalten Hinweise, wie der abgegebene Code aussehen soll. |
| - | ===== Common Errors and Debugging ===== | + | ===== Häufige Fehler und Debugging ===== |
| - | * Tips on debugging and common mistakes can be found in the [[microcontrollertechnik: | + | * Tipps zum Debugging und zu häufigen Fehlern finden sich bei den [[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! | + | * Versuchen Sie möglichst nach jeder kleinen Änderung Ihr Programm zu testen. Wenn Sie drei Punkte ändern und dann erst testen, dann wissen Sie nicht, an welcher Änderung es liegt! |
| - | *{{microcontrollertechnik: | + | *{{microcontrollertechnik: |
| - | ===== General | + | ===== Allgemeines |
| - | * A good introduction to embedded software development can be found in the book [[https:// | + | * Eine schöne Einführung |
| - | * The hardware does not need to be fully completed in order to start programming. If you want to use a microcontroller from the ATmega | + | * Zum Programmieren muss die Hardware noch nicht vollständig sein. Wenn Sie einen Mikrocontroller der ATmega |
| - | * Tips for the {{ : | + | * Tipps für die {{ : |
| - | * If you need large tables, you should store the data in program memory | + | * Falls Sie lange Tabellen benötigen, sollten Sie die Daten im Programmspeicher |
| - | * There is no [[http:// | + | * Es gibt keine [[http:// |
| - | * If you search the web for solutions, note that Arduinos | + | * Falls Sie im Netz nach Lösungen suchen, so beachten Sie, dass bei Arduinos |
| - | * for(x = 0 ; x < 400 ; x%%++%%) : If x is defined as an 8-bit integer, | + | * for(x = 0 ; x < 400 ; x%%++%%) : Wenn x als 8 bit integer |
| - | * Variable types must be taken into account in calculations, otherwise | + | * Die Variablentypen sind bei Rechnungen zu beachten, sonst wird aus c=a/b mit int a=5 und int b=2 eine 2. Hier hilft ein expliziter Typecast: c=(float)a/ |
| - | ===== Serial Interfaces | + | ===== serielle Schnittstellen |
| - | * Programming an AVR chip via USB (if the chip supports this) is done using the tool [[https:// | + | * Die Programmierung eines AVR-Chips über USB (sofern dies der Chip ermöglicht), geschieht über das Tool [[https:// |
| - | * If you want to control an external component via a microcontroller, the following must be considered: Check whether the external component triggers on the positive | + | * Falls Sie einen externen Baustein über einen Mikrocontroller ansteuern wollen, ist folgendes zu beachten: Überprüfen Sie, ob der externe Baustein auf die positive |
| - | * If another | + | * Falls eine weitere |
| - | ===== Programming the ST7565 | + | ===== Programmierung des ST7565 |
| - | * The {{ laborausstattung: | + | * Das Display |
| - | * In the {{ grundlagen_der_digitaltechnik: | + | * Je 8bit vertikal sind im {{ grundlagen_der_digitaltechnik: |
| - | * The commands that can be used via SPI are described in the datasheet. | + | * Die Kommandos, welche über SPI genutzt werden können, sind im Datasheet beschrieben. |
| - | * Via SPI, the display can only be written to. Reading is not possible. | + | * Über SPI kann nur auf das Display geschrieben werden. Ein Lesen ist nicht möglich. |
| - | * Read the manufacturer' | + | * Lesen Sie den Beispiel-Code des Herstellers und suchen Sie ob es Tutorials für den ST7565 |
| - | * Pay attention to the mounting orientation when controlling the display. | + | * Beachten Sie die Einbaurichtung bei der Ansteuerung des Displays. |
| - | ===== Using Ports ===== | + | ===== Verwenden von Ports ===== |
| - | * The following must be observed if you want or need to use JTAG ports differently | + | * Folgendes ist zu beachten, falls Sie JTAG-Ports - z.B. PF4..7 |
| MCUCR |=(1<< | MCUCR |=(1<< | ||
| MCUCR |=(1<< | MCUCR |=(1<< | ||
| - | </ | + | </ |
| - | * For time-critical output of consecutive bits (e.g. for controlling | + | * Für eine zeitkritische Ausgabe von aufeinanderfolgenden Bits (z.B. für die Ansteuerung von [[elektronik_labor: |
| - | * If you use an external oscillator or crystal, two ports are used for this (ports XTAL = " | + | * Falls Sie einen externen Oszillator oder Quarz benutzen, werden zwei Ports dafür verwendet |
| ====== Simulide ====== | ====== Simulide ====== | ||
| - | ===== Stepper Motor Driver | + | ===== Schrittmotortreiber |
| - | Various stepper motor drivers | + | Verschiedene Schrittmotortreiber bzw. Steppermotor Driver |
| - | However, the following simulation at least allows this to be replicated: | + | Folgende Simulation ermöglicht aber zumindest die Nachbildung |
| {{microcontrollertechnik: | {{microcontrollertechnik: | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||