From 0f57e7c23cf5e9542992b12edbb279e1b3ac7083 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(-) (limited to 'AT91SAM7S256') diff --git a/AT91SAM7S256/Source/c_output.c b/AT91SAM7S256/Source/c_output.c index 2d40f06..c39f725 100644 --- a/AT91SAM7S256/Source/c_output.c +++ b/AT91SAM7S256/Source/c_output.c @@ -57,6 +57,7 @@ void cOutputInit(void* pHeader) pOut->RegDParameter = DEFAULT_D_GAIN_FACTOR; pOut->Options = 0x00; } + IOMapOutput.RegulationTime = REGULATION_TIME; VarsOutput.TimeCnt = 0; dOutputInit(); } @@ -135,6 +136,7 @@ void cOutputCtrl(void) } } } + dOutputSetRegulationTime(IOMapOutput.RegulationTime); dOutputCtrl(); cOutputUpdateIomap(); } diff --git a/AT91SAM7S256/Source/c_output.iom b/AT91SAM7S256/Source/c_output.iom index 794f7de..e8a7579 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 44a43a7..35e426b 100644 --- a/AT91SAM7S256/Source/d_output.c +++ b/AT91SAM7S256/Source/d_output.c @@ -27,7 +27,6 @@ #define REG_MAX_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 @@ -76,6 +75,7 @@ typedef struct static MOTORDATA MotorData[3]; static SYNCMOTORDATA SyncData; +static UBYTE RegulationTime; void dOutputInit(void) { @@ -157,7 +157,7 @@ void dOutputCtrl(void) pMD->MotorRunState = MOTOR_RUN_STATE_RUNNING; } - if (pMD->RegulationTimeCount > REGULATION_TIME) + if (pMD->RegulationTimeCount > RegulationTime) { pMD->RegulationTimeCount = 0; dOutputRegulateMotor(MotorNr); @@ -272,6 +272,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