Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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

List of 31 messages in thread
TopicAuthorDate
Problem with using Timer 1 of AT89S52 in C            01/01/70 00:00      
   methodology and the raw reason            01/01/70 00:00      
      Range of Variables            01/01/70 00:00      
         What type is AxisAngle?            01/01/70 00:00      
            AxisAngle is char            01/01/70 00:00      
            Integer < 65536?            01/01/70 00:00      
               Working within the range of long integers            01/01/70 00:00      
                  so I should....?            01/01/70 00:00      
                     A float constant            01/01/70 00:00      
                        what's the different            01/01/70 00:00      
                           const float...            01/01/70 00:00      
                              which means the compiler            01/01/70 00:00      
                     floats            01/01/70 00:00      
         drop float            01/01/70 00:00      
            Since I have just started to learn C...            01/01/70 00:00      
               A real programming language            01/01/70 00:00      
            Fractional Equivalence            01/01/70 00:00      
         Why?            01/01/70 00:00      
            there is a reason for this...            01/01/70 00:00      
               don't think as a PC programmer....            01/01/70 00:00      
                  Application vs. Hardware Platform            01/01/70 00:00      
                     the prudent programmer...            01/01/70 00:00      
                  PDP?            01/01/70 00:00      
                     it's not similar to the REAL assembly, of course,            01/01/70 00:00      
            Division is not always first            01/01/70 00:00      
               You are right.            01/01/70 00:00      
                  Explicitness            01/01/70 00:00      
                     is this when the C-code...            01/01/70 00:00      
                     agree with the agreement            01/01/70 00:00      
   Try this, can be better            01/01/70 00:00      
      Superfluous casts            01/01/70 00:00      

Back to Subject List