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.

My project's run too fast

Status
Not open for further replies.

macobt

New Member
heloo to all
I have made binary clock and works fine with batery suplay but conect to a AC line with transformer 12volts and regulator Lm7805 the clock is runing a faster,also and my thermometar works with few degrees more,for both projects I have use PIC16F84A.HERE IS PICTURES OF MY PROJECTS.Please told me some solution for my problem.thanks a lot too all.
regards macobt
 

Attachments

  • 98_1235944728.jpg
    98_1235944728.jpg
    51.5 KB · Views: 188
  • thermometer.gif
    thermometer.gif
    11.6 KB · Views: 173
What is the voltage of the battery you are using? Where does the battery connect in your schematics? ie: Does the battery power go through the 7805 also?
 
the clock with batery 3.7volt works great and dont miss a seconds,when I conect the clock to DC power 5volt than my binary clock work faster,and in 10min is faster for 2second, I dont know why?
 
You are probably over driving the crystal. I find your code code hard the follow as I can't read Polish or whatever language it is in, but since the code runs fine at 3.7V, is sounds like a hardware issue anyway. If you are using a 32.768 kHz crystal you should read this application note. The choice of capacitors and resistor values is dependent upon the type of crystal you are using.
Another solution is simply to use a LM317 regulator set to 3.7V instead of the 7805.
 
Last edited:
It is probably the crystal as kchriste points out but you may have an additional problem. In your ISR you are using 5 levels of stack and I'm not sure how many levels in your main code but it looks like 2 or 3. If it is 3 then you will get random crashes when the stack overflows. You also don't save STATUS in your ISR.

It may be worth trying changing the config to _XT_OSC.

Mike.
 
Last edited:
When I conect to DC power with LM317 3.7volts adjustment,yhe binary clock works great,but when I adjuste too 5 volte than clock speed up,what is teh problem,my hardware is ok.
 
In your ISR you are using 5 levels of stack and I'm not sure how many levels in your main code but it looks like 2 or 3.

I would seriously suggest not calling subroutines at all from within an ISR - as you say Pommie, it's a risky business, and best avoided.
 
Last edited:
Yes, very risky, I didn't check his background code very well but it looks to be using 3 levels. Combined with the 5 from the interrupt and the interrupt itself that makes 9. And it only ever uses 9 when the tens of hours changes. A very nasty bug to try to find.

Mike.
 
Last edited:
Yes, very risky, I didn't check his background code very well but it looks to be using 3 levels. Combined with the 5 from the interrupt and the interrupt itself that makes 9. And it only ever uses 9 when the tens of hours changes. A very nasty bug to try to find.

Yes, ISR's need to be 'write and forget', completely transparent to the main routine - if you're using stack space during it, you can't do that.
 
Do you have a frequency counter and/or an oscilloscope? If you do, check the crystal's frequency at both 3.7V and 5V to see if it is changing. With a scope you can tell if the waveform is clean too.

If you don't have an oscilloscope... well, get one. :)
 
Thanks gays for replays,but problem is still here,I connect the clock to DC power regulated with LM317 too 3.7volts and works fine,but when I adjuste too 5 volts then clock work faster,I have change 3 crystals,and I have the same problem with my PIC16F84 thermometar also shown few degrees more when I connect to 5 volts(with 3.7volt works great)I dont know where is problem?????
 
For the clock, did you try _XT_OSC in the config? You could also try putting a resistor (say, 1k) between OSC2 and the crystal. Also, are you using a parallel cut or series cut crystal? Most PICs are designed for parallel cut.

For the thermometer, how are you measuring the temperature? Are you doing an A/D conversion via timing the charging of a capacitor? This could be affected by the crystal speed being "off" as well, or with a higher Vdd, the cap would charge faster, resulting in your readings being off.
 
Last edited:
In config I set the XT_OSC,I am go too put 1K resistor to crystal,for thermometar can you post me some schematic how to get A precision reference?
Regards macobt
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top