
Site Search
Alternate Blinking LED's Using Microcontroller 89C52AT, Assembly Language, Instruction XRL, Time Delay 0.25 Second

Alternate Blinking LED's Using Microcontroller 89C52AT, Assembly Language Instruction XRL, Time Delay 0.25 Second
;=================================================================
;Code Written by: Azhar Ahmed
; W W W . I A M T E C H N I C A L . C O M
;Crystal Frequency = 12MHz / 12 Machine Cycles = 1Mhz
;1/1MHz = 1 Microsecond
;(250 x 250 x 2 x 1Microsecond) x 2 times ACALL Delay = 0.25 Second
;=================================================================
ORG 0000H
MOV P1,#55H ;Load 55H in HEX or 01010101B in Binary at Port1
BACK: XRL P1,#0FFH ;EX-OR Port1 With FFH i.e. 1111 1111.XOR of 55H & FFH Gives AAH.
;Likewise, The XOR of AAH & FFH Gives 55H.
ACALL DELAY ;WAIT 0.125 Second
ACALL DELAY ;WAIT 0.125 Second
SJMP BACK ;Make This Operation to Run Repeatedly
DELAY:
MOV R0,#250 ;Initialize the R0 Register With an Immediate Value 250
NEXT:
MOV R1,#250 ;Load R0 With 250 Value to Repeat the Loop for 250 Times
AGAIN:
DJNZ R1,AGAIN ;Internal Loop Repeates 250 Times
DJNZ R0,NEXT ;External Loop Repeates 250 Times
RET ;Return to Caller
END ;End of .asm File
;==================================================================