0% found this document useful (0 votes)
3 views1 page

Assembly Program for LED Control

This program uses registers and loops to rotate a binary number from left to right and display it on a port, with a delay between each rotation. It initializes register R1 to 5, then decrements it in a loop. It loads a 1 into register A and displays it on port 1. A subroutine is called to delay before rotating the bit in A left, displaying it, and checking if it is 80 before repeating. This continues rotating left until it reaches 1, then it rotates right and checks until it reaches the starting value, repeating the loop until R1 is 0.

Uploaded by

wirawan777
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Assembly Program for LED Control

This program uses registers and loops to rotate a binary number from left to right and display it on a port, with a delay between each rotation. It initializes register R1 to 5, then decrements it in a loop. It loads a 1 into register A and displays it on port 1. A subroutine is called to delay before rotating the bit in A left, displaying it, and checking if it is 80 before repeating. This continues rotating left until it reaches 1, then it rotates right and checks until it reaches the starting value, repeating the loop until R1 is 0.

Uploaded by

wirawan777
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

$mod51

      org 00h


      jmp mulai
 
;program dimulai di sini
mulai:
      mov r1, #05h
loop: 
      dec r1
      mov a, #01h
      mov p1, a
      call tunda
kiri:
rl a
      mov p1, a
      call tunda
      cjne a, #80h, kiri
kanan:
      rr a
      mov p1, a
      call tunda
      cjne a, #01h, kanan
      cjne r1, #00h, loop
      ljmp mulai
 
;
tunda:
      mov r4, #02h
ulang:
      dec r4
      mov r3, #0ffh
tunda1:
      dec r3
      mov r2, #0ffh
tunda2:      
dec r2
      cjne r2, #00h, tunda2
      cjne r3, #00h, tunda1
      cjne r4, #00h, ulang
      ret
end

You might also like