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.

Problem with generating 1 sec delay in PIC using mikro C compiler

Status
Not open for further replies.

salamnamste

Newbie level 3
Joined
Sep 10, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,310
i want to generate delay of 1 second using internal oscillator of 8mhz. i am using mikro C compiler and i want to use Delay_ms () function.

i set the config bit
_CPUDIV_OSC1_PLL2_1L and _FOSC_INTOSC_HS_1H

i also set the OSCCON=0x73
but the delay i more than 1 sec.
 

Re: Delay problem in pic

hi

first of all the built in delay functions are not accurate.the same case with internal oscillator also because the atmosphere can change the frequency of the internal oscillator.if you want accurate delay of 1 second,use external oscillator and timer.

regards

ml
 

Re: Delay problem in pic

for the same program if decrease the clock frequency delay increses from 1 sec. when i increase the clock delay decreases why it occurs?
i think as as we set clock frequency delay function internally set the value for each clock option and generates same delay each clock.
 

Re: Delay problem in pic

hi
when you increase or decrease the clock externally, just do it at the source program also and compile it and load it.
the program take the given clock as the ref and create a delay loop according to the same.so you have to change the clock in the source code too.
 

Re: Delay problem in pic

Hi,
How much more is it than 1 sec? It should be quite accurate if you use external oscillator. The temperature and other factors affect the internal oscillator. When you increase or decrease the clock frequency in hardware, set the appropriate clock frequency in the compiler as well so that it makes changes as necessary.

Hope this helps.
Tahmid.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top