1 / 27

Labor Mikrocomputertechnik

Labor Mikrocomputertechnik. Spielzeugsortierer. Dozent: Prof. J. Walter Betreuer: W. Loes Gruppe: 12 Teilnehmer: Fadoua Akoucham Rick Hauschwitz. Gliederung. Problemstellung / Aufgabenstellung Black Box Schaltplan Struktogramm Quellcode Vorführung. Problemstellung:

buck
Download Presentation

Labor Mikrocomputertechnik

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Labor Mikrocomputertechnik Spielzeugsortierer Dozent: Prof. J. Walter Betreuer: W. Loes Gruppe: 12 Teilnehmer: Fadoua Akoucham Rick Hauschwitz

  2. Gliederung • Problemstellung / Aufgabenstellung • Black Box • Schaltplan • Struktogramm • Quellcode • Vorführung

  3. Problemstellung: • durch Spielen entsteht Unordnung • einzelne Spielsachen müssen in Handarbeit voneinander getrennt werden • Aufgabenstellung: • Entwicklung eines Geräts zum automatischen Trennen von 2 unterschiedlichen Spielsachen

  4. Blackbox

  5. Schaltplan

  6. Struktogramm

  7. ;-----------------------------------------------------------------------------------------------------------------------------------------------------------;Programmbeschreibung;----------------------------------------------------------------------------------------------------------------------------------------------------------;-----------------------------------------------------------------------------------------------------------------------------------------------------------;Programmbeschreibung;---------------------------------------------------------------------------------------------------------------------------------------------------------- Pulsweitenmodulation und 3sec.warten  TIMER 2 Frequenz der Sendediode  TIMER1 Automatisches Ausschalten des Sortierers  TIMER0

  8. ;Interrupts;----------------------------------------------------------------------------------------------------------------------------------------;Interrupts;---------------------------------------------------------------------------------------------------------------------------------------- ;------------------------------------------------------------------------ ;Interrupt Timer0 ;----------------------------------------------------------------------- ORG 000BH ;Interrupt-Vektor T0 clr TF0 ;Flag erkannt call ENDE ;Rufe Interrupt Service Routine auf reti ;------------------------------------------------------------------------ ;Interrupt Timer1 ;------------------------------------------------------------------------- ORG 001BH ;interrupt-Vektor T1 clr TF1 ;Flag erkannt call SENDEDIODE ;Rufe Interrupt Service Routine auf reti ;------------------------------------------------------------------------ ;Interrupt Timer2 ;------------------------------------------------------------------------ ORG 002BH ;Interrupt-Vektor T2 clr TF2 ;Flag erkannt call Linksstellung ;Rufe Interrupt Service Routine auf reti

  9. Struktogramm

  10. ;------------------------------------------------------------------------------------------------------------------------------------;Initialisierung der Timer 0,1,2;-------------------------------------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------------------- ;Timer 0 /TIMER 1 ;----------------------------------------------------------------------------------------------------------------------- mov TMOD,#00100001b ;16 bit timer/counter --> TIMER0 ;8 bit reload timer --> TIMER1 mov TH0,#00h ;LICHTS_H in TH0 laden mov TL0,#00h ;LICHTS_L in TL0 laden clr TF1 ;TIMER1 Flag löschen mov TH1,#0F0h ;FREQUENZ_DIODE in TH1 laden ;------------------------------------------------------------------------------------------------------------------------ ;TIMER2 ;------------------------------------------------------------------------------------------------------------------------ mov T2CON,#00010001B ;Timer2 Einstellung:Timer mit f=f(osz)/12 ;Mode 0 ->Reload bei Ueberlauf mov CCEN,#00001000B ;Compare Mode des CC1 freigeben mov CRCH,#0B1H ;High Byte von Compare Reload Capture mov CRCL,#0E0H ;Low Byte von Compare Reload Capture mov CCL1,#01EH ;Pulsweitenmodulation Anfangswert mov CCH1,#0FBH

  11. Bsp.: TIMER 0 Sortierer soll nach 16sec. Wartezeit stoppen  16 000 000 µsec 16 000 000 µsec/65536 ≈ 245  Anfangswert des TI0 ist #0000h und des Registers R1 #245d

  12. ;------------------------------------------------------------------------------------------------------------------------------------;Initialisierung der Timer 0,1,2;-------------------------------------------------------------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------------------------------------------- ;Timer 0 /TIMER 1 ;----------------------------------------------------------------------------------------------------------------------- mov TMOD,#00100001b ;16 bit timer/counter --> TIMER0 ;8 bit reload timer --> TIMER1 mov TH0,#00h ;LICHTS_H in TH0 laden mov TL0,#00h ;LICHTS_L in TL0 laden clr TF1 ;TIMER1 Flag löschen mov TH1,#0F0h ;FREQUENZ_DIODE in TH1 laden ;------------------------------------------------------------------------------------------------------------------------ ;TIMER2 ;------------------------------------------------------------------------------------------------------------------------ mov T2CON,#00010001B ;Timer2 Einstellung:Timer mit f=f(osz)/12 ;Mode 0 ->Reload bei Ueberlauf mov CCEN,#00001000B ;Compare Mode des CC1 freigeben mov CRCH,#0B1H ;High Byte von Compare Reload Capture mov CRCL,#0E0H ;Low Byte von Compare Reload Capture mov CCL1,#01EH ;Pulsweitenmodulation Anfangswert mov CCH1,#0FBH

  13. Struktogramm

  14. ;---------------------------------------------------------------------------------------------------------------------------------------;Start durch Tastendruck;--------------------------------------------------------------------------------------------------------------------------------------- AN: setb TR1 ;Timer 1 starten setb TR0 ;Timer 0 starten setb P4.0 ;LED "Start" an mov CCL2,#0BAH ;Sortierfinger links mov CCH2,#0FAH ;1,35ms Pulsweite

  15. Struktogramm

  16. ;---------------------------------------------------------------------------------------------------------------------------------------;Signalabfrage;---------------------------------------------------------------------------------------------------------------------------------------;---------------------------------------------------------------------------------------------------------------------------------------;Signalabfrage;--------------------------------------------------------------------------------------------------------------------------------------- START: jb EMPFAENGER,LICHTSCHRANKE ;Signal Empfänger -> Sprung jnb HALLSENSOR,WEICHE ;Signal Hallsensor -> Sprung jnb STOPP_TASTE, STOPP ;Signal Stopptaste -> Sprung jmp START

  17. Struktogramm

  18. ;---------------------------------------------------------------------------------------------------------------------------------------;Lichtschranke;--------------------------------------------------------------------------------------------------------------------------------------;---------------------------------------------------------------------------------------------------------------------------------------;Lichtschranke;-------------------------------------------------------------------------------------------------------------------------------------- LICHTSCHRANKE: mov R1,#245d ;245 in Register 1 laden clr TR0 ;Timer0 stoppen mov TL0,#00H ;Anfangswerte des Timers 0 mov TH0,#00H setb TR0 ;TIMER 0 wieder starten clr TF0 jmp START ;Sprung in Hauptschleife

  19. Struktogramm

  20. ;----------------------------------------------------------------------------------------------------------------------------------------;HALLSENSOR;---------------------------------------------------------------------------------------------------------------------------------------;----------------------------------------------------------------------------------------------------------------------------------------;HALLSENSOR;--------------------------------------------------------------------------------------------------------------------------------------- WEICHE: mov CCH2,#0FCh ;Sortierfinger ;rechter Anschlag mov CCL2,#018h ;1ms Pulsweite setb F0 ;Flag setzen jmp START

  21. ;-------------------------------------------------------------------------------------------------------------------------------------;------------------------------------------------------------------------------------------------------------------------------------- ;Interrupt Service Routine ;-------------------------------------------------------------------------------------------------------------------------------------- Linksstellung: ;ISR Timer 2 jnb F0, FERTIG ;Flag gesetzt? djnz R4, FERTIG clr F0 ;Flag rücksetzen mov CCL2,#0BAH ;Sortierfinger links mov CCH2,#0FAH ;1,35ms Pulsweite mov R4,#150d ;150 in Register R4 FERTIG: ret

  22. Struktogramm

  23. ;----------------------------------------------------------------------------------------------------------------------------------------;Stopptaste;---------------------------------------------------------------------------------------------------------------------------------------;----------------------------------------------------------------------------------------------------------------------------------------;Stopptaste;--------------------------------------------------------------------------------------------------------------------------------------- STOPP: mov CCL2,#082H ;Anfangsstellung Mitte mov CCH2,#0FBH ;1,1ms Pulsweite clr TR0 ;TIMER 0 stoppen clr TR1 ;TIMER 1 stoppen clr LED_START ;LED_START aus clr LED_FERTIG ;LED_FERTIG aus jmp ABFRAGE

  24. Struktogramm

  25. ;-------------------------------------------------------------------------------------------------------------------------;------------------------------------------------------------------------------------------------------------------------- ;Interrupt Service Routine ;-------------------------------------------------------------------------------------------------------------------------- ENDE: ;ISR Timers 0 djnz R1,UP5 mov R1,#245d ;245 in Register 1 mov CCL2,#082h ;Anfangsstellung Mitte mov CCH2,#0FBh ;1,1ms Pulsweite clr TR1 ;TIMER 1 stoppen clr TR0 ;TIMER 0 stoppen clr P4.0 ;LED_START aus setb P4.1 ;LED_FERTIG an jmp ABFRAGE ;SPRUNG UP5: ret

  26. Verbesserungen • Antrieb  stärkere Spannungsversorgung • besseren Sensor  z.B.: Induktiver Sensor • Aufbewahrung der Spielzeuge  z.B.: Trichter

  27. Vielen Dank für die Aufmerksamkeit

More Related