Pages

10.7.12

microcontroller At89s51 simple program


gambar minimum system pada isis proteus 7.2

program assembler menggunakan M-IDE studio for MCS51


org 0h
Ajmp main
Org 03h
Ajmp mode1
Org 13h
Ajmp mode2

main:
setb ea
setb ex0
setb ex1
mov p1,#10111111b
mov p0,#01010101b
sjmp main

mode1:
mov p1,#00000110b
call delay
mov p1,#01011011b
call delay
mov p1,#01001111b
call delay
mov p1,#01100110b
call delay
mov p1,#01101101b
call delay
mov p1,#01111101b
call delay
mov p1,#00000111b
call delay
mov p1,#01111111b
call delay
mov p1,#1101111b
call delay
reti

mode2:
mov A, #00000111b
kiri:cjne A,#11100000b,left
sjmp kanan
left:mov p0,A
RL A
call delay
sjmp kiri
kanan: cjne A,#10000011b,right
sjmp exit
right:mov p0,A
RR A
call delay
sjmp kanan
exit:
reti

delay:
mov R1, #0ffh
del1: mov R2,#0ffh
del2: mov R3,#5
del3: djnz R3,del3
djnz R2,del2
djnz R1,del1
ret
end

No comments:

Post a Comment