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@18:cf1e07d82630, 2012-05-09 (annotated)
- Committer:
- Yo_Robot
- Date:
- Wed May 09 20:51:10 2012 +0000
- Revision:
- 18:cf1e07d82630
- Parent:
- 16:d50665706f21
- Child:
- 20:4b154134ab20
No se puede configurar ethernet aun, el objeto debe ser global... espero q todavia se pueda...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yo_Robot | 2:a1b556d78a7f | 1 | |
Yo_Robot | 2:a1b556d78a7f | 2 | #ifndef SETUP_H |
Yo_Robot | 2:a1b556d78a7f | 3 | #define SETUP_H |
Yo_Robot | 2:a1b556d78a7f | 4 | |
Yo_Robot | 2:a1b556d78a7f | 5 | #include "mbed.h" |
Yo_Robot | 18:cf1e07d82630 | 6 | #include "EthernetNetIf.h" |
Yo_Robot | 18:cf1e07d82630 | 7 | |
Yo_Robot | 18:cf1e07d82630 | 8 | /** @brief: Esta funcion configura el protocolo |
Yo_Robot | 18:cf1e07d82630 | 9 | * ethernet, deacuerdo al archivo de configuracion |
Yo_Robot | 18:cf1e07d82630 | 10 | * config.txt en la flash del microcontrolador la |
Yo_Robot | 18:cf1e07d82630 | 11 | * misma que se usa para programar el microcontrolador |
Yo_Robot | 18:cf1e07d82630 | 12 | */ |
Yo_Robot | 18:cf1e07d82630 | 13 | EthernetNetIf configurarEthernet(); |
Yo_Robot | 2:a1b556d78a7f | 14 | |
Yo_Robot | 4:552beeda4722 | 15 | |
Yo_Robot | 4:552beeda4722 | 16 | /** @brief: Esta funcion configura al Timer2 |
Yo_Robot | 4:552beeda4722 | 17 | * para que las salidas p5 y p6 del mbed |
Yo_Robot | 4:552beeda4722 | 18 | * se alternen cada vez que se iguala al |
Yo_Robot | 4:552beeda4722 | 19 | * registro MR2 y MR3. |
Yo_Robot | 4:552beeda4722 | 20 | */ |
Yo_Robot | 4:552beeda4722 | 21 | void setTimer2(); |
Yo_Robot | 4:552beeda4722 | 22 | |
Yo_Robot | 4:552beeda4722 | 23 | |
Yo_Robot | 4:552beeda4722 | 24 | /** @brief: Esta es la rutina que maneja las interrupciones |
Yo_Robot | 4:552beeda4722 | 25 | * seriales, al recibir un caracter. |
Yo_Robot | 4:552beeda4722 | 26 | */ |
Yo_Robot | 2:a1b556d78a7f | 27 | void ISR_Serial(); |
Yo_Robot | 2:a1b556d78a7f | 28 | |
Yo_Robot | 4:552beeda4722 | 29 | |
Yo_Robot | 12:c02b08dacc45 | 30 | /** @brief: Esta es la rutina que cambia la frecuencia |
Yo_Robot | 12:c02b08dacc45 | 31 | * de salida del Micro en Serial |
Yo_Robot | 4:552beeda4722 | 32 | */ |
Yo_Robot | 12:c02b08dacc45 | 33 | void setPTO( int freq ); |
Yo_Robot | 4:552beeda4722 | 34 | |
Yo_Robot | 4:552beeda4722 | 35 | |
Yo_Robot | 12:c02b08dacc45 | 36 | /** @brief: Esta es la rutina que cambia la frecuencia |
Yo_Robot | 12:c02b08dacc45 | 37 | * de salida del Micro en comunicacion Ethernet |
Yo_Robot | 4:552beeda4722 | 38 | */ |
Yo_Robot | 12:c02b08dacc45 | 39 | void setPTO_eth ( char * input, char * output ); |
Yo_Robot | 4:552beeda4722 | 40 | |
Yo_Robot | 4:552beeda4722 | 41 | |
Yo_Robot | 12:c02b08dacc45 | 42 | /** @brief: Esta es la rutina que maneja la interrupcion |
Yo_Robot | 12:c02b08dacc45 | 43 | * de alarma |
Yo_Robot | 4:552beeda4722 | 44 | */ |
Yo_Robot | 12:c02b08dacc45 | 45 | void ISR_Alarm(); |
Yo_Robot | 2:a1b556d78a7f | 46 | |
Yo_Robot | 4:552beeda4722 | 47 | |
Yo_Robot | 4:552beeda4722 | 48 | /** @brief: Esta Funcion calcula el valor necesario |
Yo_Robot | 4:552beeda4722 | 49 | * en el MatchRegister para obtener una frecuencia |
Yo_Robot | 4:552beeda4722 | 50 | * de salida. |
Yo_Robot | 4:552beeda4722 | 51 | * @param fout Frecuencia de salida deseada |
Yo_Robot | 4:552beeda4722 | 52 | * @return El valor que debe tener el MatchRegister |
Yo_Robot | 4:552beeda4722 | 53 | */ |
Yo_Robot | 4:552beeda4722 | 54 | int getMRvalue( int fout ); |
Yo_Robot | 4:552beeda4722 | 55 | |
Yo_Robot | 4:552beeda4722 | 56 | |
Yo_Robot | 12:c02b08dacc45 | 57 | /** @brief: Esta Funcion cambia el valor del Registro 2 |
Yo_Robot | 12:c02b08dacc45 | 58 | */ |
Yo_Robot | 12:c02b08dacc45 | 59 | void setMR2( int newValue ); |
Yo_Robot | 12:c02b08dacc45 | 60 | |
Yo_Robot | 12:c02b08dacc45 | 61 | |
Yo_Robot | 12:c02b08dacc45 | 62 | /** @brief: Esta Funcion arranca el timer |
Yo_Robot | 12:c02b08dacc45 | 63 | */ |
Yo_Robot | 12:c02b08dacc45 | 64 | void startTimer2(); |
Yo_Robot | 12:c02b08dacc45 | 65 | |
Yo_Robot | 12:c02b08dacc45 | 66 | |
Yo_Robot | 12:c02b08dacc45 | 67 | /** @brief: Esta Funcion detiene el timer |
Yo_Robot | 12:c02b08dacc45 | 68 | */ |
Yo_Robot | 12:c02b08dacc45 | 69 | void stopTimer2(); |
Yo_Robot | 12:c02b08dacc45 | 70 | |
Yo_Robot | 12:c02b08dacc45 | 71 | |
Yo_Robot | 12:c02b08dacc45 | 72 | /** @brief: Esta Funcion cambia el voltaje de salida el |
Yo_Robot | 12:c02b08dacc45 | 73 | * valor ingresado debe ser en porcentaje. |
Yo_Robot | 12:c02b08dacc45 | 74 | * Desde -100% hasta +100% dependiendo de la velocidad |
Yo_Robot | 12:c02b08dacc45 | 75 | * y el sentido de giro |
Yo_Robot | 12:c02b08dacc45 | 76 | */ |
Yo_Robot | 12:c02b08dacc45 | 77 | void setAout_eth( char * input, char * output ); |
Yo_Robot | 12:c02b08dacc45 | 78 | |
Yo_Robot | 12:c02b08dacc45 | 79 | |
Yo_Robot | 12:c02b08dacc45 | 80 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 12:c02b08dacc45 | 81 | */ |
Yo_Robot | 12:c02b08dacc45 | 82 | void setDir_eth ( char * input, char * output ); |
Yo_Robot | 12:c02b08dacc45 | 83 | |
Yo_Robot | 12:c02b08dacc45 | 84 | |
Yo_Robot | 12:c02b08dacc45 | 85 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 12:c02b08dacc45 | 86 | */ |
Yo_Robot | 12:c02b08dacc45 | 87 | void setSON_eth ( char * input, char * output ); |
Yo_Robot | 12:c02b08dacc45 | 88 | |
Yo_Robot | 12:c02b08dacc45 | 89 | |
Yo_Robot | 15:a1ffa32ce9d1 | 90 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 15:a1ffa32ce9d1 | 91 | */ |
Yo_Robot | 15:a1ffa32ce9d1 | 92 | void setANG_eth( char * input, char * output ); |
Yo_Robot | 15:a1ffa32ce9d1 | 93 | |
Yo_Robot | 15:a1ffa32ce9d1 | 94 | |
Yo_Robot | 15:a1ffa32ce9d1 | 95 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 15:a1ffa32ce9d1 | 96 | */ |
Yo_Robot | 16:d50665706f21 | 97 | void setSPD_eth( char * input, char * output ); |
Yo_Robot | 15:a1ffa32ce9d1 | 98 | |
Yo_Robot | 15:a1ffa32ce9d1 | 99 | |
Yo_Robot | 15:a1ffa32ce9d1 | 100 | /** @brief: Cambiar Direccion @ PTO |
Yo_Robot | 15:a1ffa32ce9d1 | 101 | */ |
Yo_Robot | 16:d50665706f21 | 102 | void getENC_eth( char * input, char * output ); |
Yo_Robot | 12:c02b08dacc45 | 103 | |
Yo_Robot | 12:c02b08dacc45 | 104 | |
Yo_Robot | 4:552beeda4722 | 105 | // Legacy |
Yo_Robot | 4:552beeda4722 | 106 | void setMR3( int newValue ); |
Yo_Robot | 4:552beeda4722 | 107 | void setPrescaler( int newValue ); |
Yo_Robot | 4:552beeda4722 | 108 | |
Yo_Robot | 4:552beeda4722 | 109 | |
Yo_Robot | 2:a1b556d78a7f | 110 | #endif |