Page 1 of 1
Feature suggestion for "Clock divider"
Posted: Fri Apr 26, 2013 11:11 pm
by GTIspirit
Instead of listing the Clock divider as CLOCK/2, 8, 32, 128, 1024 how about listing instead the appropriate timerange for the pulses?
CLOCK/128 doesn't mean anything to me since I don't know the logic behind it. How about instead listing the dropdowns as say 1-100Hz, 100-1000Hz or 1-1000us, 1-100ms, etc. Or at least give us a cheat sheet so we can know what frequency range/pulse time period is appropriate for each of these settings.
Posted: Sat Apr 27, 2013 3:28 am
by brentp
Yes! that's a great suggestion. I was searching for a better way to represent that setting.
Posted: Thu May 02, 2013 10:00 am
by GTIspirit
Good to hear this could be a future improvement.
In the meantime, which clock divider would be appropriate for a rpm signal pulsewidth of 50ms to 3.75ms? This corresponds to 600-8000rpm on my car, which is of course outside the working range of the engine.....
Just wondering if perhaps I am using the wrong clock divider because I should definitely be able to acquire the blue signal below but as I reported in my previous post it doesn't work, constant 997.
Posted: Fri May 10, 2013 3:19 pm
by decathect
I'm thinking that (divider/48000000) will tell you the minimum amount of time between pulses that can be measured.
As for maximum, it should be able to measure anything slower? I would think you'd want to set the clock divider as high as you reasonably can, based on what you're measuring, so as to not hog system resources.
So perhaps he's using a timer or other finite sized variable that overflows and can't measure your pulse speed. What prescaler are you using? Did you try a larger one? If he's using a 16-bit timer, then the slowst pulse speed that could be measured with a prescaler of 1 is:
(1/48000000)*65535 = 0.00273 = 2.73 ms.
Posted: Sun May 12, 2013 1:05 pm
by GTIspirit
I think you might be onto something. Under my thread for erratic rpm in the hardware section I had posted this comparison of measuring rpm with different clock divider settings, where the number after RPM is the clock divider setting.
When the blue signal above is used, Clock/128 is clearly the best choice for the maximum pulsewidth of 30ms at idle of 1000. (pulse per rev divider was incorrectly set to 2/rev, so calculated rpm is double what it actually was.)
Posted: Mon May 13, 2013 4:07 pm
by decathect
That makes sense. According to my 'guesses' that would allow you to measure as slow as 343.3 RPM. Sounds like what you need.