From fc1e658f15bbb8d4497d189e79b43fab4b964839 Mon Sep 17 00:00:00 2001 From: John Hansen Date: Sun, 13 Mar 2011 23:36:50 +0000 Subject: Added position regulation mode (Nicolas Schodet) git-svn-id: https://mindboards.svn.sourceforge.net/svnroot/mindboards/lms_nbcnxc/branches/version_131@37 c9361245-7fe8-9947-84e8-057757c4e366 --- AT91SAM7S256/Source/d_output.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'AT91SAM7S256/Source/d_output.h') diff --git a/AT91SAM7S256/Source/d_output.h b/AT91SAM7S256/Source/d_output.h index ce78246..20955a6 100644 --- a/AT91SAM7S256/Source/d_output.h +++ b/AT91SAM7S256/Source/d_output.h @@ -39,10 +39,17 @@ #endif +#define DEFAULT_MAX_SPEED 80 +#define DEFAULT_MAX_ACCELERATION 20 + +#define REGULATION_TIME 100 // Measured in 1 mS => 100 mS regulation interval +//#define REGULATION_TIME 10 // Measured in 1 mS, regulation interval + //Constant reffering to RegMode parameter #define REGSTATE_IDLE 0x00 #define REGSTATE_REGULATED 0x01 #define REGSTATE_SYNCHRONE 0x02 +#define REGSTATE_POSITION 0x04 //Constant reffering to RunState parameter #define MOTOR_RUN_STATE_IDLE 0x00 @@ -51,9 +58,8 @@ #define MOTOR_RUN_STATE_RAMPDOWN 0x40 #define MOTOR_RUN_STATE_HOLD 0x60 - -#define RAMP_TIME_INTERVAL 25 // Measured in 1 mS => 25 mS interval -#define REGULATION_TIME 100 // Measured in 1 mS => 100 mS regulation interval +// Constants related to Regulation Options +#define REGOPTION_NO_SATURATION 0x01 // Do not limit intermediary regulation results enum { @@ -76,12 +82,16 @@ void dOutputResetTachoLimit(UBYTE MotorNr); void dOutputResetBlockTachoLimit(UBYTE MotorNr); void dOutputResetRotationCaptureCount(UBYTE MotorNr); void dOutputSetPIDParameters(UBYTE MotorNr, UBYTE NewRegPParameter, UBYTE NewRegIParameter, UBYTE NewRegDParameter); +void dOutputSetMax(UBYTE MotorNr, SBYTE NewMaxSpeed, SBYTE NewMaxAcceleration); +void dOutputSetRegulationTime(UBYTE NewRegulationTime); +void dOutputSetRegulationOptions(UBYTE NewRegulationOptions); void dOutputRegulateMotor(UBYTE MotorNr); void dOutputCalculateRampUpParameter(UBYTE MotorNr, ULONG NewTachoLimit); void dOutputRampDownFunction(UBYTE MotorNr); void dOutputRampUpFunction(UBYTE MotorNr); void dOutputTachoLimitControl(UBYTE MotorNr); +void dOutputAbsolutePositionRegulation(UBYTE MotorNr); void dOutputCalculateMotorPosition(UBYTE MotorNr); void dOutputSyncMotorPosition(UBYTE MotorOne, UBYTE MotorTwo); void dOutputMotorReachedTachoLimit(UBYTE MotorNr); -- cgit v1.2.3