Current control specified by current input channel, pwm + &- channels, pwm index, PID gains and sampling time.

Dependents:   WIPV

Revision:
0:955aa05c968a
Child:
1:c5973a56d474
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CURRENT_CONTROL.h	Fri Apr 22 09:39:01 2016 +0000
@@ -0,0 +1,65 @@
+#ifndef __CURRENT_CONTROL_H__
+#define __CURRENT_CONTROL_H__
+
+#include "mbed.h"
+#include "PID.h"
+
+
+class CURRENT_CONTROL
+{
+public:
+    
+    void CURRENT_CONTROL(PinName curChannel, PinName PwmChannel1, PinName PwmChannel2, float Kp, float Ki, float Kd, float samplingTime);
+    void ControlCompute(float curRef, float curFeedback);
+    void ChangePwmPeriod(float microSeconds);
+    
+    typedef enum {
+        PWM1;
+        PWM2;
+    } PWMIndex;
+    
+    PID pid;
+    PwmOut MotorPlus;
+    PwmOut MotorMinus;
+    float controlOutput;
+
+    float currentOffset;
+    float currentFeedBack;
+private:
+
+    float Ts;
+    AnalogIn currentAnalogIn;
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#endif
\ No newline at end of file