Skip to content
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.

Commit

Permalink
Update main.asm
Browse files Browse the repository at this point in the history
  • Loading branch information
BackInBash authored Jul 16, 2021
1 parent 29886b0 commit f904e06
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions Jahr 1/MC/Programmierung/MegaParkhaus/MegaParkhaus/main.asm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; MegaParkhaus.asm
;
; Created: 02.07.2021 14:08:49
; Author : simon.stadtmueller
; Created: 16.07.2021 14:08:49
; Author : markus.brunsch
;
.INCLUDE "m16def.inc"

Expand Down Expand Up @@ -30,31 +30,53 @@ main:
in R20, PIND
andi R20, 0b00000100 ; Bit Mask Geschlossen
subi R20, 0b00000100 ; R20 - 1 = 0
brbc 1, main ; Jump if not Zero
brbc 1, closed ; Jump if not Zero

; Abgasalarm Einlesen
in R21, PIND
andi R21, 0b00001000 ; Bit Mask Abgasalarm
subi R21, 0b000001000 ; R21 - 1 = 0
brbc 1, main ; Jump If not Zero
subi R21, 0b00001000 ; R21 - 1 = 0
brbc 1, alarm ; Jump If not Zero

; Belegt Berechnen
andi R22, 0xF ; Check If R22 is 15 (ParkHaus voll)
brbs 1, einfahrt ; Jump if not full
rjmp main
brbc 1, full ; Jump if full
rjmp einfahrt

closed:
ldi R18, 0b10000000
out PORTA, R18
rjmp main

alarm:
ldi R18, 0b01000000
out PORTA, R18
rjmp main

full:
ldi R18, 0b00100000
out PORTA, R18
rjmp main

einfahrt:
out PORTA, R16 ; Clear LEDs
ldi R17, 0x00 ; Set Local
in R17, PIND ; Load Value PINA

; TasterEinfahrtZuweisung
; R17 0bX0000000
andi R17, 0b10000000
brbc 1, einfahrt ; Jump if not Zero
brbc 1, main ; Jump if not Zero

in R17, PIND
andi R17, 0b01000000
wait:
in R17, PIND ; Read Lichtschranke
andi R17, 0b01000000 ; Mask Lichtschranke
brbc 1, wait ; Loop Lichtschranke
inc R22 ; Increase Belegt Counter



;subi R17, R20 ; Einfahrt - Geschlossen
;brbc 1, R17

Expand All @@ -67,4 +89,6 @@ einfahrt:

istGeschlossen:


ausfahrt:

0 comments on commit f904e06

Please sign in to comment.