tarea encoder , configuracion pid con el encoder

Dependencies:   Debounced QEI TextLCD mbed

Fork of Tarea4_Encoder by Jesse Beltran

Files at this revision

API Documentation at this revision

Comitter:
juanco
Date:
Tue May 13 16:47:50 2014 +0000
Parent:
0:cdf4bcffb35a
Commit message:
manejo del encoder de nuevo utilizando la pantalla lcd.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r cdf4bcffb35a -r edbfc09232ed main.cpp
--- a/main.cpp	Thu Apr 03 20:19:31 2014 +0000
+++ b/main.cpp	Tue May 13 16:47:50 2014 +0000
@@ -1,30 +1,27 @@
-//Jesse Mauricio Beltran
-//Michelle Maceas Henao
-
 
 #include "mbed.h"
 #include "DebouncedIn.h"
 #include "TextLCD.h"
 #include "QEI.h"
-
-
+ 
+ 
 QEI wheel (PTA16, PTA17, NC, 48);
 TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7
-
-
+ 
+ 
 DebouncedIn Enco(PTC5);
 DebouncedIn button1(PTC10);
 DebouncedIn button2(PTC6);
 DebouncedIn button3(PTC11);
 PwmOut Pwm(PTA5);
-
+ 
  
 float pp=0.001;
 float Dd=0.1;
 int SP1=0,Sp=0,Kp1=0,Kp=0,Ki=0,Ki1=0,Kd=0,Kd1=0,v,m;
 int C1=0x0E; // solo muestra el curzor
 int i; // indice de la variable
-
+ 
 int PWMmodule(float pp,float Dd)
 {
         Pwm.period(pp);
@@ -33,9 +30,9 @@
         Pwm.write(0); 
         return 0;
 } 
-
+ 
 int main() 
-
+ 
 {
     lcd.writeCommand(0x0E);
     lcd.printf("Sp=0    Kp=0");
@@ -43,7 +40,7 @@
     lcd.printf("Ki=0    Kd=0");
     lcd.locate(2,0);
     lcd.printf("=");
-
+ 
     while(1) 
     {  
      m=wheel.getPulses();
@@ -59,7 +56,7 @@
                     lcd.printf("=     ");
                     lcd.locate(3,0);
                     lcd.printf("%d",Sp);
-                    //Sp=m;
+                    Sp=m;
                     Sp=SP1+m;  
                     if(Sp<0)
                     {
@@ -74,7 +71,7 @@
                     lcd.printf("=     ");
                     lcd.locate(11,0);
                     lcd.printf("%d",Kp);
-                    //Kp=m;
+                    Kp=m;
                     Kp=Kp1+m;  
                     if(Kp<0)
                     {
@@ -89,7 +86,7 @@
                     lcd.printf("=     ");
                     lcd.locate(3,1);
                     lcd.printf("%d",Ki);
-                    //Ki=m;
+                    Ki=m;
                     Ki=Ki1+m;  
                     if(Ki<0)
                     {
@@ -156,4 +153,4 @@
                 PWMmodule(pp,Dd);
         } */
     }
-}       
\ No newline at end of file
+}     
\ No newline at end of file