Seite 1 Prof. J. WALTER Kurstitel Stand: Oktober 2006 mc Tafel Wintersemester 06 Prof. J. Walter...
-
Upload
diederick-schneidman -
Category
Documents
-
view
105 -
download
1
Transcript of Seite 1 Prof. J. WALTER Kurstitel Stand: Oktober 2006 mc Tafel Wintersemester 06 Prof. J. Walter...
Seite 1Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
TafelWintersemester 06
Prof. J. Walter
Seite 2Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
02.10.06 Thomas Haehnel
Seite 3Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Der erste Befehl
• Jmp Sprungziel = jump label
Seite 4Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc PDL
• Programm design language• Zuerst kommentieren, WAS
gemacht wird • Erst dann kommt das WIE• Erkenntnis: die Dokumentation und
Kommentare sind das Wichtigste
Seite 5Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Merkspruch
• Nur dokumentierte Software ist existent!
Seite 6Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc 02.10.2006
??? Leute kein Notebook ?? haben einen Rechner Pentium 5 mit 1,8 GHz, TFT, 1024x768 Alle Studenten eigenen Notebook
mitbringen! RJ45 Anschluss mit 100MBit/s W-Lan mit 54MBit In der Vorlesung wird programmiert
Seite 7Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Semester
?? MT3 ?? MT4 ?? FT
Seite 8Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Assembler-Programm
• Name: EIN_AUS6• Was muß das Programm machen?• T1 einschalten -> L1• T2 ausschalten ->L1
Seite 9Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc .NET Framework
• Lizenz im Sekretariat• Ansprechpartner Prof. Artinger
Seite 10Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc 1,0 Pegel erzeugen
Ausgang
+ 5V
GND
R = 5 kΏ
Seite 11Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Eingang Schalter
Eingang
+ 5V
GND
R = 5 kΏ
Port 1.1Zum Controller
Seite 12Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Lampe leuchtet (Ausgang)
Ausgang
+ 5V
GND
R = 5 kΏ
Microcontroller Externe Beschaltung
Seite 13Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
9. Oktober 2006
Her(t)zlich Willkommen
Seite 14Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Maurice Bopp
• Installation Keil-Software µ-vision• Benutzer: Administrator• Hier immer 8051-Controller• Installation Keil
Evaluationssoftware• C51
Seite 15Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Götz Werner
• DM-Markt• Man kann nicht gelernt werden,
sie müssen selbst lernen• Bitte installieren sie selbst 8051-
Software• Installation der Vorlage
Seite 16Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcNeues 8051-
Programm• Gleichzeitig 3 Lampen ein, 3
Lampen aus• L1=>P3.2 • L2=>P3.3• L3=>P3.4
Seite 17Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc EinAus3
• Bitte Programm auf Rechner entwickeln und auf Stick speichern
• wie in Prüfung• Programm: EinAus3
Seite 18Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Bemerkung
• Alle Programme wurden unter IE6, IE7 getestet
• Für andere Tests hat der Dozent keine Zeit
• Dozent arbeitet immer mit Standardsoftware
Seite 19Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Bemerkungen
• Umgang mit Beamer und PC wird vorausgesetzt
• Kann ich die Ports auf einmal umschalten?
• Nein, so nicht clr P3.2, P3.3, P3.4• Bitte gesamten Ordner EinAus3
speichern
Seite 20Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Bemerkungen
• Ziel: Programmieren von 8051• Sie könne gleichzeitig den Port
beschreiben • Mov P4,#1110 0011b• µ = 10^-6
Seite 21Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Hausaufgabe
• Hausaufgabe: wie weit kommt das Licht in einer µ-Sekunde?
Seite 22Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Rafael Swoboda
• Evaluation• Leihe Entwicklungssystem in der
Bibliothek• Hinweis: Schreibmaschinenkurs• Keil Software• Mit aktueller Software lernen
Seite 23Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Neuer Befehl
• Mov P4,#1110 0011b• 4 Bits=1 Nippel, 2 Nippel=1 Byte• Hexadezimalzahlen werden
vorausgesetzt
Seite 24Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Mov_P4
• Programm: Mov_P4• T1 Bitkombination in P4
schreiben• T2 Alle Bits setzen• Erfahrungen: jeder sollte das
Programm entwickeln können
Seite 25Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Tipps
• Immer nur eine Instanz von Keil öffnen
• Für jedes Programm ein neues Projekt anlegen
• Unterscheidung zwischen Bit- und Byte-Befehlen
Seite 26Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Tipps 2
• Unterscheidung zwischen Bit- und Byte-Adressen
Seite 27Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
• Msb, most significant byte
Seite 28Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Organisatorisches
• Di Nachmittag Vorlesung in den ersten 6 Wochen
• Dann Labor Di und Mi• Mit Assistent und HiWi• Wesentliche Verbesserung:
Studenten über Organisation informieren
Seite 29Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
• Neueste Ausrüstung, bitte Sorgfalt
Seite 30Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Michael Kraft
• Blog: Post im Internet• http://
mechatronik.wordpress.com
Seite 31Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcTest des
ProgrammesProgramm Mov_P4• Aufgabe: Mov_P4 mit Bit Befehlen• Name: Mov_P4b• Bit setzen• Bit rücksetzen• Programmstart bei 0x0000 im
Speicher
Seite 32Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Gelerntes
• Byte setzen• Byte zurücksetzen• Breakpoints setzen• F5: Run• Automatisch Debuggen• Zauberstift
Seite 33Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Unterlagen
• Alle Bilder im Internet• Startseite Mikrocomputertechnik• Producer• Video- Powerpoint- html
gemischt• Multiple choice Kapitel 1
Seite 34Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Daniel Flicke
• MindmanagerSmart• Paßwort: nurfürdich
Seite 35Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Vorstellung Projekt
• Bsp.-Projekt Autoverfolgung SS05• Web• http://193.196.117.23/projekte
/ws06-xxx
Seite 36Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Christian Fritz
• Datum 16.10.06
Seite 37Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Ziel: A/D Wandlung
• Analoger Wert: – Wert: kontinuierlich und – Zeit: kontinuierlich– x-Achse kontinuierlich und – y-Achse kontinuierlich
Seite 38Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc A/D
Seite 39Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Programm: A_D_W
• A/D-Wandler• auf Tastendruck T1 wird ein
Wert gewandelt• L1 an: Programm läuft• L2 an: A/D Wandlung beendet
Seite 40Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Befehle
• Wandlung auslösen:– mov DAPR, #0
• warten bis A/D fertig:– jb BSY, $– WARTEN: – jb BSY, WARTEN
Seite 41Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Befehle 2
• Wert in Akku (=Akkumulator) A• Wert steht nach der Wandlung
im Register ADDAT
Seite 42Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Fehler
• „Target“ fehlt• Abhilfe: Datei Explorer • (siehe nächste Folie)
Seite 43Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcBei Fehlermeldung des
Compilers
Seite 44Prof. J. WALTER Kurstitel Stand: Oktober 2006
mckleine
Hausaufgabe• nach jeder Wandlung wird die
nächste Kanalnummer gewählt• neuer Befehl:• inc Register (z.B. inc A)
Seite 45Prof. J. WALTER Kurstitel Stand: Oktober 2006
mckleine
Hausaufgabe 2• es wird eine Schleife und ein
Schleifenzähler benötigt (von 0 bis7)
Seite 46Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Christian Fritz
• Datum: 17.10.06
Seite 47Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Tipps
• Allgemeine Aussagen des Profs:• Vorsicht bei unterschiedlichen
Software-Versionen!• Bitte Frage stellen:
– Zu was benötige ich das?
Seite 48Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Tipps 2
• Bitte Wohnzimmer und Toilette nicht verwechseln
• Im Vorlesungsraum: Kameraüberwachung
Seite 49Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Herausforderung
• Zu was brauch ich den MIST A/D-Wandlung!?
Seite 50Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcTemperaturerfassu
ngA/D-
Wandlung
µ-Controller
0V – 3V
ADDAT
A
5V
0V
99
Register
Seite 51Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc MOV - Befehl
• mov Ziel,Quelle• mov A,ADDAT• stehen die Daten im Akku,
erreiche ich jedes Ziel• Daten können beliebig
bearbeitet werden
Seite 52Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Bsp. Kühlschrank
• mittlere Temperatur in einem Kühlschrank ermitteln
• Position der Sensoren:• Gemüsefach und mittleres Fach• S1 an AN0• S2 an AN1
Seite 53Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Programm KUEHL1
• Ziel: Anzeige der mittleren Temperatur in einem Kühlschrank
• KUEHL1 digitalisiert die Werte von 2 Sensoren und schreibt die Werte in Register R0 und R1
Seite 54Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcWiederholung
Umrechnung• Spannungsbereich von 0V-3V• wird linear auf eine Temperatur
umgerechnet• z.B.
Seite 55Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcZuordnung Temperatur
-> Zahl
Seite 56Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Jamal Oulhadj
Seite 57Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcTipp vom Dozenten:
• Bei bitadressierbaren Bits immer die einzelnen Bits programmieren
• Nicht Byteweise !!
Seite 58Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Vitalis Meier
23.10.2006
Seite 59Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc ADCON
• AD control• MX0, MX1, MX2 • MX steht für Multiplexer
Seite 60Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Ziel
• Indirekte Adressierung• mov A,dadr; holt Inhalt der direkten
Adresse (interner Datenspeicher) in den Akkumulator
• Speicherbereich von 0 bis 7F h = 128 Byte interner Speicher direkt adressierbar
Seite 61Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcProgramm:
ADDADR • T1 schreibe den gewandelten
Wert(AN0) von ADDAT in die Adresse 30 h
• T2 schreibe den gewandelten Wert(AN0) von ADDAT in die Adresse 31 h
Seite 62Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Test von ADDADR
• AN0 = 4 V – Test des Programms
Seite 63Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Programm ZDRW
• Programm: mit der Taste T1 werden 32 Werte gewandelt und in den internen Datenspeicher ab 30 h gespeichert (AN0)
Seite 64Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc ZDRW
• R2 ist unser Zählregister• DJNZ R2,SCHLEIFE; decrement
jump not zero Inhalt von R2 -1, wenn nicht 0 springe nach SCHLEIFE
Seite 65Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcIndirekte
Adressierung• in R0 kommt die Adresse• ADDAT wird in Akkumulator
kopiert• mov@R0,A ; kopiert den Inhalt
von A in die Adresse, welche in R0 steht
Seite 66Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Frédéric Ablitzer
24.10.06
Seite 67Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Organisatorisches
• Heute Nachmittag wird Herr Beck Eagle
• Effektivität• Austausch von Programmen• Austausch von Hardware /
Schaltplane
Seite 68Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Tipps zur Prüfung
• Programm lokal auf Rechner entwickeln
• Zwischendurch Kopie von Projektordner auf Stick speichern
• Weiterentwicklung lokal auf Rechner
Seite 69Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc List-Account
• An der Universität Karlsruhe einfach
• MT4-eMail-Verteiler: [email protected]
Seite 70Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcProgramme
Download• Unter www.hit-karlsruhe.de
/8051
Seite 71Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Fragen
• Befehl INC R0 = Inhalt von R0 + 1• MOV @Ri,dadr ;dadr ist
direktadressierbarer Speicherbereich im 8051-Kontroller
• In dadr befinden sich alle Register, z.B. ADDAT, R0, … R7, ADCON
Seite 72Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcExterner
Speicherbereich• MOVX @DPTR,A• MOV DPTR,#const16• Schreiben sie das Programm:
ZDRWXDie 32 Werte sind im externen Datenspeicher zu speichern
Seite 73Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Martin Schmid
30.10.06
Seite 74Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc DPTR
• DatenPointer 16Bit– Adresse externer Datenspeicher– Debug: X:0x2000
• Zeigt den Inhalt des externen Datenspeichers ab Adresse 2000h
Seite 75Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc ZSRWX
• 256 Werte wandeln und in den externen Datenspeicher schreiben
Seite 76Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc ZTRWX
• 2560 Werte wandeln und in den externen Datenspeicher schreiben
• Tipp: innere und äußere Schleife• Z.B.: 256 mal 10 = 2560 Werte
Seite 77Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc MITTEMP
• Ermittlung der mittleren Temperatur
• Befehl: add A,Rn• Division durch 2• Befehl: rrc A• C Carry= Übertrag
Seite 78Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Sebastian Noworolski
31.10.06
Seite 79Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Letzte Vorlesung
• 0 0101 0101• 55h/2 = 42,5• 0 0010 1010• 2Ah = 42
Seite 80Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Einsatz
• Verbesserung von Meßwerten• Erniedrigung der
Messunsicherheit• Bsp. Erfassen von 8 Meßwerten,
summieren und Division durch 8• Mittelwertbildung
Seite 81Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcHausaufgabe des
Dozenten• Visualisierung/ Video• Darstellung in HPVE• Darstellung Blattfeder
Seite 82Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc rrc A
• 1 0011 0010• 0 1001 1001
Seite 83Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Timer 2
• Erzeugen einer Zeitdauer 50 ms• CRCH (Compare Reload Capture
High byte)• CRCL (Compare Reload Capture
Low byte)
Seite 84Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Folie 2: Timer 2
• CCL1 (Compare Capture Low byte Einheit 1)
• CCH1 (Compare Capture High byte Einheit 1)
• Fosc Frequenz des Controllers (12 MHz )
Seite 85Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Folie 3: Timer 2
• T2_50MS: Timer 2 ist so zu programmieren: Taktfrequenz 1 MHz, Reloadregister 15536, alle 50 ms wird ein Interrupt ausgelöst
• Tipp: Lösung im Buch mit 1 ms, Seite 150 Programmierung Timer 2
Seite 86Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc T50_MIT.A51
• Programm ermittelt alle 50ms die mittlere Temperatur von 2 Sensoren.
Seite 87Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Interrupt
• Ein Interrupt ist mit reti abzuschliessen
• Ein call mit ret
Seite 88Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc AD_INT
• Schreiben Sie das Programm: MITTEMP als Interruptprogramm für den A/D-Wandler IADC. D.H. Sobald die Wandlung durchgeführt wurde, ist ein Interrupt vom A/D-Wandler auszulösen.
Seite 89Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Heiko Schmidt
06.11.2006
Seite 90Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcProjektor
einschalten• Der Beamer wird über TCP/IP
geschaltet• Über Browser bedienbar• Sprache lässt sich einfach umstellen• URL = Adresse: 192.168.xxx.xxx• 65536 Geräte (Adressen)
Seite 91Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Bezug TCP/IP-MC
• Es gibt inzwischen MC mit TCP/IP Schnittstellen
• www.keil.com• MC-Projekt?• Stromversorgung über TCP/IP
Seite 92Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Interrupt
• Interrupt-Vektor vom A/D-Wandler
• Buch Seite 115 43h
Seite 93Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcInterrupt vom
Thema• Übung „Aufstehen“• Mit 4 Leitungen können 16
Adressen erzeugt werden• 65536 Adressen -> 16 Aufsteher
werden benötigt• 512 MB?
Seite 94Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcAdressen - Leitungen
Seite 95Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc AD_INTE
• A/D-Wandlung mit Interrupt einfach, d.h.
• T1ein Wert wird gewandelt mit Interruptverfahren
• Vorsicht IADC Flag muß zurückgesetzt werden
Seite 96Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Thomas Haehnel
07.11.2006
Seite 97Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Interrupt – Polling• A/D Wandler kann in 2 Verfahren betrieben
werden
– Interrupt• Ereignisorientiert• Während der Wandlungszeit andere
Operation
– Polling• Abfrage (jb BSY, $)
Seite 98Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc wunderbar
• Beim Controller lassen sich einzelne Bits programmieren
• Bei Prozessoren muß byteweise zugegriffen werden
Seite 99Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc ADINTEZ
• A/D Wandler mit Interrupt – zwei Sensoren
• Kanal 0 in R0• Kanal 1 in R1
Seite 100Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Vitalis Meier
Dienstag 14 Uhr
Seite 101Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Ziel
• Klarheit bei Projekten– Organisation– Inhalt
Seite 102Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Organisation
• 2 Leute bearbeiten 1 Projekt• 1 Projekt = 1 web
Seite 103Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Inhalt
• Entscheidung– Hardware Beispiel Uhr mit I2C-
Baustein– Software Beispiel Uhr mit Timer 2
• Protokolle erstellen, auch bei kleinen Sitzungen
• Es gibt keinen Vereinsamten
Seite 104Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcGerd Kaiser
• 13.11.2006• Ziel:
– Absolutes Verstehen des Interrupts– Nützlicher Fehler– Interrupt ganz einfach
Seite 105Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcWichti
g• Interrupt mit reti abschließen• Ein call mit ret abschließen• Erklärung:
– Rücksprungadresse
Seite 106Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcEinfacher Interrupt
• EIN_INT• Am externen Port 3.2 wird ein
Interrupt ausgelöst. • Es wird eine Lampe (Port 3.4)
angemacht
Seite 107Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcRücksprung-
Adresse• Die Rücksprung-Adresse wird im
internen Datenspeicher ab der Adresse 08h abgelegt.
• Die Adresse wird durch den Stack-Pointer bestimmt.
Seite 108Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc2 Rücksprung-
Adressen1. Programmunterbrechung tritt
auf2. Interrupt Service Routine
Seite 109Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcAufgab
e• Was geschah???• Fügen Sie 4 nop‘s in Die
Abfrageschleife• Je nach nop wird eine andere
Rücksprungadresse gespeichert
Seite 110Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc ERP
• Einfaches Register-Programm• Wo liegen die Register R1 und R2• ERP:
– T1 0A5H in R1– T2 05AH in R2
• D:0x00 interner Speicher anschauen
Seite 111Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcAD50_25
6• T1: Alle 50 ms werden zwei A/D-
Werte gewandelt, gemittelt und in den externen Speicher ab Adresse 2000h geschrieben. In Summe werden 256 gemittelte Werte geschrieben. Alles mit Interrupts ;-)
Seite 112Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Heiko Schmidt20.11.2006
Seite 113Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcProgramm
von• Maxime Leclercq und Gerd
Kaiser• Funktion erfüllt• Nur noch Kosmetik zu machen• Bemerkung: Aufgabe hat
Prüfungsniveau
Seite 114Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcBenennung
ISR• ISR = Interrupt Service Routine• z.B. ISR_AD: Interrupt wurde
vom A/D-Wandler ausgelöst• Manche Interrupts setzen das
Flag per Hardware zurück• Manche per Software, z.B. TF2
Seite 115Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcRichtig testen
• Prog muss mit mehreren Werten nacheinander getestet werden
• Tipp: Stack-Pointer sollte am Ende des Programms auf 07h stehen
Seite 116Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcAufgab
e• Testen Sie das Programm
AD50_256_2• Aufgabe für Streber:
programmieren Sie das Programm mit 100ms Abtastrate
Seite 117Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcPW
M• Pulsweiten-Modulation• Modulation = Multiplikation• Aufgabe: SIEINAUS Signal 25ms
ein – 25ms aus, P1.1• Programmierung von CCEN
=E/A-Einheit (nicht im Buch )
Seite 118Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcVorgehenswei
se• Test im Simulator• Test auf Euro 535• Test mit Oszi an Port 1.1• Port 1.1 ist Pin
Seite 119Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcCompare
T2• mov CCEN, #00001000b
Seite 120Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Frédéric Ablitzer21.11.2006
Seite 121Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcKleine Aufgabe
• Wie weit kommen Sie, wenn Sie mit 100km/h fahren und eine Zeit von 65ms zu Verfügung haben?1,8m
Seite 122Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcKleiner
Tipp• Keine Umlaute, keine Accents in
Dateinamen Internet nur ASCII
Seite 123Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcEinfachere
Aufgabe• Aufgabe Rechteckgenerator
AUREGE:• CC1 mit FE08 laden• Das Reload Register mit FE00 laden• Timer 2 im Reload Betrieb mit 1 µs
zählen lassen
Seite 124Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Slawa Knorr
26.11.06
Seite 125Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcAnimation
T2• Die Zahlenwerte wurden von der
Animation T2 übernommen
Seite 126Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcAufgabe-
Pause• AUREGE11 gleich AUREGE mit
Puls_Pausenverhältnis 1:1 programmieren
Seite 127Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Martin Schmid
28.11.2006
Seite 128Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcKunst der µ-C-
Prog• Einstellung der Hardware durch
Software• Konfigurieren der Hardware• Beispiel für Korrektur
Seite 129Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc10 Punkte für
AUREGE• FUNKTIONALITÄT• WARTBARKEIT=DOKUMENTATION• 3 PUNKTE FÜR PDL
– PRINZIPIELLER ABLAUF
• 5 PUNKTE – EINSTELLUNG DER REGISTER
• 2 PUNKTE FÜR RESTPROGRAMM
Seite 130Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc PDL• Timer 2 initialisieren:
– PWM an P1.1– P1.1 als Ausgabe CCEN– Periodendauer CRC– Einschaltzeitpunkt CC1
• T2-zählen• T3-stop
Seite 131Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcPortbelegungspl
anPort/Pin Ein-/
AusgangBemerkung
P1.1/C13 Ausgang PWM
P1.2 Eingang T2
P1.3 Eingang T3
Seite 132Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc4.12.200
6• Daniel & Daniel• Nicolas (Eagle) & Konstantin• [email protected]• Montag 14:00• Donnerstag 14:00
Seite 133Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Pierre Deneffle4.12.2006
Seite 134Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcTimer
2• Nach Initialisierung wird der
Prozessor minimal belastet. Kleiner als 1 %.
Seite 135Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcProzessorla
st• Beispiel PC Task Manager• Beispiel mittlere Temperatur• 5 Befehle für ISR_2• 14 Befehle Interrupt-Routine• ca. 20 Befehle pro Messung• Insgesamt 20 Messungen pro
Sekunde
Seite 136Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcProzessorlas
t2• 20 x 20= 400 Befehle pro Sekunde• Abschätzung pro Sekunde 500 000
Befehle -> 0,08 % Prozessauslastung
• Ab 30% Prozessorauslastung wird es kritisch
Seite 137Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcProzessorlas
t3• Wird der Prozessor über 30%
belastet --> anderen Prozessor wählen.
• Prozessorauslastberechnung an durchgeführten Programmen üben
Seite 138Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcÜbergabe MC-
PC• Serielle Schnittstelle• SBUF Register der Serielle
Schnittstelle• Mov SBUF,A ;Sendebetrieb• Mov A,SBUF ;Empfangsbetrieb
Seite 139Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc CPL
• CPL Complement
Seite 140Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcSerielle
Schnittstelle• Beide Seiten müssen mit der
gleichen Bitrate arbeiten.
Seite 141Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Simeon Meier
05.12.06
Seite 142Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcSerielle
Schnittstelle• TxD Transmit Data• RxD Receive Data • GND• RS232C – V.24 – 12V Pegel• RS422 differentielle serielle
Schnittstelle
Seite 143Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcSerielle
Schnittstellen• USB 2.0 (480 Mbit/s)• 8 Mbit/s bsp. Fernsehbild (HDTV)
Seite 144Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcStandardeinstellu
ng• 9600 bits/s • 8 Datenbits• Parität keine (Datensicherung)
– Im PSW (Programm Status Wort)
Seite 145Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcParity
(Paritaet)• T1 Akkumulator wird mit A5H
geladen• T2 Akkumulator wird mit 5BH
geladen• Mov A, #const8
Seite 146Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcEmpfehlung
Ports• Port 4 und 5 sind frei• Port 6 A/D-Wandlung• Port 3 alternative Funktion• Port 0 und 2 16bit Adresse für
externen Speicher• Port 1 PWM-Timer2
Seite 147Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcAufbau serielle
Schnittstelle• Users Manual Seite 59• Blockschaltbild der seriellen
Schnittstelle
Seite 148Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcTimer0 &
Timer1• Sehr leicht, wenn man Timer2
verstanden hat
Seite 149Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Hanno Schneider11.12. 2006
Seite 150Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcBlinklic
ht• Timer 0 mit Interrupts verwenden• TF0-Flag wird automatisch durch
Hardware zurückgesetzt, sobald die Interrupt-Service-Routine ausgeführt wird
• TF2-Flag muss per Software zurückgesetzt werden.
Seite 151Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcProzessorauslastu
ng• Wieviel Prozent der Prozessor-
Zeit wird für Timer0 benötigt • 0,1 Promille belastet• Ändern sie die Blinkfrequenz:
– *2– /2
Seite 152Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcTemperaturmessu
ng• SMT-160• Timer2 läuft vor sich hin
– Kein Reloadbetrieb• I3FR = 1 steigende Flanke• I3FR = 0 fallende Flanke• Anschluß an Port 1.0
Seite 153Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc PWM Timer2
Seite 154Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc Duty Cycle
• Taktverhältnis bei der Pulsweiten Modulation
ycle)tnis(DutyCTaktverhäl
Impulseshigh desZeit
uerPeriodenda
p
h
h
p
t
t
t
t
Seite 155Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcAus
www.smartec.fr
Seite 156Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
Bogdan Schlesinger
12.12.2006
Seite 157Prof. J. WALTER Kurstitel Stand: Oktober 2006
mcLösung von
Aufgaben• Gibt es eine ähnliche Aufgabe?• Timer2-Einheit-P1.0
Eingang/Ausgang?• Lösung: Eingang• Hausaufgabe: SMT16032Ser
Seite 158Prof. J. WALTER Kurstitel Stand: Oktober 2006
mc
18.12.2006