Proyecto de Tesis en Mecatrónica. Universidad Técnica del Norte. Ernesto Palacios <mecatronica.mid@gmail.com>
Dependencies: EthernetNetIf HTTPServer QEI_hw RPCInterface mbed
Revision 33:e6ff02c3e0f5, committed 2014-06-24
- Comitter:
- Yo_Robot
- Date:
- Tue Jun 24 17:42:25 2014 +0000
- Parent:
- 32:4483d6c225e5
- Child:
- 34:bdf918bc9b59
- Commit message:
- Al parecer el problema es la vibraci?n... ahora hay q solucionar el control de posici?n.
Changed in this revision
--- a/QEI_hw.lib Wed May 07 01:05:05 2014 +0000 +++ b/QEI_hw.lib Tue Jun 24 17:42:25 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/hexley/code/QEI_hw/#53f8ae2cf502 +http://mbed.org/users/hexley/code/QEI_hw/#9a372dbd1a17
--- a/main.cpp Wed May 07 01:05:05 2014 +0000 +++ b/main.cpp Tue Jun 24 17:42:25 2014 +0000 @@ -29,7 +29,7 @@ QEIHW encoder( QEI_DIRINV_CMPL, // CW = postive; CCW = negative QEI_SIGNALMODE_QUAD, // Absolute encoder - QEI_CAPMODE_4X, // PhA anb PhB + QEI_CAPMODE_2X, // PhA anb PhB QEI_INVINX_NONE // Not inverted index ); @@ -89,7 +89,7 @@ encoder.SetDigiFilter(480UL); // number of clock cycles the signal must be at high to sense it encoder.SetMaxPosition(0xFFFFFFFF); // max number before overflow - may be changed for 360 or a multiple - + encoder.SetVelocityTimerReload( 0xFFFFF ); //*************** Configura Red Ethernet **************************************************// @@ -173,7 +173,7 @@ setTimer2(); // Configurar PTO pin_son = 0; // Servo Apagado por defecto aout = 0.5; // Voltaje de salida 0V por defecto( +-10V! ) - + while(1) {
--- a/setup.cpp Wed May 07 01:05:05 2014 +0000 +++ b/setup.cpp Tue Jun 24 17:42:25 2014 +0000 @@ -38,10 +38,10 @@ int fq_actual = 0; // Ultimo valor seteado para el tren de pulsos int bandera_inicio = 0; - + int velocidad_rpm() { - return encoder.CalculateRPM( encoder.GetVelocityCap(), 360 ); + return encoder.GetVelocityCap(); } void clear_encoder() @@ -266,9 +266,10 @@ case 'R': // Leer la velocidd del encoder en RPM's { if( isPC ) - pc.printf( "%d",velocidad_rpm() ); - else - RS_232.printf( "%d",velocidad_rpm() ); + { + pc.printf( "%u", encoder.CalculateRPM( encoder.GetVelocityCap(), 360) ); // ultima velocidad leida desde el encoder + }else + RS_232.printf( "%u",encoder.CalculateRPM( encoder.GetVelocityCap(), 360) ); break; }