help for 1second timer

Thread Starter

dileepchacko

Joined May 13, 2008
109
Hi All

I am very new to micro controller 8051. I want to generate a 1second time delay in assembly language for 8051 micro controller. This time delay is for making a digital clock using 8051. Can anybody help me to write a code for generating an 1second time delay in assembly language.
 

Arm_n_Legs

Joined Mar 7, 2007
186
; 8051 on 12MHz
; Initialise timer 1 and run it
MOV TMOD,#10H

MOV R1,#20D
ABC:
MOV TH1,#3CH
MOV TL1,#B0H
SETB TR1
WAIT:
JNB TF1,WAIT ; Timer overflow in 50ms
CLR TF1
DJNZ R1,ABC ; Loop 20 times

There will be some inaccuracies in term of usec because
the program ignore time taken to execute the instructions.
 
Top