Harrison Cooper (spam_OUThcooperTakeThisOuT
dax.sim.es.com) wrote:
>I need to count pulses from one pin, and then calculate the pulses per
>second. I'll use the AC zero crossing to increment one counter, then
>every sixty/fifty counts read the other counter to get a pulse per
second count.
{Quote hidden}> ....
>Then .... calculate a 10%, 15% and 20% reduction value and do a
>comparison of these reduced values to the calulated pulse per second
>and turn on outputs if any of these dropped in the ranges.
> ....
>1) Can the PIC handle this? My gut feeling is yes.
> ....
>3) Any pointers on doing the divide routines? I played around with it
>and using logical shifts I can kind of get there, but I believe there
>is some routines already developed.
Harrison:
Yes, the PIC can handle this without even breaking a sweat. In fact, if
you used an external EEPROM, you could do it with a 16C54.
I assume that the whole point of this thing is to measure the speed of
an AC motor in order to determine how much torque it's generating
(perhaps against an obstacle). Am I close?
I've been trying for a long time to figure out what it is that separates
hardcode real-time embedded-systems programmers from all those wimps who
write code for desktop machines, and your question #3 seems to be a
perfect example:
98% of programmers would try to find those 10%, 15%, and 20% speeds by
doing a division, and would waste their time and the microprocessor's
doing it.
The 2% of us who do small-microcontroller programming for a living would
probably avoid the division altogether, by just seeing whether it took
67, 71, or 75 seconds to count the number of pulses that originally took
only 60 seconds.
-Andy
--
Andrew Warren - .....fastfwdKILLspam
@spam@ix.netcom.com
Fast Forward Engineering, Vista, California