Proyecto de Tesis en Mecatrónica. Universidad Técnica del Norte. Ernesto Palacios <mecatronica.mid@gmail.com>
Dependencies: EthernetNetIf HTTPServer QEI_hw RPCInterface mbed
setup.h@23:2126e38bb48c, 2012-07-06 (annotated)
- Committer:
- Yo_Robot
- Date:
- Fri Jul 06 17:34:16 2012 +0000
- Revision:
- 23:2126e38bb48c
- Parent:
- 22:d5431fff164b
- Child:
- 30:413d1a6648b5
Version 2.0 Encoder listo - faltan alarmas externas de proximidad
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yo_Robot | 20:4b154134ab20 | 1 | /** |
Yo_Robot | 20:4b154134ab20 | 2 | * @file setup.h |
Yo_Robot | 20:4b154134ab20 | 3 | * @author Ernesto Palacios |
Yo_Robot | 20:4b154134ab20 | 4 | * @brief decalracion de funciones |
Yo_Robot | 20:4b154134ab20 | 5 | * |
Yo_Robot | 20:4b154134ab20 | 6 | * Created on 25 de Marzo de 2012 |
Yo_Robot | 20:4b154134ab20 | 7 | * |
Yo_Robot | 20:4b154134ab20 | 8 | * Licencia GPL v3.0 |
Yo_Robot | 20:4b154134ab20 | 9 | * http://www.gnu.org/licenses/gpl-3.0.html |
Yo_Robot | 20:4b154134ab20 | 10 | */ |
Yo_Robot | 20:4b154134ab20 | 11 | |
Yo_Robot | 2:a1b556d78a7f | 12 | |
Yo_Robot | 2:a1b556d78a7f | 13 | #ifndef SETUP_H |
Yo_Robot | 2:a1b556d78a7f | 14 | #define SETUP_H |
Yo_Robot | 2:a1b556d78a7f | 15 | |
Yo_Robot | 2:a1b556d78a7f | 16 | #include "mbed.h" |
Yo_Robot | 18:cf1e07d82630 | 17 | #include "EthernetNetIf.h" |
Yo_Robot | 18:cf1e07d82630 | 18 | |
Yo_Robot | 4:552beeda4722 | 19 | /** @brief: Esta funcion configura al Timer2 |
Yo_Robot | 4:552beeda4722 | 20 | * para que las salidas p5 y p6 del mbed |
Yo_Robot | 4:552beeda4722 | 21 | * se alternen cada vez que se iguala al |
Yo_Robot | 4:552beeda4722 | 22 | * registro MR2 y MR3. |
Yo_Robot | 4:552beeda4722 | 23 | */ |
Yo_Robot | 4:552beeda4722 | 24 | void setTimer2(); |
Yo_Robot | 4:552beeda4722 | 25 | |
Yo_Robot | 4:552beeda4722 | 26 | |
Yo_Robot | 20:4b154134ab20 | 27 | /** @brief: Esta es la rutina para obtener la onfiguracion |
Yo_Robot | 20:4b154134ab20 | 28 | * de la velocidad serial para el puerto MAX_232 |
Yo_Robot | 20:4b154134ab20 | 29 | */ |
Yo_Robot | 21:353b0fe8fc54 | 30 | int configurarBaudios(); |
Yo_Robot | 20:4b154134ab20 | 31 | |
Yo_Robot | 20:4b154134ab20 | 32 | |
Yo_Robot | 4:552beeda4722 | 33 | /** @brief: Esta es la rutina que maneja las interrupciones |
Yo_Robot | 4:552beeda4722 | 34 | * seriales, al recibir un caracter. |
Yo_Robot | 4:552beeda4722 | 35 | */ |
Yo_Robot | 2:a1b556d78a7f | 36 | void ISR_Serial(); |
Yo_Robot | 2:a1b556d78a7f | 37 | |
Yo_Robot | 4:552beeda4722 | 38 | |
Yo_Robot | 12:c02b08dacc45 | 39 | /** @brief: Esta es la rutina que cambia la frecuencia |
Yo_Robot | 12:c02b08dacc45 | 40 | * de salida del Micro en Serial |
Yo_Robot | 4:552beeda4722 | 41 | */ |
Yo_Robot | 12:c02b08dacc45 | 42 | void setPTO( int freq ); |
Yo_Robot | 4:552beeda4722 | 43 | |
Yo_Robot | 4:552beeda4722 | 44 | |
Yo_Robot | 12:c02b08dacc45 | 45 | /** @brief: Esta es la rutina que maneja la interrupcion |
Yo_Robot | 12:c02b08dacc45 | 46 | * de alarma |
Yo_Robot | 4:552beeda4722 | 47 | */ |
Yo_Robot | 12:c02b08dacc45 | 48 | void ISR_Alarm(); |
Yo_Robot | 2:a1b556d78a7f | 49 | |
Yo_Robot | 4:552beeda4722 | 50 | |
Yo_Robot | 4:552beeda4722 | 51 | /** @brief: Esta Funcion calcula el valor necesario |
Yo_Robot | 4:552beeda4722 | 52 | * en el MatchRegister para obtener una frecuencia |
Yo_Robot | 4:552beeda4722 | 53 | * de salida. |
Yo_Robot | 4:552beeda4722 | 54 | * @param fout Frecuencia de salida deseada |
Yo_Robot | 4:552beeda4722 | 55 | * @return El valor que debe tener el MatchRegister |
Yo_Robot | 4:552beeda4722 | 56 | */ |
Yo_Robot | 4:552beeda4722 | 57 | int getMRvalue( int fout ); |
Yo_Robot | 4:552beeda4722 | 58 | |
Yo_Robot | 4:552beeda4722 | 59 | |
Yo_Robot | 21:353b0fe8fc54 | 60 | |
Yo_Robot | 21:353b0fe8fc54 | 61 | /** @brief: Esta es la rutina que maneja la interrupcion |
Yo_Robot | 21:353b0fe8fc54 | 62 | * de alarma |
Yo_Robot | 21:353b0fe8fc54 | 63 | */ |
Yo_Robot | 21:353b0fe8fc54 | 64 | int getBaud(); |
Yo_Robot | 21:353b0fe8fc54 | 65 | |
Yo_Robot | 21:353b0fe8fc54 | 66 | |
Yo_Robot | 21:353b0fe8fc54 | 67 | |
Yo_Robot | 12:c02b08dacc45 | 68 | /** @brief: Esta Funcion cambia el valor del Registro 2 |
Yo_Robot | 12:c02b08dacc45 | 69 | */ |
Yo_Robot | 12:c02b08dacc45 | 70 | void setMR2( int newValue ); |
Yo_Robot | 12:c02b08dacc45 | 71 | |
Yo_Robot | 12:c02b08dacc45 | 72 | |
Yo_Robot | 12:c02b08dacc45 | 73 | /** @brief: Esta Funcion arranca el timer |
Yo_Robot | 12:c02b08dacc45 | 74 | */ |
Yo_Robot | 12:c02b08dacc45 | 75 | void startTimer2(); |
Yo_Robot | 12:c02b08dacc45 | 76 | |
Yo_Robot | 12:c02b08dacc45 | 77 | |
Yo_Robot | 12:c02b08dacc45 | 78 | /** @brief: Esta Funcion detiene el timer |
Yo_Robot | 12:c02b08dacc45 | 79 | */ |
Yo_Robot | 12:c02b08dacc45 | 80 | void stopTimer2(); |
Yo_Robot | 12:c02b08dacc45 | 81 | |
Yo_Robot | 12:c02b08dacc45 | 82 | |
Yo_Robot | 22:d5431fff164b | 83 | //________________ FUNCIONES ETHERNET ___________________// |
Yo_Robot | 22:d5431fff164b | 84 | |
Yo_Robot | 22:d5431fff164b | 85 | |
Yo_Robot | 22:d5431fff164b | 86 | /** @brief: Esta es la rutina que cambia la frecuencia |
Yo_Robot | 22:d5431fff164b | 87 | * de salida del Micro en comunicacion Ethernet |
Yo_Robot | 22:d5431fff164b | 88 | */ |
Yo_Robot | 22:d5431fff164b | 89 | void setPTO_eth ( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 90 | |
Yo_Robot | 22:d5431fff164b | 91 | |
Yo_Robot | 12:c02b08dacc45 | 92 | /** @brief: Esta Funcion cambia el voltaje de salida el |
Yo_Robot | 12:c02b08dacc45 | 93 | * valor ingresado debe ser en porcentaje. |
Yo_Robot | 12:c02b08dacc45 | 94 | * Desde -100% hasta +100% dependiendo de la velocidad |
Yo_Robot | 12:c02b08dacc45 | 95 | * y el sentido de giro |
Yo_Robot | 12:c02b08dacc45 | 96 | */ |
Yo_Robot | 12:c02b08dacc45 | 97 | void setAout_eth( char * input, char * output ); |
Yo_Robot | 12:c02b08dacc45 | 98 | |
Yo_Robot | 12:c02b08dacc45 | 99 | |
Yo_Robot | 12:c02b08dacc45 | 100 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 12:c02b08dacc45 | 101 | */ |
Yo_Robot | 12:c02b08dacc45 | 102 | void setDir_eth ( char * input, char * output ); |
Yo_Robot | 12:c02b08dacc45 | 103 | |
Yo_Robot | 12:c02b08dacc45 | 104 | |
Yo_Robot | 22:d5431fff164b | 105 | /** @brief: Encender el Servo (bloquearlo) |
Yo_Robot | 22:d5431fff164b | 106 | */ |
Yo_Robot | 22:d5431fff164b | 107 | void setSON_eth ( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 108 | |
Yo_Robot | 22:d5431fff164b | 109 | |
Yo_Robot | 22:d5431fff164b | 110 | /** @brief: Cambiar el angulo actual del eje del motor |
Yo_Robot | 22:d5431fff164b | 111 | */ |
Yo_Robot | 22:d5431fff164b | 112 | void setANG_eth( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 113 | |
Yo_Robot | 22:d5431fff164b | 114 | |
Yo_Robot | 22:d5431fff164b | 115 | /** @brief: Cambiar la velocidad de giro al cambiar el angulo del motor |
Yo_Robot | 22:d5431fff164b | 116 | */ |
Yo_Robot | 22:d5431fff164b | 117 | void setSPD_eth( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 118 | |
Yo_Robot | 22:d5431fff164b | 119 | |
Yo_Robot | 22:d5431fff164b | 120 | /** @brief: Leer desde el encoder |
Yo_Robot | 22:d5431fff164b | 121 | */ |
Yo_Robot | 22:d5431fff164b | 122 | void getENC_eth( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 123 | |
Yo_Robot | 22:d5431fff164b | 124 | |
Yo_Robot | 22:d5431fff164b | 125 | /** @brief: Leer desde el encoder |
Yo_Robot | 22:d5431fff164b | 126 | */ |
Yo_Robot | 22:d5431fff164b | 127 | void setENC_eth( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 128 | |
Yo_Robot | 22:d5431fff164b | 129 | |
Yo_Robot | 23:2126e38bb48c | 130 | /** @brief: Limpiar contador del encoder |
Yo_Robot | 23:2126e38bb48c | 131 | */ |
Yo_Robot | 23:2126e38bb48c | 132 | void getRPM_eth( char * input, char * output ); |
Yo_Robot | 23:2126e38bb48c | 133 | |
Yo_Robot | 22:d5431fff164b | 134 | |
Yo_Robot | 22:d5431fff164b | 135 | //________________ FUNCIONES ENCODER __________________// |
Yo_Robot | 22:d5431fff164b | 136 | |
Yo_Robot | 12:c02b08dacc45 | 137 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 12:c02b08dacc45 | 138 | */ |
Yo_Robot | 22:d5431fff164b | 139 | int read_encoder(); |
Yo_Robot | 12:c02b08dacc45 | 140 | |
Yo_Robot | 12:c02b08dacc45 | 141 | |
Yo_Robot | 15:a1ffa32ce9d1 | 142 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 15:a1ffa32ce9d1 | 143 | */ |
Yo_Robot | 22:d5431fff164b | 144 | void clear_encoder(); |
Yo_Robot | 15:a1ffa32ce9d1 | 145 | |
Yo_Robot | 12:c02b08dacc45 | 146 | |
Yo_Robot | 12:c02b08dacc45 | 147 | |
Yo_Robot | 4:552beeda4722 | 148 | // Legacy |
Yo_Robot | 4:552beeda4722 | 149 | void setMR3( int newValue ); |
Yo_Robot | 4:552beeda4722 | 150 | void setPrescaler( int newValue ); |
Yo_Robot | 20:4b154134ab20 | 151 | EthernetNetIf configurarEthernet(); |
Yo_Robot | 4:552beeda4722 | 152 | |
Yo_Robot | 4:552beeda4722 | 153 | |
Yo_Robot | 2:a1b556d78a7f | 154 | #endif |