Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Limitation of PIC16F876A

Status
Not open for further replies.

ealee264

New Member
Hi all, im new at PIC and facing problem from the time response of PIC.

How fast does PIC 16F876A response?..I am facing a problem of uncertain time of operation from PIC. THe operation is as follow:

1.) PIC wake up from sleep through interrupt at the comparator pin
2.) Once wake up, the PIC would light up a LED

The time between wake up and light up a LED varied from 30us to 60 us. What could be the cause of this uncertainty.

Furthermore, this uncertainty is of us range...

Pls help .:(
Thanks in advance
 
It's got to wait for the external crystal oscillator to stabilize.

Thanks for reply. Yea, but why didnt the time is constant?..I refer to the data sheet, the time for the oscillation to stable is 1024Tosc. Which is around 51.2 us.

Another circuit of mine, which have the same function does not have such problem..What are the possible cause for such uncertainty?..

Thanks in advance
 
Last edited:
The start up times should be listed in the PDF, but there's a high degree of uncertainty to them. I'm not sure how easy it is to change the clock speed dynamically on a PIC but if you want to lower power usage without turning the clock off just switch to the internal oscilator with the highest prescaler you can. The slower the pic runs the less power it uses. This may or may not be acceptable for your application though.
 
When a crystal is first started up it's very unstable, it needs time to settle, that time has a high amount of randomness to it.
 
Thanks for reply. Hmmmm..Is there any document that i could read about on the randomness of the oscillation to become stable?

I really have to put the PIC into sleep. Is not for power saving purposes. BUt is for turning the oscillator off. I wanted to calculate the time of flight of RF wave thus if i dint turn off the PIC the sampling rate would be of 200ns. This is not desirable...

One weird thing is, one of my circuit which used the sleep instruction as well does not have such problem..Could it be the difference in stray capacitance in the circuit larger than the working circuit till the choice of capacitor for the crystal is wrong?..I have not tried it though...

PLs advise..
 
Could be ealee, if the oscillator is loaded it'll take it longer to start up. Nigel is right though measuring the time of flight of RF on a pic is not particularly practical unless you're talking extremely long distances. If your pic is running at 20mhz, you have a clock of 5mhz, even if you could somehow send and detect RF signals perfectly you would have a granularity of 60meters and the minimum distance you could detect would be at least several hundred meters. I've thought about doing a time domain reflectometer for fun with an AVR, a 20mhz AVR would have a granularity of about 15 meters, with a minimum distance of 50 or so.
 
Last edited:
Actually, I somehow think PIC cannot achieve the objective i wanted to achieve. Regarding the accuracy, I have a Time Delay element which is MAxim DS1124 of accuracy 0.25ns which allow me to calculate the distance up to 3.5 cm provided all propagation delay in the circuit is constant..

Is there any document i can read on to get more information on the distribution of the response time..For instance, the time for oscillation to stablize is stated to be 1024 Tosc but how it would varied in practically.

Or is the project still feasible?..

Pls advise.

Thanks in advance
 
Actually, I somehow think PIC cannot achieve the objective i wanted to achieve. Regarding the accuracy, I have a Time Delay element which is MAxim DS1124 of accuracy 0.25ns which allow me to calculate the distance up to 3.5 cm provided all propagation delay in the circuit is constant..

Is there any document i can read on to get more information on the distribution of the response time..For instance, the time for oscillation to stablize is stated to be 1024 Tosc but how it would varied in practically.

Or is the project still feasible?..

I don't think it ever was?.

I still don't see the reason for sleep, and how it helps you?.
 
To measure the time of flight accurately, i need the PIC to off the oscillator so that when the PIC only wake up when the wave arrive. If PIC is not in sleep mode, the sampling rate would be 200ns....But the choice of using sleep might be wrong since the uncertainty in stabilizing the oscillator is so great,,,,
 
Use a sleep mode that doesn't turn off the oscillator, it will wake up very fast.
 
Sleep always shuts down the oscillator.
Now you could use an external oscillator instead of a crystal. That would not have the start up delay.

If you need more speed a really fast 24H and use a capture module.
 
Last edited:
External oscillator?..Do u mean RC oscillator?..But from the datasheet. RC oscillator will have frequency that will vary with parameter of C and R as well as temperature...Wil this give uncertainty as well?..
 
PICs don't have any idle modes that leave the local oscillator running?
 
To measure the time of flight accurately, i need the PIC to off the oscillator so that when the PIC only wake up when the wave arrive. If PIC is not in sleep mode, the sampling rate would be 200ns....But the choice of using sleep might be wrong since the uncertainty in stabilizing the oscillator is so great,,,,

I still fail to see how that helps?, PIC's don't wake up from sleep terribly fast.

If all you're wanting to do is light an LED, why not just do it in hardware? - although I fail to see the reasoning behind the LED as well.
 
=.=''. I am not rich,, dun think i can afford that in my project...yea..PIC indeed wont wake up from sleep fast..just that i dun understand the time between PIC wake up and the first instruction it run can be so different for everytime it run...

I am using a delay element in my project, this delay would be representing the time of flight of the RF wave. I would run a counter to cancel the propagation delay in the circuitry. Once all the propagation delay is cleared, i will send a signal A to the delay element. After delay for T0 ns, the signal A will be at the output pin. The PIC would read this output once it wake up from sleep. If the output is zero, this indicates that the time of flight is shorter than the time delay set, but if the output is A, this indicates the time of flight is longer that the time delay set.

By using successive approximation, correct delay can be determined and this would be the time of flight...I used LED as indicator, just to see how fast does the PIC react after wake up from sleep
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top