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 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 */