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
- reset:
- ldi tmp, high(RAMEND)
- out SPH, tmp
- ldi tmp, low(RAMEND)
- out SPL, tmp
- ldi tmp, (1 << PD5)//pinovi
- out DDRD, tmp
- ldi tmp, (1 << 0) | ( 1 << 1) //tipkice
- out PORTB, tmp
- ldi tmp, 0x00
- out DDRB, tmp
- //fiksini 8-bitni fast pwm /8 pres
- 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
- main:
- sbis PINB, 0
- rcall inc_int
- sbis PINB, 1
- rcall dec_int
- rjmp main
- inc_int:
- ldi tmp, 0xfa //250
- in counter, OCR1AL
- cpse counter, tmp
- add counter, step
- out OCR1AL, step
- ret
- dec_int:
- ldi tmp, 0x00
- in counter, OCR1AL
- cpse counter, tmp
- sub counter, step
- out OCR1AL, step
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement