虽然移植完毕,但是不work。需要细调……

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
lixianyu
Date:
Tue Jun 07 08:14:15 2016 +0000
Parent:
2:99785a1007a4
Commit message:
??????????work? ?????

Changed in this revision

Microduino_Stepper_PWM.cpp Show annotated file Show diff for this revision Revisions of this file
PID_v2.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Microduino_Stepper_PWM.cpp	Tue Jun 07 05:26:03 2016 +0000
+++ b/Microduino_Stepper_PWM.cpp	Tue Jun 07 08:14:15 2016 +0000
@@ -133,7 +133,7 @@
     }
     else {
         gpio_write(&dirOUT, 1);
-        period = map(speed, -1200, -1, PERIOD_MIN, PERIOD_MAX);
+        period = map(speed, -1200, -1, PERIOD_MAX, PERIOD_MIN);
         pwmout_period_us(&pwmStep, period);
     }
     //stepperAllEnable();
--- a/PID_v2.cpp	Tue Jun 07 05:26:03 2016 +0000
+++ b/PID_v2.cpp	Tue Jun 07 08:14:15 2016 +0000
@@ -57,7 +57,8 @@
     unsigned long now = g_Timer.read_us();
     float dt = (now - lastTime)/1000.0;
 
-    if(dt>=SampleTime) {
+    //if(dt>=SampleTime) {
+	if (1) {
         /*Compute all the working error variables*/
         float input = Input;
         float error = Setpoint - input;