Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
jmStepper.h
00001 /************************************************************************* 00002 * @file jmStepper.h 00003 * @brief Stepper Control Interface 00004 * You can use 4,5,6 and 8 wire steppers. 00005 * Each output pin must have two drivers. 00006 * One driver must be the inverted output pin. 00007 * The other driver is the non inverted output pin. 00008 * This way the steppers operate in full step, full torque mode. 00009 * . 00010 * @version 1.0 00011 * @date Feb 12, 2010 00012 */ 00013 00014 /* 00015 * Module Command Line Interface 00016 Format: command name (arg info)min..max values [optional argument] 00017 stepper (Stepper number)0..3 (Pin CoilA)0..432 (Pin CoilB)0..432 (Direction)0..1 (Delay)1..255 [(Steps)1..65535] 00018 stepperStop (steppers value)1..15 00019 00020 Example for stepper on pins Port1.31 Port1.30 DIP20 DIP19 00021 stepper 0 131 130 1 1 shortest delays between steps (fastest speed) continuous mode 00022 stepper 0 131 130 0 1 1 one step in reverse direction 00023 stepper 0 131 130 1 10 5 5 steps in foward direction with 10 unit ticks between steps 00024 00025 * Module Events 00026 GPPST (stepper id)0..3 00027 On Ending steps, Send Message: GPPST id pinA pinB delay status 00028 00029 * Module Feedback and Help messages may be enabled/disabled by Command Lines. 00030 feedback (enable/disable)0..1 00031 help (enable/disable)0..1 00032 00033 */ 00034 00035 #ifndef jmStepperdef 00036 #define jmStepperdef 1 00037 00038 #define stepperQty 4 // 4 steppers max 00039 00040 #include "LPC17xx.h" 00041 00042 // Module Data Structure 00043 extern struct StructStepper{ 00044 uint8_t cw; 00045 uint8_t active; 00046 uint8_t seq; 00047 uint8_t delay; 00048 uint8_t eggTimer; 00049 uint16_t nSteps; 00050 uint16_t pinA; 00051 uint16_t pinB; 00052 uint32_t CoilA_bitValue; 00053 uint32_t CoilB_bitValue; 00054 LPC_GPIO_TypeDef *portCoilA; 00055 LPC_GPIO_TypeDef *portCoilB; 00056 }sStepper[stepperQty]; 00057 00058 #endif 00059 00060 // Module Prototypes 00061 void StepperInit(void); 00062 void StepperSM(void); 00063 void cli_Stepper(void); 00064 void Step(int number, bool CW); 00065 void cli_StepperStop(void); 00066 void cli_GPPST(void); 00067 void rGPPST(unsigned int id); 00068 void cli_StepSpeed(void); 00069 00070 //-------------------------- CLIG PLUGS -------------------- 00071 // CLIG-INCLUDE 00072 /* 00073 #include "jmStepper.h" 00074 */ 00075 00076 // CLIG-INIT 00077 /* 00078 StepperInit(); 00079 */ 00080 00081 // CLIG-TIMER 00082 /* 00083 // Module jmStepper 00084 for(i=0;i<stepperQty;i++)if(sStepper[i].eggTimer>0)sStepper[i].eggTimer--; 00085 */ 00086 00087 // CLIG-CMD 00088 /* 00089 stepper cli_Stepper(); 00090 stepperStop cli_StepperStop(); 00091 GPPST cli_GPPST(); 00092 stepSpeed cli_StepSpeed(); 00093 */ 00094 00095 // CLIG-SM 00096 /* 00097 StepperSM(); 00098 */ 00099 //-------------------------- END CLIG PLUGS --------------------
Generated on Fri Jul 22 2022 14:37:36 by
1.7.2