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.

programming 8051 timer

Status
Not open for further replies.

kyrietec

Member level 4
Joined
Sep 25, 2012
Messages
78
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Nigeria
Activity points
1,684
Xtal=11.0592MHz,time delay of 5ms(milliseconds).solution 11.0592MHz/12 ,the counter counts up every 1.085us.clocks= 5ms/1.085us =4608 clocks,TL and TH the value 65536-4608 =60928=EE00H.TH=EE.Assuming I want time delay of 360 seconds how can I calculate it using this formula
 

The formula remains the same, but the count that will result from the calculation will be more than that the timer registers can hold. So it is not possible without looping a certain delay.
Also if you need an accurate delay, the you need to calculate the looping overhead also.
 

Thanks!How can I calculate for looping overhead
 

Which language are you using, assembly language or C language, for coding..??

-> In assembly it is easy, as the the instruction and the machine cycles(hence time taken) to execute can be easily calculated for the looping instructions (Jump, reload the values etc ..)
-> If you are using C language, go for some compilers like Keil and use the disaasembly for getting the equivalent assembly code for your C instructions, and then do the calculations.

Eg:
1) mov a,#23
2) label: dec a
3) jnz label

Here you can see that instructions 2,3 will execute 23 times and the 1st instrcution will execute only once. So based on the machine cycles and the no. of times the instruction executes, you can calculate the delay.
This was just an example, you have to use the timer delay in a loop.
 

I'm using ASM .Pls help me for 120 seconds delay using that formula .
 

Using timer we can get a maximum delay of 65536 us. Divide 120 sec with this a use a jump statement to configure it again.

again:
mov a,#count
configure timer
start timer
timer expire: goto again
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top