![](/media/cache/profiles/e32084632d369461572832e6582aac36.50x50_q85.jpg)
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@37:20f4a737cc13, 2014-07-17 (annotated)
- Committer:
- Yo_Robot
- Date:
- Thu Jul 17 17:12:41 2014 +0000
- Revision:
- 37:20f4a737cc13
- Parent:
- 34:bdf918bc9b59
Programa final para el deslizador lineal UTN. version 2.0 - documentaci?n escibir a mecatronica.mid@gmail.com
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 | 30:413d1a6648b5 | 18 | #include "HTTPServer.h" |
Yo_Robot | 30:413d1a6648b5 | 19 | #include "RPCFunction.h" |
Yo_Robot | 30:413d1a6648b5 | 20 | #include "RPCVariable.h" |
Yo_Robot | 18:cf1e07d82630 | 21 | |
Yo_Robot | 4:552beeda4722 | 22 | /** @brief: Esta funcion configura al Timer2 |
Yo_Robot | 4:552beeda4722 | 23 | * para que las salidas p5 y p6 del mbed |
Yo_Robot | 4:552beeda4722 | 24 | * se alternen cada vez que se iguala al |
Yo_Robot | 4:552beeda4722 | 25 | * registro MR2 y MR3. |
Yo_Robot | 4:552beeda4722 | 26 | */ |
Yo_Robot | 4:552beeda4722 | 27 | void setTimer2(); |
Yo_Robot | 4:552beeda4722 | 28 | |
Yo_Robot | 4:552beeda4722 | 29 | |
Yo_Robot | 30:413d1a6648b5 | 30 | /** @brief: Esta es la rutina que cambia la frecuencia |
Yo_Robot | 30:413d1a6648b5 | 31 | * de salida del Micro en Serial |
Yo_Robot | 30:413d1a6648b5 | 32 | */ |
Yo_Robot | 30:413d1a6648b5 | 33 | void setPTO( int freq ); |
Yo_Robot | 30:413d1a6648b5 | 34 | |
Yo_Robot | 30:413d1a6648b5 | 35 | |
Yo_Robot | 20:4b154134ab20 | 36 | /** @brief: Esta es la rutina para obtener la onfiguracion |
Yo_Robot | 20:4b154134ab20 | 37 | * de la velocidad serial para el puerto MAX_232 |
Yo_Robot | 20:4b154134ab20 | 38 | */ |
Yo_Robot | 21:353b0fe8fc54 | 39 | int configurarBaudios(); |
Yo_Robot | 20:4b154134ab20 | 40 | |
Yo_Robot | 20:4b154134ab20 | 41 | |
Yo_Robot | 4:552beeda4722 | 42 | /** @brief: Esta es la rutina que maneja las interrupciones |
Yo_Robot | 4:552beeda4722 | 43 | * seriales, al recibir un caracter. |
Yo_Robot | 4:552beeda4722 | 44 | */ |
Yo_Robot | 2:a1b556d78a7f | 45 | void ISR_Serial(); |
Yo_Robot | 2:a1b556d78a7f | 46 | |
Yo_Robot | 4:552beeda4722 | 47 | |
Yo_Robot | 30:413d1a6648b5 | 48 | /** @brief: Esta es la rutina que maneja las interrupciones |
Yo_Robot | 30:413d1a6648b5 | 49 | * seriales, al recibir un caracter. |
Yo_Robot | 30:413d1a6648b5 | 50 | */ |
Yo_Robot | 30:413d1a6648b5 | 51 | void ISR_Alm_encoder(); |
Yo_Robot | 30:413d1a6648b5 | 52 | |
Yo_Robot | 30:413d1a6648b5 | 53 | |
Yo_Robot | 30:413d1a6648b5 | 54 | /** @brief: Esta es la rutina que maneja las interrupciones |
Yo_Robot | 30:413d1a6648b5 | 55 | * seriales, al recibir un caracter. |
Yo_Robot | 4:552beeda4722 | 56 | */ |
Yo_Robot | 30:413d1a6648b5 | 57 | void ISR_Alm_motor(); |
Yo_Robot | 30:413d1a6648b5 | 58 | |
Yo_Robot | 30:413d1a6648b5 | 59 | |
Yo_Robot | 30:413d1a6648b5 | 60 | /** @brief: Esta es la rutina que maneja las interrupciones |
Yo_Robot | 30:413d1a6648b5 | 61 | * seriales, al recibir un caracter. |
Yo_Robot | 30:413d1a6648b5 | 62 | */ |
Yo_Robot | 30:413d1a6648b5 | 63 | void ISR_Adv_encoder(); |
Yo_Robot | 30:413d1a6648b5 | 64 | |
Yo_Robot | 30:413d1a6648b5 | 65 | |
Yo_Robot | 30:413d1a6648b5 | 66 | /** @brief: Esta es la rutina que maneja las interrupciones |
Yo_Robot | 30:413d1a6648b5 | 67 | * seriales, al recibir un caracter. |
Yo_Robot | 30:413d1a6648b5 | 68 | */ |
Yo_Robot | 30:413d1a6648b5 | 69 | void ISR_Adv_motor(); |
Yo_Robot | 4:552beeda4722 | 70 | |
Yo_Robot | 4:552beeda4722 | 71 | |
Yo_Robot | 12:c02b08dacc45 | 72 | /** @brief: Esta es la rutina que maneja la interrupcion |
Yo_Robot | 30:413d1a6648b5 | 73 | * de alarma del servomotor |
Yo_Robot | 4:552beeda4722 | 74 | */ |
Yo_Robot | 12:c02b08dacc45 | 75 | void ISR_Alarm(); |
Yo_Robot | 2:a1b556d78a7f | 76 | |
Yo_Robot | 4:552beeda4722 | 77 | |
Yo_Robot | 30:413d1a6648b5 | 78 | |
Yo_Robot | 4:552beeda4722 | 79 | /** @brief: Esta Funcion calcula el valor necesario |
Yo_Robot | 4:552beeda4722 | 80 | * en el MatchRegister para obtener una frecuencia |
Yo_Robot | 4:552beeda4722 | 81 | * de salida. |
Yo_Robot | 4:552beeda4722 | 82 | * @param fout Frecuencia de salida deseada |
Yo_Robot | 4:552beeda4722 | 83 | * @return El valor que debe tener el MatchRegister |
Yo_Robot | 4:552beeda4722 | 84 | */ |
Yo_Robot | 4:552beeda4722 | 85 | int getMRvalue( int fout ); |
Yo_Robot | 4:552beeda4722 | 86 | |
Yo_Robot | 4:552beeda4722 | 87 | |
Yo_Robot | 21:353b0fe8fc54 | 88 | |
Yo_Robot | 21:353b0fe8fc54 | 89 | /** @brief: Esta es la rutina que maneja la interrupcion |
Yo_Robot | 21:353b0fe8fc54 | 90 | * de alarma |
Yo_Robot | 21:353b0fe8fc54 | 91 | */ |
Yo_Robot | 21:353b0fe8fc54 | 92 | int getBaud(); |
Yo_Robot | 21:353b0fe8fc54 | 93 | |
Yo_Robot | 21:353b0fe8fc54 | 94 | |
Yo_Robot | 21:353b0fe8fc54 | 95 | |
Yo_Robot | 12:c02b08dacc45 | 96 | /** @brief: Esta Funcion cambia el valor del Registro 2 |
Yo_Robot | 12:c02b08dacc45 | 97 | */ |
Yo_Robot | 12:c02b08dacc45 | 98 | void setMR2( int newValue ); |
Yo_Robot | 12:c02b08dacc45 | 99 | |
Yo_Robot | 12:c02b08dacc45 | 100 | |
Yo_Robot | 12:c02b08dacc45 | 101 | /** @brief: Esta Funcion arranca el timer |
Yo_Robot | 12:c02b08dacc45 | 102 | */ |
Yo_Robot | 12:c02b08dacc45 | 103 | void startTimer2(); |
Yo_Robot | 12:c02b08dacc45 | 104 | |
Yo_Robot | 12:c02b08dacc45 | 105 | |
Yo_Robot | 12:c02b08dacc45 | 106 | /** @brief: Esta Funcion detiene el timer |
Yo_Robot | 12:c02b08dacc45 | 107 | */ |
Yo_Robot | 12:c02b08dacc45 | 108 | void stopTimer2(); |
Yo_Robot | 12:c02b08dacc45 | 109 | |
Yo_Robot | 12:c02b08dacc45 | 110 | |
Yo_Robot | 22:d5431fff164b | 111 | //________________ FUNCIONES ETHERNET ___________________// |
Yo_Robot | 22:d5431fff164b | 112 | |
Yo_Robot | 22:d5431fff164b | 113 | |
Yo_Robot | 22:d5431fff164b | 114 | /** @brief: Esta es la rutina que cambia la frecuencia |
Yo_Robot | 22:d5431fff164b | 115 | * de salida del Micro en comunicacion Ethernet |
Yo_Robot | 22:d5431fff164b | 116 | */ |
Yo_Robot | 22:d5431fff164b | 117 | void setPTO_eth ( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 118 | |
Yo_Robot | 22:d5431fff164b | 119 | |
Yo_Robot | 12:c02b08dacc45 | 120 | /** @brief: Esta Funcion cambia el voltaje de salida el |
Yo_Robot | 12:c02b08dacc45 | 121 | * valor ingresado debe ser en porcentaje. |
Yo_Robot | 12:c02b08dacc45 | 122 | * Desde -100% hasta +100% dependiendo de la velocidad |
Yo_Robot | 12:c02b08dacc45 | 123 | * y el sentido de giro |
Yo_Robot | 12:c02b08dacc45 | 124 | */ |
Yo_Robot | 12:c02b08dacc45 | 125 | void setAout_eth( char * input, char * output ); |
Yo_Robot | 12:c02b08dacc45 | 126 | |
Yo_Robot | 12:c02b08dacc45 | 127 | |
Yo_Robot | 12:c02b08dacc45 | 128 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 12:c02b08dacc45 | 129 | */ |
Yo_Robot | 12:c02b08dacc45 | 130 | void setDir_eth ( char * input, char * output ); |
Yo_Robot | 12:c02b08dacc45 | 131 | |
Yo_Robot | 12:c02b08dacc45 | 132 | |
Yo_Robot | 22:d5431fff164b | 133 | /** @brief: Encender el Servo (bloquearlo) |
Yo_Robot | 22:d5431fff164b | 134 | */ |
Yo_Robot | 22:d5431fff164b | 135 | void setSON_eth ( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 136 | |
Yo_Robot | 22:d5431fff164b | 137 | |
Yo_Robot | 22:d5431fff164b | 138 | /** @brief: Cambiar el angulo actual del eje del motor |
Yo_Robot | 22:d5431fff164b | 139 | */ |
Yo_Robot | 22:d5431fff164b | 140 | void setANG_eth( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 141 | |
Yo_Robot | 22:d5431fff164b | 142 | |
Yo_Robot | 22:d5431fff164b | 143 | /** @brief: Cambiar la velocidad de giro al cambiar el angulo del motor |
Yo_Robot | 22:d5431fff164b | 144 | */ |
Yo_Robot | 22:d5431fff164b | 145 | void setSPD_eth( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 146 | |
Yo_Robot | 22:d5431fff164b | 147 | |
Yo_Robot | 22:d5431fff164b | 148 | /** @brief: Leer desde el encoder |
Yo_Robot | 22:d5431fff164b | 149 | */ |
Yo_Robot | 22:d5431fff164b | 150 | void getENC_eth( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 151 | |
Yo_Robot | 22:d5431fff164b | 152 | |
Yo_Robot | 22:d5431fff164b | 153 | /** @brief: Leer desde el encoder |
Yo_Robot | 22:d5431fff164b | 154 | */ |
Yo_Robot | 22:d5431fff164b | 155 | void setENC_eth( char * input, char * output ); |
Yo_Robot | 22:d5431fff164b | 156 | |
Yo_Robot | 22:d5431fff164b | 157 | |
Yo_Robot | 23:2126e38bb48c | 158 | /** @brief: Limpiar contador del encoder |
Yo_Robot | 23:2126e38bb48c | 159 | */ |
Yo_Robot | 23:2126e38bb48c | 160 | void getRPM_eth( char * input, char * output ); |
Yo_Robot | 23:2126e38bb48c | 161 | |
Yo_Robot | 22:d5431fff164b | 162 | |
Yo_Robot | 32:4483d6c225e5 | 163 | /** @brief: Lleva el carro hasta el inicio del recorrido y encera el encoder |
Yo_Robot | 32:4483d6c225e5 | 164 | */ |
Yo_Robot | 32:4483d6c225e5 | 165 | void setHOME_eth( char * input, char * output ); |
Yo_Robot | 32:4483d6c225e5 | 166 | |
Yo_Robot | 32:4483d6c225e5 | 167 | |
Yo_Robot | 34:bdf918bc9b59 | 168 | /** @brief: Comprueba el estado de las alarmas |
Yo_Robot | 34:bdf918bc9b59 | 169 | */ |
Yo_Robot | 34:bdf918bc9b59 | 170 | void getALM_eth ( char * input, char * output ); |
Yo_Robot | 34:bdf918bc9b59 | 171 | |
Yo_Robot | 22:d5431fff164b | 172 | //________________ FUNCIONES ENCODER __________________// |
Yo_Robot | 22:d5431fff164b | 173 | |
Yo_Robot | 12:c02b08dacc45 | 174 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 12:c02b08dacc45 | 175 | */ |
Yo_Robot | 22:d5431fff164b | 176 | int read_encoder(); |
Yo_Robot | 12:c02b08dacc45 | 177 | |
Yo_Robot | 12:c02b08dacc45 | 178 | |
Yo_Robot | 15:a1ffa32ce9d1 | 179 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 15:a1ffa32ce9d1 | 180 | */ |
Yo_Robot | 22:d5431fff164b | 181 | void clear_encoder(); |
Yo_Robot | 15:a1ffa32ce9d1 | 182 | |
Yo_Robot | 12:c02b08dacc45 | 183 | |
Yo_Robot | 12:c02b08dacc45 | 184 | |
Yo_Robot | 4:552beeda4722 | 185 | // Legacy |
Yo_Robot | 4:552beeda4722 | 186 | void setMR3( int newValue ); |
Yo_Robot | 4:552beeda4722 | 187 | void setPrescaler( int newValue ); |
Yo_Robot | 20:4b154134ab20 | 188 | EthernetNetIf configurarEthernet(); |
Yo_Robot | 4:552beeda4722 | 189 | |
Yo_Robot | 4:552beeda4722 | 190 | |
Yo_Robot | 2:a1b556d78a7f | 191 | #endif |