aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/Source/d_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'AT91SAM7S256/Source/d_output.c')
-rw-r--r--AT91SAM7S256/Source/d_output.c10
1 files changed, 8 insertions, 2 deletions
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 */