Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

To generate 1 min delay in 8051

Status
Not open for further replies.

Shikhakhushu

Newbie level 3
Joined
Mar 12, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,307
Hello ,I want to generate 1 min delay in 8051 in assembly language.Can any one help me in this?
 

I m able to generate till 9sec Since register limit is 8 bit.
For 1 min ,I need two registers so as to create 1 min delay. Like R0=210& R1=8
But I m not able to form a loop.
 

Code:
DELAY: MOV R0, #8
HERE1: MOV R1, #210
HERE2 DJNZ R1, HERE2
DJNZ R0, HERE1
RET
--
Amr Ali
 

This is the code required by the author, He did not specify his clock. I guess he knows it
Please read his post.
--
Amr Ali
 

just do a 1 second delay and call it 60 times.

OF COURSE, you must know the clock freq used.

a good program is called time8051. **broken link removed**

you just enter your clock speed, and the amount of microseconds, and you have the source code in assembly.
For a 60 second delay, enter 60000000 microseconds.

Here is the code output for an 11.0592 clock:


Code:
      ; INPUT CLOCK VALUE IN MEGAHERTZ...: 11.0592
      ; WANTED TIME DELAY IN MICROSECONDS: 60000000
      ; CLOCK CYCLE TIME................ : 90 ns
      ; PROCESSOR CYCLE TIME (12)....... : 1085 ns
      ; TOTAL REQUIRED CYCLES........... : 55296000
      ; TOTAL TIME (INCLUDING CALL)..... : 60000.0 mS
      ; USE THE FOLLOWING CODE:

      ...
      CALL TT0
      ...
      ...

TT0:MOV   VAR4,#2
      MOV   VAR3,#166
      MOV   VAR2,#223
      MOV   VAR1,#117

TT1:DJNZ  VAR1,TT1
      DJNZ  VAR2,TT1
      DJNZ  VAR3,TT1
      DJNZ  VAR4,TT1
      RET

rename "var" to r.
I would then run the code with an 8051 simulator to verify that it is correct.

Good Luck
 

Hey guys I tried al ur ways but didnt able to generate 1 min delay.
My clock freq is11.0592 .Below mention code is working for 5 seconds delay.
Actually I want to make a timer which ll be on an instant and will be of after 5min or 5 days. So looking for ur help.

MOV TMOD,#10H
RPT: MOV R0,#140

CPL P1.4
BACK:MOV TL1,#00H
MOV TH1,#00H
SETB TR1
AGAIN:JNB TF1,AGAIN
CLR TR1
CLR TF1
DJNZ R0,BACK

SJMP RPT
END
 

is there any software to get precise time delay in SDCC
in asm code we can count machine cycle and do it and for fine tuning we can add "nop"

for asm we have
a good program is called time8051. **broken link removed**

can some one tell me same for SDCC


for Shikhakhushu:
for very large delay you can use RTC
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top