From 678b07dfbfe4ad554fae5e228aadb0aeb3c7d04f 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 ff27ee8..c8b2469 100644 --- a/AT91SAM7S256/Source/c_output.c +++ b/AT91SAM7S256/Source/c_output.c @@ -55,6 +55,7 @@ void cOutputInit(void* pHeader) IOMapOutput.Outputs[Tmp].RegIParameter = DEFAULT_I_GAIN_FACTOR; IOMapOutput.Outputs[Tmp].RegDParameter = DEFAULT_D_GAIN_FACTOR; } + IOMapOutput.RegulationTime = REGULATION_TIME; VarsOutput.TimeCnt = 0; dOutputInit(); } @@ -132,6 +133,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 978be66..df8035a 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) { @@ -162,7 +162,7 @@ void dOutputCtrl(void) MotorData[MotorNr].MotorRunState = MOTOR_RUN_STATE_RUNNING; } - if (MotorData[MotorNr].RegulationTimeCount > REGULATION_TIME) + if (MotorData[MotorNr].RegulationTimeCount > RegulationTime) { MotorData[MotorNr].RegulationTimeCount = 0; dOutputRegulateMotor(MotorNr); @@ -273,6 +273,12 @@ void dOutputSetPIDParameters(UBYTE Motor, UBYTE NewRegPParameter, UBYTE NewRegIP MotorData[Motor].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 6b944a8..1328efd 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 Motor); void dOutputResetBlockTachoLimit(UBYTE Motor); void dOutputResetRotationCaptureCount(UBYTE MotorNr); void dOutputSetPIDParameters(UBYTE Motor, UBYTE NewRegPParameter, UBYTE NewRegIParameter, UBYTE NewRegDParameter); +void dOutputSetRegulationTime(UBYTE NewRegulationTime); void dOutputRegulateMotor(UBYTE MotorNr); void dOutputCalculateRampUpParameter(UBYTE MotorNr, ULONG NewTachoLimit); -- cgit v1.2.3