Command all jmCLIG modules from serial port

Committer:
jm
Date:
Sat Feb 12 16:50:25 2011 +0000
Revision:
0:9112e09912db
jmAll Command Line Interface Module

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jm 0:9112e09912db 1 /*************************************************************************
jm 0:9112e09912db 2 * @file jmStepper.h
jm 0:9112e09912db 3 * @brief Stepper Control Interface
jm 0:9112e09912db 4 * You can use 4,5,6 and 8 wire steppers.
jm 0:9112e09912db 5 * Each output pin must have two drivers.
jm 0:9112e09912db 6 * One driver must be the inverted output pin.
jm 0:9112e09912db 7 * The other driver is the non inverted output pin.
jm 0:9112e09912db 8 * This way the steppers operate in full step, full torque mode.
jm 0:9112e09912db 9 * .
jm 0:9112e09912db 10 * @version 1.0
jm 0:9112e09912db 11 * @date Feb 12, 2010
jm 0:9112e09912db 12 */
jm 0:9112e09912db 13
jm 0:9112e09912db 14 /*
jm 0:9112e09912db 15 * Module Command Line Interface
jm 0:9112e09912db 16 Format: command name (arg info)min..max values [optional argument]
jm 0:9112e09912db 17 stepper (Stepper number)0..3 (Pin CoilA)0..432 (Pin CoilB)0..432 (Direction)0..1 (Delay)1..255 [(Steps)1..65535]
jm 0:9112e09912db 18 stepperStop (steppers value)1..15
jm 0:9112e09912db 19
jm 0:9112e09912db 20 Example for stepper on pins Port1.31 Port1.30 DIP20 DIP19
jm 0:9112e09912db 21 stepper 0 131 130 1 1 shortest delays between steps (fastest speed) continuous mode
jm 0:9112e09912db 22 stepper 0 131 130 0 1 1 one step in reverse direction
jm 0:9112e09912db 23 stepper 0 131 130 1 10 5 5 steps in foward direction with 10 unit ticks between steps
jm 0:9112e09912db 24
jm 0:9112e09912db 25 * Module Events
jm 0:9112e09912db 26 GPPST (stepper id)0..3
jm 0:9112e09912db 27 On Ending steps, Send Message: GPPST id pinA pinB delay status
jm 0:9112e09912db 28
jm 0:9112e09912db 29 * Module Feedback and Help messages may be enabled/disabled by Command Lines.
jm 0:9112e09912db 30 feedback (enable/disable)0..1
jm 0:9112e09912db 31 help (enable/disable)0..1
jm 0:9112e09912db 32
jm 0:9112e09912db 33 */
jm 0:9112e09912db 34
jm 0:9112e09912db 35 #ifndef jmStepperdef
jm 0:9112e09912db 36 #define jmStepperdef 1
jm 0:9112e09912db 37
jm 0:9112e09912db 38 #define stepperQty 4 // 4 steppers max
jm 0:9112e09912db 39
jm 0:9112e09912db 40 #include "LPC17xx.h"
jm 0:9112e09912db 41
jm 0:9112e09912db 42 // Module Data Structure
jm 0:9112e09912db 43 extern struct StructStepper{
jm 0:9112e09912db 44 uint8_t cw;
jm 0:9112e09912db 45 uint8_t active;
jm 0:9112e09912db 46 uint8_t seq;
jm 0:9112e09912db 47 uint8_t delay;
jm 0:9112e09912db 48 uint8_t eggTimer;
jm 0:9112e09912db 49 uint16_t nSteps;
jm 0:9112e09912db 50 uint16_t pinA;
jm 0:9112e09912db 51 uint16_t pinB;
jm 0:9112e09912db 52 uint32_t CoilA_bitValue;
jm 0:9112e09912db 53 uint32_t CoilB_bitValue;
jm 0:9112e09912db 54 LPC_GPIO_TypeDef *portCoilA;
jm 0:9112e09912db 55 LPC_GPIO_TypeDef *portCoilB;
jm 0:9112e09912db 56 }sStepper[stepperQty];
jm 0:9112e09912db 57
jm 0:9112e09912db 58 #endif
jm 0:9112e09912db 59
jm 0:9112e09912db 60 // Module Prototypes
jm 0:9112e09912db 61 void StepperInit(void);
jm 0:9112e09912db 62 void StepperSM(void);
jm 0:9112e09912db 63 void cli_Stepper(void);
jm 0:9112e09912db 64 void Step(int number, bool CW);
jm 0:9112e09912db 65 void cli_StepperStop(void);
jm 0:9112e09912db 66 void cli_GPPST(void);
jm 0:9112e09912db 67 void rGPPST(unsigned int id);
jm 0:9112e09912db 68 void cli_StepSpeed(void);
jm 0:9112e09912db 69
jm 0:9112e09912db 70 //-------------------------- CLIG PLUGS --------------------
jm 0:9112e09912db 71 // CLIG-INCLUDE
jm 0:9112e09912db 72 /*
jm 0:9112e09912db 73 #include "jmStepper.h"
jm 0:9112e09912db 74 */
jm 0:9112e09912db 75
jm 0:9112e09912db 76 // CLIG-INIT
jm 0:9112e09912db 77 /*
jm 0:9112e09912db 78 StepperInit();
jm 0:9112e09912db 79 */
jm 0:9112e09912db 80
jm 0:9112e09912db 81 // CLIG-TIMER
jm 0:9112e09912db 82 /*
jm 0:9112e09912db 83 // Module jmStepper
jm 0:9112e09912db 84 for(i=0;i<stepperQty;i++)if(sStepper[i].eggTimer>0)sStepper[i].eggTimer--;
jm 0:9112e09912db 85 */
jm 0:9112e09912db 86
jm 0:9112e09912db 87 // CLIG-CMD
jm 0:9112e09912db 88 /*
jm 0:9112e09912db 89 stepper cli_Stepper();
jm 0:9112e09912db 90 stepperStop cli_StepperStop();
jm 0:9112e09912db 91 GPPST cli_GPPST();
jm 0:9112e09912db 92 stepSpeed cli_StepSpeed();
jm 0:9112e09912db 93 */
jm 0:9112e09912db 94
jm 0:9112e09912db 95 // CLIG-SM
jm 0:9112e09912db 96 /*
jm 0:9112e09912db 97 StepperSM();
jm 0:9112e09912db 98 */
jm 0:9112e09912db 99 //-------------------------- END CLIG PLUGS --------------------