Microprocesor

TUGAS PERTAMA 

 PROGRAM AWAL
$mod51
     CSEG
     ORG   4000H
     LJMP  START
     ORG 4100H
START:    MOV 30H,#00000001B
MOV 31H,#00000010B
MOV 32H,#00000100B
MOV 33H,#00001000B
MOV 34H,#00010000B
MOV 35H,#00100000B
MOV 36H,#01000000B
MOV 37H,#10000000B
ULANG:  MOV P1,30H
                 MOV P1,31H
ACALL TUNDA
MOV P1,32H
ACALL TUNDA
                 MOV P1,33H
                 ACALL TUNDA
                 MOV P1,34H
                 ACALL TUNDA
                 MOV P1,35H
                 ACALL TUNDA
                 MOV P1,36H
                 ACALL TUNDA
                 MOV P1,37H
                 ACALL TUNDA
                 SJMP ULANG
TUNDA:  MOV R7,#0FFh
LAGI:      MOV R6,#0FFh
SINI:        DJNZ R6,SINI
                 DJNZ R7,LAGI
                 RET
END
HASIL PENYEDERHANAAN

$mod51
                        ROM EQU 0000h
                        ORG ROM
                        LJMP MULAI
                        ORG ROM+0100
MULAI:   MOV A, #00000001b
NEXT:     MOV P1, A
                        ACALL TUNDA
                        RL A
                        CJNE A,#10000000b, NEXT
                        SJMP NEXT
TUNDA:  MOV R7,#03h
LUP1:      MOV R6,#0ffh
LUP2:      MOV R5,#0ffh
                        DJNZ R5,$
                        DJNZ R6,LUP2
DJNZ R7,LUP1
RET
END

0 Response to "Microprocesor"

Posting Komentar