Jumat, 04 Desember 2009

DJNZ instruction

contoh : flip - flop ( 1- 1)

utama :
mov sp, #50 H
loop :
mov R 05H

loop 1 :
mov p1, #11111110b
call delay
mov p1, #11111101b
call delay
mov p1, #11111011b
call delay
mov p1, #11110111b
call delay
mov p1, #11101111b
call delay
mov p1, #111011111b
call delay
mov p1, #110111111b
call delay
mov p1, #101111111b
call delay
mov p1, #011111111b
call delay
DJNZ R0, loop 1
( Ro jika blm 0 maka akan ke awal loop 1 )

loop 2 :
mov p1, #11111110b
call delay
mov p1, #01111111b
call delay
DJNZ R0, loop2
LJMP loop 2
RET

Tidak ada komentar:

Posting Komentar