Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

delay ranging from 100us to 1 sec

Status
Not open for further replies.

nikhil9967

Newbie level 2
Joined
Mar 1, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
Is it possible to generate a delay ranging from 100us to 1sec using pic16f877a. (The user should be able to input the value.) If yes, then how?
 

andre_teprom

Super Moderator
Staff member
Joined
Nov 7, 2006
Messages
9,200
Helped
1,142
Reputation
2,303
Reaction score
1,119
Trophy points
1,403
Location
Brazil
Activity points
53,578
If you work with a crystal multiple of 2 ( i.e. 32,768 KHz used at RTC ), yes you can obtain the exact value generating some interruption.
However, due that frequency is very slow to most applications, the best choice could be using this at external oscilator generating interrupt on pin.

+++
 

this

Member level 2
Joined
Apr 14, 2011
Messages
44
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,288
Activity points
1,630
Knowing your uC freq. you could loop doing nothing as many times as needed.
here is asm code generator for this.
Or if you're using C there's probably some delay function provided with your compiler.
Hi-tech has __delay_ms and __delay_us for example.

regards.
 

andre_teprom

Super Moderator
Staff member
Joined
Nov 7, 2006
Messages
9,200
Helped
1,142
Reputation
2,303
Reaction score
1,119
Trophy points
1,403
Location
Brazil
Activity points
53,578
Just remarking that if absolute precision be required ( i.e, to avoid cummulative error ) you also could use a crystal of 3,27680MHz - not so usual like the other used at RTC. If this oscilator inputs at a 16-Bits timer, can generate precise interruption of 10ms ( 100Hz ).


3.27680MHZ HC49U



+++
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top