Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;SATA 1.FELADAT
- .include "m128def.inc"
- .macro portinit
- ldi a,0xFF
- out DDRA,a
- ldi a,0xF0
- out DDRB,a
- ldi a,0xF8
- out DDRC,a
- ldi a,0xF0
- out DDRD,a
- ldi a,0xFC
- out DDRE,a
- ldi a,0x0E
- clr a
- sts DDRG,a
- .endmacro
- .macro stackinit
- ldi a,LOW(RAMEND)
- out SPL,a
- ldi a,HIGH(RAMEND)
- out SPH,a
- .endmacro
- .def a=r16
- .def led=r17
- .org 0
- rjmp start
- .org 0x100
- ;---------------------------------------
- start:
- portinit
- stackinit
- gombok:
- lds a,PING
- sbrc a,0
- rjmp G0
- rjmp gombok
- G0:
- ldi a,12
- mov r2,a
- ldi a,3
- mov r12,a
- osztas:
- sbc r2,r12
- ; mov a,r2
- ; cpi a,0
- breq oszthato
- brcs nemoszthato
- rjmp osztas
- oszthato:
- ldi led,3
- call ledout
- nemoszthato:
- ldi led,4
- call ledout
- ;---------------------------------------
- ledout:
- out PORTD,led
- swap led
- out PORTB,led
- swap led
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement