Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
microcontrollertechnik:start [2020/03/25 00:09] – ↷ Page moved and renamed from microcontrollertechnik to microcontrollertechnik:start tfischermicrocontrollertechnik:start [2026/03/08 21:59] (current) mexleadmin
Line 1: Line 1:
-====== Mikrocontroller-Technik ======+====== Microcontroller Programming ====== 
 + 
 +===== Introduction and Context =====
  
 <WRAP right> <WRAP right>
-{{::codeoflife.jpg?200|}} +{{codeoflife.jpg?200|}} 
-\\ <fs 70%>Source: eigenes Foto ([[https://creativecommons.org/publicdomain/zero/1.0/deed.en|CC0 1.0]])</fs>+\\ <fs 70%>Source: own photo ([[https://creativecommons.org/publicdomain/zero/1.0/deed.en|CC0 1.0]])</fs>
 </WRAP> </WRAP>
  
-Die Mikrocontroller-Technik befasst sich damit, wie man einem programmierbaren Bauteil ("Mikrocontroller"Leben einhauchtDabei wird die Software im Folgenden in der Programmiersprache programmiertIm Gegensatz zu der im 1. und 2. Semester im Kurs Informatik dargestellten Sprachkomponenten und Algorithmen wird hier Wert auf die Eigenheiten durch die Hardware-nähe gelegt.  +Microcontroller technology deals with how to bring a programmable component ("microcontroller"to lifeIn the following, the software is programmed in the programming languageIn contrast to the language components and algorithms presented in the Computer Science course in the 1st and 2nd semesterthe focus here is on the special characteristics resulting from the close connection to hardware
- +The course builds on knowledge from the following subjects:
-Die Veranstaltung ist mit dem EST Labor kombiniert. Details zum Ablauf finden Sie beim [[elektronische_schaltungstechnik_labor|EST Labor]]. +
- +
---> 1. Hello Blinking World # +
-<WRAP group>  +
-===== 1. Hello Blinking World ===== +
-<WRAP half column> +
- +
-==== Ziele ==== +
- +
-Nach dieser Lektion sollten Sie: +
- +
-  - x +
-</WRAP> <WRAP half column> +
- +
-==== Video ==== +
- +
-LED Blinken und Bit-Manipulation  +
-{{youtube>2VPM2Q0JtxI}} +
-</WRAP> </WRAP> +
- +
-<-- +
- +
---> 2. Sound und Timer  # +
-<-- +
- +
---> 3. Logische Funktionen # +
-<-- +
- +
---> 4. Up/Down Counter # +
-<-- +
- +
---> 5. Menüführung +
-<-- +
- +
---> 6. Würfel und Zufall # +
-<-- +
- +
---> 7. Uhr und Zeitraster # +
-<-- +
- +
---> 8. Temperatur und Analog-Digital-Wandler # +
-<-- +
- +
- +
---> 9. UART und Terminal # +
-<WRAP> +
-===== 9. UART und Terminal ===== +
- +
-Bei der Programmierung wünscht man sich häufig die Möglichkeit Daten des Mikrocontrollers irgendwo darzustellen. +
-Mit Hilfe des Freeware Programms [[https://www.putty.org/|PuTTY]] kann leicht ein Terminal für die Kommunikation mit dem PC geöffnet werden. Zusätzlich wird dann noch ein USB-to-serial Adapter benötigt. +
- +
-  - [[https://www.mikrocontroller.net/articles/AVR-Tutorial:_UART|Tutorial zu UART auf mikrocontroller.net]] +
-  - [[https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter#Data_framing|Datenpaket für RX/TX]] +
-  - [[https://de.wikipedia.org/wiki/RS-232#Leitungsl%C3%A4nge_und_%C3%9Cbertragungsrate|Leitungslänge vs. Übertragungsrate]] +
-</WRAP> +
-<-- +
- +
---> 10. I2C Schnittstelle # +
- +
-<WRAP group>  +
-===== 10. I2C Schnittstelle ===== +
-<WRAP half column> +
- +
-==== Ziele ==== +
- +
-Nach dieser Lektion sollten Sie: +
- +
-  - wissen wie die Kommunikation zwischen I2C Master und Slave funktioniert +
- +
- +
-</WRAP> <WRAP half column> +
- +
- +
-</WRAP>  +
- +
-==== Dokumentation von Atmel ==== +
- +
-  * [[https://www.microchip.com/wwwAppNotes/AppNotes.aspx?appnote=en591794|Application Note: TWI Module as I2C Master]] +
-  * [[https://www.microchip.com/wwwAppNotes/AppNotes.aspx?appnote=en591792|Application Note: TWI Module as I2C Slave]] +
-  * alternative Implementierung von [[https://github.com/knightshrub/I2C-master-lib|Elia Ritterbusch]] +
- +
-\\ +
-==== Beschreibung ==== +
- +
-++++ Statemachine der I2C Kommunikation | === Statemachine der I2C Kommunikation === +
- +
-<uml>  +
-keine_Kommunikation : - +
-Datenausgabe1 : Datenbit = 1 +
-Datenausgabe0 : Datenbit = 0 +
- +
-[*] --> keine_Kommunikation  +
-keine_Kommunikation ->  keine_Kommunikation : !SCL || !SDA +
-keine_Kommunikation --> Warten_auf_Clock_Lo : SCL && SDA  +
-Warten_auf_Clock_Lo ->  Warten_auf_Clock_Lo : !SCL || SDA +
-Warten_auf_Clock_Lo --> Bits_lesen_aktiv    : SCL && !SDA  +
-Bits_lesen_aktiv    ->  Bits_lesen_aktiv    : SCL  +
-Bits_lesen_aktiv    --> Warten_auf_Clock_Hi : !SCL  +
-Warten_auf_Clock_Hi ->  Warten_auf_Clock_Hi : !SCL  +
-Warten_auf_Clock_Hi --> Datenausgabe0       : SCL && !SDA   +
-Datenausgabe0       ->  Datenausgabe0       : SCL && !SDA  +
-Datenausgabe0       --> Bits_lesen_aktiv    : !SCL   +
-Datenausgabe0       --> keine_Kommunikation : SDA   +
-Warten_auf_Clock_Hi ->  Datenausgabe1       : SCL && SDA   +
-Datenausgabe1       ---> Datenausgabe1      : SCL && SDA  +
-Datenausgabe1       --> Warten_auf_Clock_Hi : !SCL  +
-Datenausgabe1       --> Bits_lesen_aktiv    : !SDA   +
- +
-</uml> +
-++++ +
- +
-=== Zeitverlaufsdiagramm === +
-<wavedrom> {signal: [ +
-{name: 'SDA'wave: '10444444453104|43101',  +
-               node: '.a.................d', +
- data: ['A6', 'A5', 'A4', 'A3', 'A2', 'A1', 'A0', 'R/W', 'ACK', 'D7 . . . . D1', 'D0', 'ACK'],  +
- phase: -0.6 +
-}, +
-{name: 'SCL', wave: '1.0p........l.p|..l1', +
-               node: '..b................c' +
-}, +
-]} </wavedrom> +
- +
-</WRAP>  +
- +
-<-- +
- +
---> 11. SPI-Schnittstelle # +
- +
-<WRAP group>  +
-===== 11. SPI-Schnittstelle  ===== +
-<WRAP half column> +
- +
-==== Ziele ==== +
- +
-Nach dieser Lektion sollten Sie:+
  
-  - wissen, welche wie man theoretisch mehrere Slaves mit einem Master verbindet. +  * Computer Science I and II (Informatik I und II)
-  - die Namen der 4 Leitungen und deren Funktionen kennen, welche jeweils an einem Slave enden. +
-  - die Abkürzungen SDI, SDO, MOSI, MISO, CS, SS, SCK kennen +
-  - die Vorteile von einer synchronen im Vergleich zu einer asynchronen Schnittstelle erklären können.+
  
-</WRAP> <WRAP half column>+**Important:**
  
-==== Video ====+  * Stay in contact with us! Even though there may be weeks of independent work, communication is important so that a meaningful result can be submitted for the respective deadlines. 
 +  * Exchange ideas with the other students. In most cases, you have the solution to someone else's problem, and vice versa. 
 +  * If you only start programming one week before the submission deadline, things will usually get tight. Especially if there are uncertainties and questions. Start early. 
 +  * Try to find enjoyment in programming. It is like doing a puzzle, except that you decide what the picture looks like!
  
-Theorie zum SPI +~~PAGEBREAK~~ ~~CLEARFIX~~
-{{youtube>7uDo_Du5d9g}}+
  
-Beispiel für SPI mittels Arduino 
-{{youtube>dmpgx7F-VlI}} 
-</WRAP> </WRAP> 
  
 +===== Links to the Lecture =====
  
-<--+^ Topic ^ Description ^ Language ^ 
 +| Tutorial | A good introduction to embedded software development can be found in the book "Sensor Networks in Theory and Practice Successfully Realizing Embedded Systems Projects" by Prof. Meroth and Mr. Sora. It explains how to get started in the field of software development embedded in hardware. From within the university network or via VPN, you can access it directly on [[https://link.springer.com/book/10.1007/978-3-658-31709-6|Springer Link]]. |German| 
 +|:::| The above-mentioned book is also available in English as "Sensor Networks in Theory and Practice". It is the accompanying book by Prof. Meroth and Mr. Sora. It explains how to get started in the field of embedded software development for hardware systems. From the university network or via VPN, you can access it directly on [[https://link.springer.com/content/pdf/10.1007/978-3-658-39576-6.pdf|Springer Link]].|English| 
 +| Tutorial | Recommended tutorial from [[https://www.mikrocontroller.net/articles/AVR-GCC-Tutorial|mikrocontroller.net]] |German| 
 +| Tutorial | The AVR itself also provides a good introduction to C programming on the AVR platform as a [[https://www.youtube.com/watch?v=UMi6lg563BA&index=3&list=PLtQdQmNK_0DRhBWYZ32BEILOykXLpJ8tP|video]] and as [[https://developerhelp.microchip.com/xwiki/bin/view/products/mcu-mpu/8-bit-avr/|textual Developer Help]] |English| 
 +| Datasheet | The [[https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega48_88_168_megaAVR-Data-Sheet-40002074.pdf|data sheet]] of the ATmega88 is also a good reference work |English| 
 +| Datasheet | The data sheet of the ATmega88 has also been translated into German: [[https://www-user.tu-chemnitz.de/~heha/viewchm.php/hs/ATmegaX8.chm/|Online data sheet ATmega88]] |English| 
 +| C Support | A [[http://www.8bit-era.cz/arduino-timer-interrupts-calculator.html|calculator for interrupt timers and prescalers]] |English| 
 +| C Support | [[https://www.nongnu.org/avr-libc/user-manual/modules.html|Documentation of the AVR compiler libraries]] (e.g. stdlib) |English|
  
-===== Tipps ===== 
-  * Nutzen Sie die Anzeige von Zeilennummern: Tools -> Options -> Text Editor -> All languages -> General -> Line numbers 
  
-===== Links =====+===== Further Links =====
  
-  * [[AVR Programmierung für Dummies]] +=== C Programming === 
-  * schönes Online [[https://de.wikibooks.org/wiki/C-Programmierung|Open Source Buch]] zum Erlernen der Programmiersprache +  * Nice online [[https://de.wikibooks.org/wiki/C-Programmierung|open source book]] for learning the programming language 
-  * Eine schöne Einführung in die Embedded Softwareentwicklung ist im Buch [[https://link.springer.com/content/pdf/10.1007%2F978-3-658-18386-8.pdf|Sensornetzwerke in Theorie und Praxis - Embedded Systems-Projekte erfolgreich realisieren]] von Kollegen Meroth und Sora zu finden. Dort wird der Einstieg in das Feld die (in Hardware) eingebettete Softwareentwicklung erklärt. Aus dem Hochschulnetz bzw. mit VPN können Sie dieses direkt bei Springer Link betrachten. Eine andere schöne Einführung findet sich auf [[https://www.mikrocontroller.net/articles/AVR-GCC-Tutorial|Mikrocontroller.net]]. +  * [[https://www.math.brown.edu/~jhs/ReferenceCards/CRefCard.v2.2.pdf|C Code Reference Card]] ("C cheatsheet")
-  * [[https://www-user.tu-chemnitz.de/~heha/viewchm.php/hs/ATmegaX8.chm/|deutsche Übersetzung der ATmega88 Anleitung]] +
-  * [[https://de.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange#Zusammensetzung|Tabelle der ASCII Zeichen]] +
-  * [[http://www.8bit-era.cz/arduino-timer-interrupts-calculator.html|Rechner für Interrupt Timer und PreScaler]] +
-  * [[Atmel Studio Tipps]]+
  
-  * [[https://sourceforge.net/projects/simulide/|SimulIDE]]: kostenlose Simulation u.a. von ATMEL Chips. Diese sind auch programmierbar. \\ Leider mit 2 Haken1. es kann nur ein Microcontroller simuliert werden, 2die aktuelle Version (SimulIDE 0.3.12-SR3) scheint bei falscher Verlegung der Verbindungen leicht abzustürzen.+=== Embedded Systems Engineering and Hardware/Software Co-Design === 
 +  [[https://www.ifi.tu-clausthal.de/fileadmin/IFI/Abteilungen/Energieinformationsnetze_und_Systeme/Embedded_Systems_Engineering_Handbuch_V0_61a.pdf|Embedded Systems Engineering Handbook]] from TU Clausthal / FH Nordhausen: very detailed and in-depth book 
 +  * The book [[https://sourceforge.net/projects/qpc/files/doc/PSiCC2.pdf/download|Practical UML Statecharts in C/C++, 2nd Edition: Event-Driven Programming for Embedded Systems]] is also suitable as detailed reference work \\ [[http://sourceforge.net/projects/qpc/files/doc/PSiCC2-CN.pdf/download|Chinese translation]]
  
-  * [[https://www.mikrocontroller.net/attachment/74100/Bauanleitung_AVR-USB-PROGI.pdf|Bauanleitung des Mexle AVR-Proggis]]+=== Miscellaneous === 
 +  * [[https://de.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange#Zusammensetzung|Table of ASCII characters]] 
 +  * [[https://www.mikrocontroller.net/attachment/74100/Bauanleitung_AVR-USB-PROGI.pdf|Assembly instructions for the Mexle AVR programmer]]