aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/Source
diff options
context:
space:
mode:
authorNicolas Schodet2010-10-09 14:18:52 +0200
committerNicolas Schodet2011-01-29 21:30:27 +0100
commit0f57e7c23cf5e9542992b12edbb279e1b3ac7083 (patch)
tree6b7187e234833a633ec64478c86f03cd12d278c9 /AT91SAM7S256/Source
parent7b66c5e1238ce5b45c40fed393fc3ac119b16f4a (diff)
replace unused PwnFreq IOMap with RegulationTime
Diffstat (limited to 'AT91SAM7S256/Source')
-rw-r--r--AT91SAM7S256/Source/c_output.c2
-rw-r--r--AT91SAM7S256/Source/c_output.iom2
-rw-r--r--AT91SAM7S256/Source/d_output.c10
-rw-r--r--AT91SAM7S256/Source/d_output.h3
4 files changed, 14 insertions, 3 deletions
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);