From e57ee876faf432f95ad5e8b857702037ac1afcfe Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Sat, 9 Oct 2010 14:18:52 +0200 Subject: replace unused PwnFreq IOMap with RegulationTime --- AT91SAM7S256/Source/c_output.c | 2 ++ AT91SAM7S256/Source/c_output.iom | 2 +- AT91SAM7S256/Source/d_output.c | 10 ++++++++-- AT91SAM7S256/Source/d_output.h | 3 +++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/AT91SAM7S256/Source/c_output.c b/AT91SAM7S256/Source/c_output.c index a9c8f01..f11a9fd 100644 --- a/AT91SAM7S256/Source/c_output.c +++ b/AT91SAM7S256/Source/c_output.c @@ -56,6 +56,7 @@ void cOutputInit(void* pHeader) pOut->RegIParameter = DEFAULT_I_GAIN_FACTOR; pOut->RegDParameter = DEFAULT_D_GAIN_FACTOR; } + IOMapOutput.RegulationTime = REGULATION_TIME; VarsOutput.TimeCnt = 0; dOutputInit(); } @@ -134,6 +135,7 @@ void cOutputCtrl(void) } } } + dOutputSetRegulationTime(IOMapOutput.RegulationTime); dOutputCtrl(); cOutputUpdateIomap(); } diff --git a/AT91SAM7S256/Source/c_output.iom b/AT91SAM7S256/Source/c_output.iom index df5137b..60e1a6b 100644 --- a/AT91SAM7S256/Source/c_output.iom +++ b/AT91SAM7S256/Source/c_output.iom @@ -82,7 +82,7 @@ typedef struct typedef struct { OUTPUT Outputs[NO_OF_OUTPUTS]; - UBYTE PwnFreq; + UBYTE RegulationTime; /* RW - Interval between regulation computations */ }IOMAPOUTPUT; diff --git a/AT91SAM7S256/Source/d_output.c b/AT91SAM7S256/Source/d_output.c index b6c72ab..ce5867f 100644 --- a/AT91SAM7S256/Source/d_output.c +++ b/AT91SAM7S256/Source/d_output.c @@ -28,7 +28,6 @@ #define REG_MIN_VALUE -100 #define RAMP_TIME_INTERVAL 25 // Measured in 1 mS => 25 mS interval -#define REGULATION_TIME 100 // Measured in 1 mS => 100 mS regulation interval #define RAMPDOWN_STATE_RAMPDOWN 0 #define RAMPDOWN_STATE_CONTINIUE 1 @@ -83,6 +82,7 @@ typedef struct static MOTORDATA MotorData[3]; static SYNCMOTORDATA SyncData; +static UBYTE RegulationTime; void dOutputInit(void) { @@ -164,7 +164,7 @@ void dOutputCtrl(void) pMD->MotorRunState = MOTOR_RUN_STATE_RUNNING; } - if (pMD->RegulationTimeCount > REGULATION_TIME) + if (pMD->RegulationTimeCount > RegulationTime) { pMD->RegulationTimeCount = 0; dOutputRegulateMotor(MotorNr); @@ -279,6 +279,12 @@ void dOutputSetPIDParameters(UBYTE MotorNr, UBYTE NewRegPParameter, UBYTE NewReg pMD->RegDParameter = NewRegDParameter; } +/* Set new regulation time */ +void dOutputSetRegulationTime(UBYTE NewRegulationTime) +{ + RegulationTime = NewRegulationTime; +} + /* Called to set TachoCountToRun which is used for position control for the model */ /* Must be called before motor start */ /* TachoCountToRun is calculated as a signed value */ diff --git a/AT91SAM7S256/Source/d_output.h b/AT91SAM7S256/Source/d_output.h index 1778414..1c24db0 100644 --- a/AT91SAM7S256/Source/d_output.h +++ b/AT91SAM7S256/Source/d_output.h @@ -39,6 +39,8 @@ #endif +#define REGULATION_TIME 100 // Measured in 1 mS, regulation interval + //Constant reffering to RegMode parameter #define REGSTATE_IDLE 0x00 #define REGSTATE_REGULATED 0x01 @@ -74,6 +76,7 @@ void dOutputResetTachoLimit(UBYTE MotorNr); void dOutputResetBlockTachoLimit(UBYTE MotorNr); void dOutputResetRotationCaptureCount(UBYTE MotorNr); void dOutputSetPIDParameters(UBYTE MotorNr, UBYTE NewRegPParameter, UBYTE NewRegIParameter, UBYTE NewRegDParameter); +void dOutputSetRegulationTime(UBYTE NewRegulationTime); void dOutputRegulateMotor(UBYTE MotorNr); void dOutputCalculateRampUpParameter(UBYTE MotorNr, ULONG NewTachoLimit); -- cgit v1.2.3