Question about timing in PIC16F84A

Status
Not open for further replies.

seadolphine2000

Advanced Member level 3
Joined
Apr 12, 2005
Messages
880
Helped
122
Reputation
244
Reaction score
87
Trophy points
1,308
Activity points
7,372
Hi,..

I have a PIC16F84A and I made a lot of projects and they work fine except one thing which is the timming. I made a timer with 7-seg. that count till 99, I wrote the software with delay 1000msec between one count and another, but when I use a stopwatch to check the time I found that 10 counts with PIC make 21 seconds on my watch.

Any ideas why this happends.????

P.S.: I use 4MHz crystal and two 22pF capacitors.

Thanks for help.
 

Re: PIC16F84A Timming

Without knowing your code on counting time it is impossible to advice you what could be the possible problem.
If you were some µs out off the counter then this would be pretty normal deviation, but 210% fault is rather suspicous..
Regards,
IanP
 

Re: PIC16F84A Timming

Maybe you increase counter twice before time out. So your pic watch goes quickly.

regrads,
 

Re: PIC16F84A Timming

Here you are the code:
 

Re: PIC16F84A Timming

hi , sorry by my poor english

The instruction timing (for any instruction) are not equals, verify whit the datasheet, therefore and you can increase with "nop" this time. Its a common problen for me, "test and error" metod implemented for solucion.

regards
 

Re: PIC16F84A Timming

hai

for almost nearly i second delay you can use timer0 in timer mode
to generate 10.00001ms delay
you should load the value 0xd9 in TMR0
and the OPTION = 0x07
that means you are using the timer0 in timer mode with 1:256 ratio
this will work very well you will get more accurate value

best of luck
 

Re: PIC16F84A Timming

To be honest, this is not my software. I found it in a tutorial that comes with the mikrobasic program(tutorial attached). Check chapter 7

I'm trying to understand the code now, but this problem in time made me confused, I tested it again 3 times and the result was the same: 10 seconds on stopwatch = 21 seconds with PIC.

If you have some ideas about my problem, please tell me in a simple way.

Thanks to all of you.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…