Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; ARBK_Praktikum_4_Polling.asm
- ;
- ; Definitions
- .def temp = r16
- .def leds = r17
- .def counter0 = r18
- .def counter1 = r19
- .def counter2 = r20
- ; Jump Table
- .org 0x00 ; Reset Handler
- rjmp main
- main:
- ; DDR setzen
- ldi temp,0xFF
- out DDRB,temp
- ldi temp,0x00
- out DDRD,temp
- ldi temp,0xFF
- out PORTD,temp
- ; LEDs ausschalten
- ldi leds,0x00
- out PORTB,leds
- ; stackpointer
- ldi temp,HIGH(RAMEND)
- out SPH,temp
- ldi temp,LOW(RAMEND)
- out SPL,temp
- ;blinken
- blink:
- rcall taster
- out PORTB,leds
- rcall wait
- ldi temp,0x00
- out PORTB,temp
- rcall wait
- rjmp blink
- ; taster auswerten
- taster:
- in temp,PIND
- cbr temp,251
- cpi temp,0
- breq ledR
- in temp,PIND
- cbr temp,247
- cpi temp,0
- breq ledY
- ret
- ledY:
- cpi leds,0x02
- breq turnoff
- ldi leds,0x02
- ret
- ledR:
- cpi leds,0x01
- breq turnoff
- ldi leds,0x01
- ret
- turnoff:
- ldi leds,0x00
- ret
- ; warten
- wait:
- inc counter0
- cpi counter0,0xFF
- brlo wait
- inc counter1
- cpi counter1,0xFF
- brlo wait
- inc counter2
- cpi counter2,0x07
- brlo wait
- ldi counter0,0x00
- ldi counter1,0x00
- ldi counter2,0x00
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement