;THIS IS AN ASSEMBLY LANGUAGE PROGRAM FOR GENERATION OF DELAY
;FILE NAME : DELAY.ASM
;COMPILED WITH KEIL IDE
;CRYSTAL:12MHZ USED
;THIS FILE USED WHEN EVER DELAY REQUIRED
;JUST YOU HAVE TO INCLUDE THIS FILE TO YOUR SOURCE PROGRAM
; ; ;
;ALL DELAYS ROUTINES HERE
DELAY_SEG SEGMENT CODE
RSEG DELAY_SEG
;DELAY OF 1MS SUBROUTINE
DELAY1MS:
MOV R7,#250
DJNZ R7,$
MOV R7,#247
DJNZ R7,$
RET
;DELAY OF 100MS SUBROUTINE
DELAY100MS:
MOV R6,#99;1MUS
L1:
ACALL DELAY1MS ;99MS
DJNZ R6,L1;198MUS
MOV R6,#250;1MUS
DJNZ R6,$;500US
MOV R6,#147;1US
DJNZ R6,$;294US
NOP
RET;1US
;DELAY 0F 1SEC SUB ROUTINE
DELAY1S:
MOV R5,#9
L2:
ACALL DELAY100MS
DJNZ R5,L2
MOV R5,#99
L3:
ACALL DELAY1MS
DJNZ R5,L3
MOV R5,#250
DJNZ R5,$
MOV R5,#138
DJNZ R5,$
RET
Thursday, 27 September 2012
DELAY GENERATION USING ASSEMBLY INSTRUCTIONS
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment