Stepper motor control class library

Dependents:   StepperMotor_HelloWorld

Components pages

Components pages are available for bipolar and unipolar motor libraries

A bipolar stepper motor driving pulse generator

A unipolar stepper motor driving pulse generator

Revision:
1:dc6cf8f8bcb7
Parent:
0:4beb37ae37ce
--- a/StepperMotor.h	Thu Nov 25 11:11:51 2010 +0000
+++ b/StepperMotor.h	Fri Nov 26 15:32:25 2010 +0000
@@ -1,5 +1,9 @@
 /** Stepper Motor control library
  *  
+ *  @class   StepperMotor
+ *  @author  Tedd OKANO
+ *  @version 0.51(27-Nov-2010)
+ *  
  *  Copyright: 2010 Tedd OKANO, Tsukimidai Communications Syndicate - Crawl Design
  *  The library that controls stepper motor via motor driver chip: TA7774
  *  The TA7774 is a driver for a bipolar stepper motor. 
@@ -11,7 +15,7 @@
 
 #include "mbed.h"
 
-#define MAX_PPS   50   //  pulse per second
+#define MAX_PPS   100   //  pulse per second
 
 /** Stepper Motor control class
  *
@@ -23,6 +27,7 @@
  *  StepperMotor m( p21, p22, p23, p24 );
  *
  *  int main() {
+ *      m.set_steps_per_rotate( 480 );
  *      m.set_sync_mode( StepperMotor::SYNCHRONOUS );
  *      m.set_power_ctrl( true );
  *
@@ -88,15 +93,15 @@
 
     /** Set the pulse width (i.e. motor turning speed)
      *
-     *  @param v pulse per second : default is 100. lower number makes the turn slower
+     *  @param v pulse per second : lower number makes the turn slower (default = 100)
      */
-    int set_pps( int v );
+    float set_pps( float v );
 
     /** Set maximum PPS (= minimum pulse width) which will be used in finding home position
      *
-     *  @param v maximum pulse per second : default is 100. lower number makes the turn slower
+     *  @param v maximum pulse per second : lower number makes the turn slower (default = 100)
      */
-    void set_max_pps( int v );
+    void set_max_pps( float v );
 
     /** Find home position: rotate the motor until the detection edge comes.
      *
@@ -125,7 +130,7 @@
      */     
     int go_position( int v );
 
-    /** Turn the motor to defined position (by angle (0.0..360 degree) from home position)
+    /** Turn the motor to defined position (by angle (degree)) from home position)
      *
      *  Make motor move to absolute position
      *
@@ -151,7 +156,7 @@
      *      ...
      *  @endcode
      *
-     *  @param m motor rotate mode : SHORTEST, NO_WRAPAROUND, CLOCKWISE_ONLY or COUNTER_CLOCKWISE_ONLY
+     *  @param m motor rotate mode : SHORTEST (default), NO_WRAPAROUND, CLOCKWISE_ONLY or COUNTER_CLOCKWISE_ONLY
      */
     void set_rot_mode( RotMode m );
 
@@ -165,7 +170,7 @@
      *      ...
      *  @endcode
      *
-     *  @param m motor rotate mode : ASYNCHRONOUS or SYNCHRONOUS
+     *  @param m motor rotate mode : ASYNCHRONOUS (default) or SYNCHRONOUS
      */
     void set_sync_mode( SyncMode m );
 
@@ -179,7 +184,7 @@
 
     /** Pause/Resume the motor action
      *
-     *  @param sw use "true" for pause, "false" for resume
+     *  @param sw use "true" for pause, "false" (default) for resume
      */
     void set_pause( int sw );
 
@@ -187,7 +192,7 @@
      *
      *  If the auto power control is enabled, the motor power will be turned-off when it stays same place
      *  
-     *  @param sw use "true" for pause, "false" for resume
+     *  @param sw use "true" for pause, "false" (default) for resume
      */
     void set_power_ctrl( int sw );
 
@@ -214,8 +219,8 @@
     int         current_pos;
     int         pos_offset;
     int         target_pos;
-    int         pps;
-    int         max_pps;
+    float       pps;
+    float       max_pps;
     int         init_done;
     int         pause;
     int         power_ctrl;