Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;
- ; Zadatak1.asm
- ;
- ; Created: 9.12.2018. 20:08:56
- ; Author : Maja Vrsaljko
- ;
- .def tmp = r16
- .def counter = r17
- .def step = r18
- .cseg
- rjmp reset
- /*
- .org $002
- rjmp inc_int
- .org $004
- rjmp dec_int
- */
- reset:
- ldi tmp, high(RAMEND)
- out SPH, tmp
- ldi tmp, low(RAMEND)
- out SPL, tmp
- ldi tmp, (1 << PD5)//pin
- out DDRD, tmp
- ldi tmp, (1 << 0) | (1 << 1)
- out PORTB, tmp //tipkice
- ldi tmp, (1 << COM1A0) | (1 << COM1A1) | (1 << WGM10)
- out TCCR1A, tmp
- ldi tmp, (1 << CS11) | (1 << WGM12)
- out TCCR1B, tmp
- ldi tmp, high(200)
- out OCR1AH, tmp
- ldi tmp, low(200)
- out OCR1AL, tmp
- ldi step, 0x05
- /*
- ldi tmp, (1 << ISC01) | (1 << ISC11)
- out MCUCR, tmp
- ldi tmp, (1 << INT0) | (1 << INT1)
- out GICR, tmp
- sei
- */
- main:
- sbis PINB, 0
- rcall inc_int
- sbis PINB, 1
- rcall dec_int
- rjmp main
- inc_int:
- ldi tmp, 250
- in counter, OCR1AL
- cpse counter, tmp
- add counter, step
- out OCR1AL, counter
- //reti
- ret
- dec_int:
- ldi tmp, 0
- in counter, OCR1AL
- cpse counter, tmp
- sub counter, step
- out OCR1AL, counter
- //reti
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement