Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .org 0000
- jmp START
- .org INT0addr
- jmp INT0_our
- .org INT1addr
- jmp INT1_OUR
- .def multi = r20
- START:
- ldi r16,HIGH(RAMEND)
- out SPH,r16
- ldi r16,LOW(RAMEND)
- out SPL,r16
- call INIT
- call RESET
- call KLAR
- RESET:
- clr multi
- ldi ZH, high(TIME)
- ldi ZL, LOW(TIME)
- clr r16
- st Z, r16
- std Z+1, r16
- std Z+2, r16
- std Z+3, r16
- ret
- ;----------------------------------INTERRUPTS----------------------------------;
- INT0_OUR: ;klocka
- ldi ZH, high(TIME)
- ldi ZL, LOW(TIME)
- ldi r17, $A
- ldi r18, $6
- LOOP:
- ;Sec ental
- ld r16, Z
- subi r16, -1
- cpse r16, r17
- rjmp SAVE
- clr r16
- st Z+, r16
- ;Sec tiotal
- ld r16, Z
- subi r16, -1
- cpse r16, r18
- rjmp SAVE
- clr r16
- st Z+, r16
- ;Min ental
- ld r16, Z
- subi r16, -1
- cpse r16, r17
- rjmp SAVE
- clr r16
- st Z+, r16
- ;Min tiotal
- ld r16, Z
- subi r16, -1
- cpse r16, r18
- rjmp SAVE
- clr r16
- st Z+, r16
- SAVE:
- st Z+, r16
- reti
- INT1_OUR: ;lcd timer
- out PORTB, multi
- sbrc multi, 2
- clr multi
- ;Visa siffran
- ldi ZH, high(TIME)
- ldi ZL, LOW(TIME)
- add ZL, multi
- ld r16, Z
- ldi ZH, high(TABELL*2)
- ldi ZL, LOW(TABELL*2)
- add ZL, r16
- lpm r16, Z
- out PORTA, r16
- subi multi, -1
- reti
- ;----------------------------------HELP----------------------------------;
- INIT:
- ldi r16,$FF ; 0111 1111
- out DDRA,r16
- ldi r16,$03
- out DDRB,r16
- ENABLE_INTERUPTION:
- ldi r16,(1<<INT0)|(1<<INT1)
- out GICR,r16
- ldi r16, (1<<ISC01)|(1<<ISC00)|(1<<ISC11)|(1<<ISC10)
- out MCUCR,r16
- sei
- ret
- KLAR:
- rjmp KLAR
- ;----------------------------------DATA----------------------------------;
- .org 180
- TABELL: .db $FC,$60,$DA,$F2,$66,$B6,$BE,$E0,$FE,$F6
- .dseg TIME: .byte 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement