??? 08/07/07 18:49 Read: times Msg Score: +4 +3 Informative +1 Good Answer/Helpful |
#142891 - Fractional Equivalence Responding to: ???'s previous message |
Hi Stanley,
Your purpose of dividing with those big numbers is to maintain the ratio of the crystal frequencies you're working with. You don't need to divide 22118400 / 12000000 to get the ratio you want. You might find that 529/287 is close enough, given that you are loading a 16 bit counter. Maybe 94/51 is better since the intermediate values will be smaller. I calculated these numbers with my fractional equivalence spreadsheet, which I frequently use when I need to scale values. See it on my user page here http://www.8052.com/users/dwelbourn/ Most times you can rearrange a problem and avoid using floating point (and all the code size increase associated with it). Another thing to consider is that often an eval version of a compiler won't include floating point support. Dennis |