BASIC2 : Menggerakkan motor stepper di PORTA->Bit 0-3


.include”m8515def.inc”
.org 0x0000
rjmp bar
bar:
ldi r16,low (RAMEND)
out SPL,r16
ldi r16,high (RAMEND)
out SPH,r16

;inis
ldi r16,0x00
out ddrc,r16 ;portC sd input
out porta,r16

ldi r16,0xff
out ddra,r16 ; portA as output low
out porta,r16
out portc,r16

ldi r19,0x08
panik: out PortA,r19
rcall tunda
ror r19
cpi r19,0x01
brne lamp1
out PortA,r19
rcall tunda
ldi r19,0x08
rjmp panik

tunda:
ldi r23,8
ldi r24,100
ldi r25,200
loop:
dec r25
cpi r25,0
brne loop

dec r24
cpi r24,0
brne loop

dec r23
cpi r23,0
brne loop
ret

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: