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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/22/07 20:20
Read: times


 
#131220 - Imprecise comment
Responding to: ???'s previous message
Russ Cooper said:
NOTE:           A "step" is a full motor step (1.8°) if STEP_FULL is 1, or a
                half step (0.9°) if STEP_HALF is 1, or a quarter step (0.45°)
                if STEP_QUARTER is 1.

No, that's not quite true.

#if STEP_FULL
Tests that STEP_FULL is non-zero - not that it is equal to one.

Probably a more effective way of doing this is:
#if defined STEP_FULL
    index &= 0x03;                              /* Wrap at end of table */
#elif defined STEP_HALF
    index &= 0x07;                              /* Wrap at end of table */
#elif defined STEP_QUARTER
    index &= 0x0F;                              /* Wrap at end of table */
#elif STEP_SIXTH
    if (index > 23) index = 0;                  /* Wrap at end of table */
    if (index < 0)  index = 23;                 /* Wrap at end of table */
#else
#error One of STEP_FULL, STEP_HALF, STEP_QUARTER, STEP_SIXTH must be defined!
#endif

This will also prevent unexpected results if none of the conditions is defined, and if more than one is defined.



List of 22 messages in thread
TopicAuthorDate
8051 & L6219 (Stepper Motor Driver)            01/01/70 00:00      
   CNCZone            01/01/70 00:00      
   Maybe this will help            01/01/70 00:00      
      this helps a lot            01/01/70 00:00      
         Think Search and Replace            01/01/70 00:00      
            static            01/01/70 00:00      
               static about 'static' and 'code'            01/01/70 00:00      
                  That's modularity for you!            01/01/70 00:00      
                  Different Reason            01/01/70 00:00      
         Concepts            01/01/70 00:00      
      Imprecise comment            01/01/70 00:00      
         Another imprecise comment            01/01/70 00:00      
            Ah... That is the catch :)            01/01/70 00:00      
            Better            01/01/70 00:00      
               Yup            01/01/70 00:00      
                  Works Beautifully            01/01/70 00:00      
                     Another happy ending            01/01/70 00:00      
                        One more problem - Direction            01/01/70 00:00      
                           Extra Table Shouldn't Be Necessary            01/01/70 00:00      
                              thats what i thought too            01/01/70 00:00      
      nevermind i screwed up...            01/01/70 00:00      
   Visit Jones on Stepping Motors            01/01/70 00:00      

Back to Subject List