Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : measuring 32kHz crystal
Author | Message | ||||
robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2289 |
today i've been playing around with the free online circuit simulation (spice) tool here: http://easyeda.com unlike many other online offerings, this one seems to still be free. the only other free one i found was PartSim, which lacked a crystal component (the part i wanted to experiment with). btw, these online spice tools are all, essentially, just a front end for ngspice. i'm not sure how many of them even run their own backend. i wanted to look at ways to use a micromite to measure the frequency of a 32kHz watch crystal, using the minimum number of components. if the micromite can measure the crystal frequency, the result will provide a correction factor for the onboard RC oscillator and allow improved timing. it will not be perfect, but for many applications will be ok. the circuit i simulated is this simple one: with the following, quite pleasing, results: this suggests that if one were to feed one of the PWM outputs to the input, scanning over the range of 32768Hz +/- 1%, it should be possible to detect at the output (using a second pin) the two (fairly symmetrical) edges shown of the graph. even if just using a digital input, the interval is likely to be a few dozen Hz wide - the target frequency will be the average of the two detected edge points. any thoughts? cheers, rob :-) |
||||
skyline_stu Newbie Joined: 04/01/2015 Location: AustraliaPosts: 12 |
Perhaps use the counting command over a couple of seconds and do an average from the returned value? Or generate a Cfunction [which is faster and probably more accurate] Stu Fast, Cheap, Reliable. Pick any two. AND The satisfaction of a cheap job is long forgotten whilst the bitterness of poor quality remains ! |
||||
Print this page |