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.

[SOLVED] Timer delay and minimum delay

Status
Not open for further replies.

final_destination

Newbie level 4
Joined
Oct 22, 2012
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,331
Hi Friends,


How to predicit a minimum timer delay for each microcontrollers?

how to use set 1sec timer delay in pic18 processor?


Thanks in advance!
 

A time delay of 1 sec is to be generated and a 12MHz crystal oscillator is connected with PIC.(external clock source for the controller)

mer is related to the internal frequency which is always Fosc/4.

Clock source frequency (Crystal)
Fosc = 12 MHz = 12000000 Hz

Therefore, Timer frequency :

FTimer = Fosc / 4 = 12000000 / 4 = 3000000 Hz = 3 MHz

If Prescaler = 1:256, then

FTimer = 3000000 / 256 = 11718.75 Hz

So, the time interval :

TTimer = 1 / FTimer = 1 / 11718.75 = 85 us (microseconds)

To calculate the value to be filled in Timer rolling over register to generate 1 sec delay :

No. of count for 1 sec Delay = 1sec / 85 us = 11718.75 = 2DC6H

So the value to be filled in Timer’s 16 bit register = FFFF – 2DC6
= D239

These values are filled in the Timer register and it rolls over up to FFFF. The values are reloaded again to start timer for same delay. Before filling this value timer registers should be configured as we shall see.
 
Thanks friend for your quick reply

value to be filled in Timer’s 16 bit register = FFFF – 2DC6 = D239

why did you doing this calculation ?
 

hello

Its a upcounting mechanism so, values are filled in the Timer register and it rolls over up to FFFF. The values are reloaded again to start timer for same delay

means it will start from D239--->FFFF then timer will set and produce interrupt.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top