View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 28, 2005 2:34 pm |
|
|
My intent was to show him how to re-arrange his equation
so that only integer math was necessary. |
|
|
OSUschap
Joined: 26 Sep 2005 Posts: 4
|
new life |
Posted: Wed Sep 28, 2005 2:51 pm |
|
|
Thanks guys for all the help. Mark, my problem was this: I knew that CCP_2 was a long, and I had in my head that a long was just a float with more precision. I see now why this won't work. I actually did add lines to turn off the other LEDs as well, but thank you. PCM programmer, thanks for the link to the other forum, I will definitely check that out, but first I want to fix my silly math error here and see if that helps. Thanks again guys |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Sep 28, 2005 3:22 pm |
|
|
PCM programmer wrote: | My intent was to show him how to re-arrange his equation
so that only integer math was necessary. |
My intent was to show that there is no need for any math. He just needs to take 5M and divide by the freq to derive his consts.
So to test for 100Hz, that would be 50000 or 5M/100.
This keeps the ints short. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 28, 2005 4:28 pm |
|
|
OK I understand you now. I was thinking in terms of making a
tachometer (which I've done). But I can see now that he doesn't
want to do that, he just wants to test if the freq is within certain
fixed ranges, so your method of pre-calculating the constants is
a good idea. |
|
|
|