Home »
Assembly Programming
,
Microprocessor Systems
,
Programming
» Assembly Program for LED Indicator
Assembly Program for LED Indicator
P1 EQU 090H
TCON EQU 088H
IE EQU 0A8H
ORG 0000H ;entry address for 8051 RESET
LJMP MAIN ;by-pass int. vector table
;===================================================================================
;ISR for INT1
;INCREASE DELAY BY 0.5 SECOND
;===================================================================================
ORG 0013H ;INT1
CJNE A, #00000100B, NOT_EQUAL
MOV A, #1
SJMP J
NOT_EQUAL:
INC A
MOV R5, A
J:
MOV R6, #0
NXT2: MOV R7, #0
N2:
DJNZ R7, N2
DJNZ R6, NXT2
RETI
;===================================================================================
;MAIN PROGRAM
;===================================================================================
ORG 0030H
MAIN:
SETB TCON.3 ;H-to-L transition
MOV IE, #10000100B
MOV P1, #0FFH
MOV A, #1
RETURN:
CPL P1.7
LCALL JUMP
CPL P1.6
LCALL JUMP
CPL P1.5
LCALL JUMP
CPL P1.4
LCALL JUMP
CPL P1.3
LCALL JUMP
CPL P1.2
LCALL JUMP
CPL P1.1
LCALL JUMP
CPL P1.0
LCALL JUMP
mov p1, #11111111b
SJMP RETURN
;===========================================================
; DELAY (0.5 SECOND)
;===========================================================
JUMP:
MOV R5, A
DELAY:
MOV R2,#4
NEXT: MOV R1,#240
AGAIN1: MOV R0, #240
AGAIN:
DJNZ R0,AGAIN
DJNZ R1,AGAIN1
DJNZ R2, NEXT
MOV R3, #4
NEXT2: MOV R4, #244
AGAIN2:
DJNZ R4, AGAIN2
DJNZ R3, NEXT2
DJNZ R5, DELAY
RET
;END OF DELAY
END
No comments:
Post a Comment
Thanks for Suggestion / Comment!
God Bless!