Bluepill_Plantilla Es la plantilla base (mejorada) para soporte y compatibilidad en Mbed para la tarjeta "BluePill" basada en el procesador ARM M3 STM32F103C8T6
Dependencies: mbed
main.cpp@7:62b714b5d89d, 2022-02-22 (annotated)
- Committer:
- Antulius
- Date:
- Tue Feb 22 04:28:18 2022 +0000
- Revision:
- 7:62b714b5d89d
- Parent:
- 6:f47832fe0b07
Bluepill_Plantilla Es la plantilla base (mejorada) para soporte y compatibilidad en Mbed para la tarjeta "BluePill" basada en el procesador ARM M3 STM32F103C8T6
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Antulius | 4:e1e547c34929 | 1 | /* ############################################################################# |
Antulius | 0:9f7581d1af6f | 2 | ** Archivo : main.c |
Antulius | 5:e2fe0990d8ad | 3 | ** Proyecto : STM32F103C8_Plantilla_Enhenced |
Antulius | 4:e1e547c34929 | 4 | ** Procesador : STM32F103C8T6 |
Antulius | 4:e1e547c34929 | 5 | ** Plataforma : Blue Pill |
Antulius | 0:9f7581d1af6f | 6 | ** Herramienta : Mbed |
Antulius | 4:e1e547c34929 | 7 | ** Compilador : Mbed Online C Compiler |
Antulius | 4:e1e547c34929 | 8 | ** Version : Mbed-OS 5.15.0 |
Antulius | 4:e1e547c34929 | 9 | ** Fecha/Hora : 18-12-2019, 11:48, # CodeGen: 0 |
Antulius | 0:9f7581d1af6f | 10 | ** Descripción : |
Antulius | 0:9f7581d1af6f | 11 | ** Este proyecto hace... |
Antulius | 0:9f7581d1af6f | 12 | ** This module contains user's application code. |
Antulius | 6:f47832fe0b07 | 13 | ** Componentes : GPIO, Timer, PWM, etc . |
Antulius | 0:9f7581d1af6f | 14 | ** Configuraciones : Includes, Stacks y Drivers externos |
Antulius | 0:9f7581d1af6f | 15 | ** Autores : |
Antulius | 0:9f7581d1af6f | 16 | ** ATEAM Development Group: |
Antulius | 0:9f7581d1af6f | 17 | ** - Antulio Morgado Valle |
Antulius | 0:9f7581d1af6f | 18 | ** |
Antulius | 0:9f7581d1af6f | 19 | ** Versión : Beta |
Antulius | 0:9f7581d1af6f | 20 | ** Revisión : A |
Antulius | 0:9f7581d1af6f | 21 | ** Release : 0 |
Antulius | 0:9f7581d1af6f | 22 | ** Bugs & Fixes : |
Antulius | 0:9f7581d1af6f | 23 | ** Date : 20/10/2019 |
Antulius | 0:9f7581d1af6f | 24 | ** Added support for Led_RGB |
Antulius | 0:9f7581d1af6f | 25 | ** 22/09/2018 |
Antulius | 6:f47832fe0b07 | 26 | ** Added LCD Menu, Beta version |
Antulius | 0:9f7581d1af6f | 27 | ** |
Antulius | 0:9f7581d1af6f | 28 | ** ###########################################################################*/ |
Antulius | 0:9f7581d1af6f | 29 | /* |
Antulius | 0:9f7581d1af6f | 30 | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
Antulius | 6:f47832fe0b07 | 31 | : I N C L U D E S |
Antulius | 0:9f7581d1af6f | 32 | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
Antulius | 0:9f7581d1af6f | 33 | */ |
Antulius | 1:c0ed6c52c441 | 34 | #include "stm32f103c8t6.h" |
Antulius | 0:9f7581d1af6f | 35 | #include "mbed.h" |
Antulius | 5:e2fe0990d8ad | 36 | #include "Serial.h" |
Antulius | 0:9f7581d1af6f | 37 | //#include "AnalogIn.h" |
Antulius | 6:f47832fe0b07 | 38 | //#include "PwmOut.h" |
Antulius | 0:9f7581d1af6f | 39 | //#include "Led_RGB.h" |
Antulius | 5:e2fe0990d8ad | 40 | //#include <stdio.h> |
Antulius | 6:f47832fe0b07 | 41 | //#include <conio.h> |
Antulius | 6:f47832fe0b07 | 42 | //#include <stdlib.h> |
Antulius | 0:9f7581d1af6f | 43 | /* |
Antulius | 0:9f7581d1af6f | 44 | :............................................................................... |
Antulius | 6:f47832fe0b07 | 45 | : D E F I N I C I O N E S |
Antulius | 0:9f7581d1af6f | 46 | :............................................................................... |
Antulius | 0:9f7581d1af6f | 47 | */ |
Antulius | 6:f47832fe0b07 | 48 | #define LED_ON 0 // Estado para el Led Encendido |
Antulius | 6:f47832fe0b07 | 49 | #define LED_OFF 1 // Estado para el Led Apagado |
Antulius | 6:f47832fe0b07 | 50 | #define BUZZ_ON 1 // Estado para Buzzer Encendido |
Antulius | 6:f47832fe0b07 | 51 | #define BUZZ_OFF 0 // Estado para Buzzer Apagado |
Antulius | 6:f47832fe0b07 | 52 | #define ON 0 // Estado para boton presionado |
Antulius | 6:f47832fe0b07 | 53 | #define OFF 1 // Estado para boton sin presionar |
Antulius | 6:f47832fe0b07 | 54 | #define HOLD 2 // Estado para boton mantenido |
Antulius | 6:f47832fe0b07 | 55 | #define RELEASE 3 // Estado para boton liberado |
Antulius | 5:e2fe0990d8ad | 56 | #define FALSE 0 // Estado FALSO |
Antulius | 5:e2fe0990d8ad | 57 | #define TRUE 1 // Estado VERDADERO |
Antulius | 6:f47832fe0b07 | 58 | #define TICKER_RATE 1000 // Periodo de Interrupción (us) |
Antulius | 6:f47832fe0b07 | 59 | #define BAUD_RATE 115200 // Velocidad de Transmisión (Bauds) |
Antulius | 5:e2fe0990d8ad | 60 | // Velocidades Permitidas: |
Antulius | 5:e2fe0990d8ad | 61 | // 300, 600, 1200, 2400, 4800, 9600, |
Antulius | 5:e2fe0990d8ad | 62 | // 14400, 19600, 28800, 38400, 57600 |
Antulius | 5:e2fe0990d8ad | 63 | // 115200, 230400 |
Antulius | 0:9f7581d1af6f | 64 | /* |
Antulius | 6:f47832fe0b07 | 65 | +------------------------------------------------------------------------------+ |
Antulius | 6:f47832fe0b07 | 66 | | C O N F I G U R A C I O N D E P U E R T O S | |
Antulius | 6:f47832fe0b07 | 67 | +------------------------------------------------------------------------------+ |
Antulius | 6:f47832fe0b07 | 68 | */ |
Antulius | 6:f47832fe0b07 | 69 | Ticker TimerInt; // Inicializa la Interrupción por Timer |
Antulius | 6:f47832fe0b07 | 70 | DigitalOut Led_Monitor(LED1); // Inicializa el LED Monitor (Interno) |
Antulius | 6:f47832fe0b07 | 71 | DigitalOut Led_Testigo(PB_1); // Inicializa el LED Testigo (Externo) |
Antulius | 6:f47832fe0b07 | 72 | PwmOut Pwm1(PA_7); // Inicializa el PWM para el LED Externo |
Antulius | 6:f47832fe0b07 | 73 | PwmOut Buzzer(PB_0); // Inicializa el PWM para el Buzzer Externo |
Antulius | 7:62b714b5d89d | 74 | AnalogIn Sensor1(PA_1); // Inicializa Canal Analógico para Potenciometro 1 |
Antulius | 6:f47832fe0b07 | 75 | Serial Terminal(PA_2, PA_3); // Inicializa la Comunicación Serial a la PC (Rx, Tx) |
Antulius | 6:f47832fe0b07 | 76 | /* |
Antulius | 0:9f7581d1af6f | 77 | +------------------------------------------------------------------------------- |
Antulius | 6:f47832fe0b07 | 78 | | V A R I A B L E S G L O B A L E S | |
Antulius | 0:9f7581d1af6f | 79 | +------------------------------------------------------------------------------- |
Antulius | 0:9f7581d1af6f | 80 | */ |
Antulius | 6:f47832fe0b07 | 81 | uint16_t v_rate=TICKER_RATE/2; // Velocidad de barrido (500us = 0.5ms) |
Antulius | 6:f47832fe0b07 | 82 | uint16_t v_counter=250; // Cuenta inicial de 250us |
Antulius | 6:f47832fe0b07 | 83 | uint16_t v_blink=0; // Cuenta inical de parpadeos |
Antulius | 6:f47832fe0b07 | 84 | uint16_t v_cuenta=0; // Cuenta inical de parpadeos del LED |
Antulius | 0:9f7581d1af6f | 85 | /* END variables */ |
Antulius | 0:9f7581d1af6f | 86 | |
Antulius | 0:9f7581d1af6f | 87 | /* |
Antulius | 0:9f7581d1af6f | 88 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Antulius | 0:9f7581d1af6f | 89 | | Definición de Funciones Prototipo y Rutinas de los Vectores de Interrupción |
Antulius | 0:9f7581d1af6f | 90 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Antulius | 0:9f7581d1af6f | 91 | */ |
Antulius | 0:9f7581d1af6f | 92 | // Las Definiciones de Funciones Prototipo |
Antulius | 0:9f7581d1af6f | 93 | // y Apuntadores a Vectores de Interrupciones van aquí ! |
Antulius | 6:f47832fe0b07 | 94 | void TimerInt_OnInterrupt(void); |
Antulius | 0:9f7581d1af6f | 95 | void Blinking_Led(void); |
Antulius | 5:e2fe0990d8ad | 96 | void Clear_Screen(void); |
Antulius | 6:f47832fe0b07 | 97 | void Buzzer_Beep(void); |
Antulius | 6:f47832fe0b07 | 98 | void Setup(void); |
Antulius | 0:9f7581d1af6f | 99 | /* END prototypes */ |
Antulius | 0:9f7581d1af6f | 100 | |
Antulius | 6:f47832fe0b07 | 101 | /* END definitions */ |
Antulius | 0:9f7581d1af6f | 102 | /* |
Antulius | 0:9f7581d1af6f | 103 | #=============================================================================== |
Antulius | 6:f47832fe0b07 | 104 | || || |
Antulius | 6:f47832fe0b07 | 105 | || P R O G R A M A P R I N C I P A L || |
Antulius | 6:f47832fe0b07 | 106 | || || |
Antulius | 0:9f7581d1af6f | 107 | #=============================================================================== |
Antulius | 0:9f7581d1af6f | 108 | */ |
Antulius | 6:f47832fe0b07 | 109 | int main() // El código secuencial comienza aquí |
Antulius | 6:f47832fe0b07 | 110 | { |
Antulius | 6:f47832fe0b07 | 111 | //+++++++++++++++++++ Secuencia Principal +++++++++++++++++++++++++++++++++++++ |
Antulius | 6:f47832fe0b07 | 112 | // Inicialización de variables, puertos, interrupciones y carátula |
Antulius | 6:f47832fe0b07 | 113 | Setup(); // Inicialización de puertos, interrupciones y condiciones iniciales |
Antulius | 6:f47832fe0b07 | 114 | Clear_Screen(); // Limpia la pantalla de la Terminal |
Antulius | 6:f47832fe0b07 | 115 | //+++++++++++++++++++ Lazo Principal +++++++++++++++++++++++++++++++++++++++++++ |
Antulius | 6:f47832fe0b07 | 116 | // El Lazo del Programa principal está aquí !!! |
Antulius | 6:f47832fe0b07 | 117 | while (true) |
Antulius | 5:e2fe0990d8ad | 118 | { |
Antulius | 5:e2fe0990d8ad | 119 | Blinking_Led(); // Parapadeo del LED por Software |
Antulius | 6:f47832fe0b07 | 120 | Pwm1 = Sensor1.read(); // Lee el Potenciometro y cambia el PWM |
Antulius | 6:f47832fe0b07 | 121 | v_cuenta++; |
Antulius | 6:f47832fe0b07 | 122 | Terminal.printf("\rLED Testigo Parpadea %d Veces ... \n\r",v_cuenta); |
Antulius | 5:e2fe0990d8ad | 123 | } |
Antulius | 0:9f7581d1af6f | 124 | } |
Antulius | 0:9f7581d1af6f | 125 | /* END main */ |
Antulius | 0:9f7581d1af6f | 126 | |
Antulius | 0:9f7581d1af6f | 127 | /* |
Antulius | 6:f47832fe0b07 | 128 | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
Antulius | 6:f47832fe0b07 | 129 | :: |
Antulius | 6:f47832fe0b07 | 130 | :: V E C T O R E S D E I N T E R R U P C I Ó N |
Antulius | 6:f47832fe0b07 | 131 | :: (Rutinas de Atención a Interrupciones) |
Antulius | 6:f47832fe0b07 | 132 | :: |
Antulius | 6:f47832fe0b07 | 133 | :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
Antulius | 0:9f7581d1af6f | 134 | */ |
Antulius | 0:9f7581d1af6f | 135 | // Las Rutinas de Atención a Interrupciones van aquí ! |
Antulius | 5:e2fe0990d8ad | 136 | /* |
Antulius | 6:f47832fe0b07 | 137 | ** ============================================================================= |
Antulius | 5:e2fe0990d8ad | 138 | ** Vector : TimerInt_OnInterrupt() |
Antulius | 5:e2fe0990d8ad | 139 | */ |
Antulius | 5:e2fe0990d8ad | 140 | /*! |
Antulius | 5:e2fe0990d8ad | 141 | ** @brief |
Antulius | 5:e2fe0990d8ad | 142 | ** Called after Ticker is done, [Interrupt service/event] |
Antulius | 5:e2fe0990d8ad | 143 | ** and it is enabled: |
Antulius | 5:e2fe0990d8ad | 144 | ** TimerInt.attach_us(&TimerInt_OnInterrupt, Ticker_Rate); |
Antulius | 5:e2fe0990d8ad | 145 | ** the event is enabled and will be executed every [Ticker_Rate] |
Antulius | 5:e2fe0990d8ad | 146 | ** @param |
Antulius | 5:e2fe0990d8ad | 147 | ** UserDataPtr - Pointer to the user or |
Antulius | 5:e2fe0990d8ad | 148 | ** RTOS specific data. The pointer is passed |
Antulius | 5:e2fe0990d8ad | 149 | ** as the parameter of Init method. |
Antulius | 5:e2fe0990d8ad | 150 | */ |
Antulius | 6:f47832fe0b07 | 151 | /* ========================================================================== */ |
Antulius | 6:f47832fe0b07 | 152 | void TimerInt_OnInterrupt() // Rutina de Atención al Ticker |
Antulius | 0:9f7581d1af6f | 153 | { |
Antulius | 6:f47832fe0b07 | 154 | v_counter--; // Aquí va la Rutina de Servicio ! |
Antulius | 6:f47832fe0b07 | 155 | if (!v_counter) |
Antulius | 0:9f7581d1af6f | 156 | { |
Antulius | 6:f47832fe0b07 | 157 | v_blink++; |
Antulius | 6:f47832fe0b07 | 158 | Terminal.printf("\rLED Monitor Flashing %d Times !!! ",v_blink); |
Antulius | 6:f47832fe0b07 | 159 | Led_Monitor = !Led_Monitor; // Parapadeo del LED por Interrupción (LED Toggled) |
Antulius | 6:f47832fe0b07 | 160 | v_counter = v_rate; // Restablece el contador, Le asigna el periodo de 0.5ms (Rate=500) |
Antulius | 0:9f7581d1af6f | 161 | } |
Antulius | 0:9f7581d1af6f | 162 | } |
Antulius | 0:9f7581d1af6f | 163 | /* END Events */ |
Antulius | 0:9f7581d1af6f | 164 | /* |
Antulius | 6:f47832fe0b07 | 165 | ______________________________________________________________________________ |
Antulius | 6:f47832fe0b07 | 166 | /______________________________________________________________________________\ |
Antulius | 6:f47832fe0b07 | 167 | | | |
Antulius | 6:f47832fe0b07 | 168 | | F U N C I O N E S P R O T O T I P O | |
Antulius | 6:f47832fe0b07 | 169 | |______________________________________________________________________________| |
Antulius | 6:f47832fe0b07 | 170 | \______________________________________________________________________________/ |
Antulius | 0:9f7581d1af6f | 171 | */ |
Antulius | 0:9f7581d1af6f | 172 | // Las Funciones Prototipo van aquí ! |
Antulius | 5:e2fe0990d8ad | 173 | /* |
Antulius | 6:f47832fe0b07 | 174 | |------------------------------------------------------------------------------- |
Antulius | 6:f47832fe0b07 | 175 | | Función : Setup() |
Antulius | 6:f47832fe0b07 | 176 | | |
Antulius | 6:f47832fe0b07 | 177 | | Descripción : Inicialización de variables, puertos e interrupciones |
Antulius | 6:f47832fe0b07 | 178 | | |
Antulius | 6:f47832fe0b07 | 179 | | Parámetros : Ninguno |
Antulius | 6:f47832fe0b07 | 180 | | |
Antulius | 6:f47832fe0b07 | 181 | | Retorna : Nada |
Antulius | 6:f47832fe0b07 | 182 | |------------------------------------------------------------------------------- |
Antulius | 6:f47832fe0b07 | 183 | */ |
Antulius | 6:f47832fe0b07 | 184 | void Setup() |
Antulius | 6:f47832fe0b07 | 185 | { |
Antulius | 6:f47832fe0b07 | 186 | confSysClock(); // Inicialización del Sistema, Configure system clock (72MHz HSE clock, 48MHz USB clock) |
Antulius | 6:f47832fe0b07 | 187 | TimerInt.attach_us(&TimerInt_OnInterrupt, TICKER_RATE); // Le asigna el periodo de interrupción de 1ms (TICKER_RATE=1000) |
Antulius | 6:f47832fe0b07 | 188 | Terminal.baud(BAUD_RATE); // Se configura la velocidad de transmisión e inicia la comunicación serial. |
Antulius | 6:f47832fe0b07 | 189 | Terminal.printf("The System is Wake Up!.\n\r"); |
Antulius | 6:f47832fe0b07 | 190 | Buzzer_Beep(); // Prueba el Buzzer |
Antulius | 6:f47832fe0b07 | 191 | } |
Antulius | 6:f47832fe0b07 | 192 | /* |
Antulius | 6:f47832fe0b07 | 193 | |------------------------------------------------------------------------------- |
Antulius | 6:f47832fe0b07 | 194 | | Función : Blinking_Led() |
Antulius | 6:f47832fe0b07 | 195 | | |
Antulius | 6:f47832fe0b07 | 196 | | Descripción : Rutina para Parpadeo del Led por Software |
Antulius | 6:f47832fe0b07 | 197 | | |
Antulius | 6:f47832fe0b07 | 198 | | Parámetros : Ninguno |
Antulius | 6:f47832fe0b07 | 199 | | |
Antulius | 6:f47832fe0b07 | 200 | | Retorna : Nada |
Antulius | 6:f47832fe0b07 | 201 | |------------------------------------------------------------------------------- |
Antulius | 5:e2fe0990d8ad | 202 | */ |
Antulius | 0:9f7581d1af6f | 203 | void Blinking_Led() // Software Blinking routine for LED |
Antulius | 0:9f7581d1af6f | 204 | { |
Antulius | 0:9f7581d1af6f | 205 | // The on-board LED is connected, via a resistor, to +3.3V (not to GND). |
Antulius | 0:9f7581d1af6f | 206 | // So to turn the LED on or off we have to set it to 0 or 1 respectively |
Antulius | 7:62b714b5d89d | 207 | Led_Testigo = LED_ON; // turn the LED on (using Positive Logic) |
Antulius | 0:9f7581d1af6f | 208 | wait_ms(200); // 200 millisecond |
Antulius | 7:62b714b5d89d | 209 | Led_Testigo = LED_OFF; // turn the LED off (using Positive Logic) |
Antulius | 0:9f7581d1af6f | 210 | wait_ms(1000); // 1000 millisecond |
Antulius | 0:9f7581d1af6f | 211 | } |
Antulius | 6:f47832fe0b07 | 212 | |
Antulius | 5:e2fe0990d8ad | 213 | /* |
Antulius | 6:f47832fe0b07 | 214 | |------------------------------------------------------------------------------- |
Antulius | 6:f47832fe0b07 | 215 | | Función : Clear_Screen() |
Antulius | 6:f47832fe0b07 | 216 | | |
Antulius | 6:f47832fe0b07 | 217 | | Descripción : Limpia la Pantalla de la Terminal |
Antulius | 6:f47832fe0b07 | 218 | | |
Antulius | 6:f47832fe0b07 | 219 | | Parámetros : Ninguno |
Antulius | 6:f47832fe0b07 | 220 | | |
Antulius | 6:f47832fe0b07 | 221 | | Retorna : Nada |
Antulius | 6:f47832fe0b07 | 222 | |------------------------------------------------------------------------------- |
Antulius | 5:e2fe0990d8ad | 223 | */ |
Antulius | 5:e2fe0990d8ad | 224 | void Clear_Screen() |
Antulius | 5:e2fe0990d8ad | 225 | { |
Antulius | 5:e2fe0990d8ad | 226 | // ANSI Terminal Commands |
Antulius | 6:f47832fe0b07 | 227 | Terminal.printf("\x1B[2J"); // secuencia de Escape \e[2J |
Antulius | 6:f47832fe0b07 | 228 | Terminal.printf("\x1B[H"); // secuencia de Escape \e[H |
Antulius | 5:e2fe0990d8ad | 229 | } |
Antulius | 6:f47832fe0b07 | 230 | |
Antulius | 5:e2fe0990d8ad | 231 | /* |
Antulius | 6:f47832fe0b07 | 232 | |------------------------------------------------------------------------------- |
Antulius | 6:f47832fe0b07 | 233 | | Función : Buzzer_Beep() |
Antulius | 6:f47832fe0b07 | 234 | | |
Antulius | 6:f47832fe0b07 | 235 | | Descripción : Rutina para prueba del Buzzer |
Antulius | 6:f47832fe0b07 | 236 | | |
Antulius | 6:f47832fe0b07 | 237 | | Parámetros : Ninguno |
Antulius | 6:f47832fe0b07 | 238 | | |
Antulius | 6:f47832fe0b07 | 239 | | Retorna : Nada |
Antulius | 6:f47832fe0b07 | 240 | |------------------------------------------------------------------------------- |
Antulius | 5:e2fe0990d8ad | 241 | */ |
Antulius | 5:e2fe0990d8ad | 242 | void Buzzer_Beep() // Software routine for Buzzer Beep |
Antulius | 5:e2fe0990d8ad | 243 | { |
Antulius | 6:f47832fe0b07 | 244 | Terminal.printf("Testing Buzzer... \n\r"); |
Antulius | 6:f47832fe0b07 | 245 | Buzzer = BUZZ_ON; |
Antulius | 5:e2fe0990d8ad | 246 | wait_ms(750); |
Antulius | 6:f47832fe0b07 | 247 | Buzzer = BUZZ_OFF; |
Antulius | 5:e2fe0990d8ad | 248 | wait_ms(125); |
Antulius | 6:f47832fe0b07 | 249 | Buzzer = BUZZ_ON; |
Antulius | 5:e2fe0990d8ad | 250 | wait_ms(250); |
Antulius | 6:f47832fe0b07 | 251 | Buzzer = BUZZ_OFF; |
Antulius | 5:e2fe0990d8ad | 252 | wait_ms(125); |
Antulius | 6:f47832fe0b07 | 253 | Buzzer = BUZZ_ON; |
Antulius | 5:e2fe0990d8ad | 254 | wait_ms(500); |
Antulius | 6:f47832fe0b07 | 255 | Buzzer = BUZZ_OFF; |
Antulius | 6:f47832fe0b07 | 256 | Terminal.printf("Buzzer OK ! \n\r"); |
Antulius | 5:e2fe0990d8ad | 257 | } |
Antulius | 0:9f7581d1af6f | 258 | /* END functions */ |
Antulius | 0:9f7581d1af6f | 259 | |
Antulius | 0:9f7581d1af6f | 260 | /* END program */ |
Antulius | 0:9f7581d1af6f | 261 | |
Antulius | 6:f47832fe0b07 | 262 | /* |
Antulius | 6:f47832fe0b07 | 263 | *+****************************************************************************** |
Antulius | 6:f47832fe0b07 | 264 | *+ D O C U M E N T A C I Ó N |
Antulius | 6:f47832fe0b07 | 265 | *+****************************************************************************** |
Antulius | 6:f47832fe0b07 | 266 | *+ La documentación va aquí!: |
Antulius | 6:f47832fe0b07 | 267 | *+ |
Antulius | 6:f47832fe0b07 | 268 | *+------------------------------------------------------------------------------ |
Antulius | 6:f47832fe0b07 | 269 | *+ IDENTIFICADORES |
Antulius | 6:f47832fe0b07 | 270 | *+------------------------------------------------------------------------------ |
Antulius | 6:f47832fe0b07 | 271 | *+ |
Antulius | 6:f47832fe0b07 | 272 | *+ prefijo signifcado uso |
Antulius | 6:f47832fe0b07 | 273 | *+ v_ variable (var) v_nombre_variable |
Antulius | 6:f47832fe0b07 | 274 | *+ c_ constante (const) c_nombre_constante |
Antulius | 6:f47832fe0b07 | 275 | *+ i_ indice (index) i_nombre_indice |
Antulius | 6:f47832fe0b07 | 276 | *+ p_ apuntador (pointer) p_nombre_apuntador |
Antulius | 6:f47832fe0b07 | 277 | *+ l_ etiqueta (label) l_nombre_etiqueta |
Antulius | 6:f47832fe0b07 | 278 | *+ f_ función (function) f_nombre_funcion |
Antulius | 6:f47832fe0b07 | 279 | *+ |
Antulius | 6:f47832fe0b07 | 280 | *+------------------------------------------------------------------------------ |
Antulius | 0:9f7581d1af6f | 281 | *+ Conexión al Led Testigo: |
Antulius | 6:f47832fe0b07 | 282 | *+------------------------------------------------------------------------------ |
Antulius | 6:f47832fe0b07 | 283 | *+ |
Antulius | 0:9f7581d1af6f | 284 | *+ Los leds se pueden conectar a cualquier pin que se declare como DigitalOut. |
Antulius | 0:9f7581d1af6f | 285 | *+ El dispositivo puede drenar hasta 20ma por todas sus salidas a un voltaje de |
Antulius | 0:9f7581d1af6f | 286 | *+ 3.3V, pero se recomienda no exceder de 1mA por salida. |
Antulius | 0:9f7581d1af6f | 287 | *+ Esto se logra poniendo una resistencia limitadora de mínimo 330 Ohms. |
Antulius | 6:f47832fe0b07 | 288 | *+ |
Antulius | 0:9f7581d1af6f | 289 | *+ 3.3V o 5V |
Antulius | 0:9f7581d1af6f | 290 | *+ O |
Antulius | 0:9f7581d1af6f | 291 | *+ | |
Antulius | 0:9f7581d1af6f | 292 | *+ | |
Antulius | 0:9f7581d1af6f | 293 | *+ / |
Antulius | 0:9f7581d1af6f | 294 | *+ \ 1K |
Antulius | 0:9f7581d1af6f | 295 | *+ / |
Antulius | 0:9f7581d1af6f | 296 | *+ \ UTILIZANDO LÓGICA NEGATIVA |
Antulius | 0:9f7581d1af6f | 297 | *+ | |
Antulius | 0:9f7581d1af6f | 298 | *+ ___|___ |
Antulius | 0:9f7581d1af6f | 299 | *+ \ / |
Antulius | 0:9f7581d1af6f | 300 | *+ \ / |
Antulius | 0:9f7581d1af6f | 301 | *+ \ / |
Antulius | 0:9f7581d1af6f | 302 | *+ __\/__ |
Antulius | 0:9f7581d1af6f | 303 | *+ | |
Antulius | 0:9f7581d1af6f | 304 | *+ |__________________________ PIN (Digital Out) |
Antulius | 0:9f7581d1af6f | 305 | *+ |
Antulius | 6:f47832fe0b07 | 306 | *+ |
Antulius | 6:f47832fe0b07 | 307 | *+ |
Antulius | 6:f47832fe0b07 | 308 | *+ |
Antulius | 0:9f7581d1af6f | 309 | *+ 1K |
Antulius | 6:f47832fe0b07 | 310 | *+ |
Antulius | 0:9f7581d1af6f | 311 | *+ _________/\ /\ /\ _____ PIN (Digital Out) |
Antulius | 0:9f7581d1af6f | 312 | *+ | \/ \/ \/ |
Antulius | 6:f47832fe0b07 | 313 | *+ | |
Antulius | 0:9f7581d1af6f | 314 | *+ | |
Antulius | 0:9f7581d1af6f | 315 | *+ ___|___ |
Antulius | 0:9f7581d1af6f | 316 | *+ \ / |
Antulius | 0:9f7581d1af6f | 317 | *+ \ / |
Antulius | 0:9f7581d1af6f | 318 | *+ \ / UTILIZANDO LÓGICA POSITIVA |
Antulius | 0:9f7581d1af6f | 319 | *+ __\/__ |
Antulius | 0:9f7581d1af6f | 320 | *+ | |
Antulius | 0:9f7581d1af6f | 321 | *+ | |
Antulius | 0:9f7581d1af6f | 322 | *+ | |
Antulius | 0:9f7581d1af6f | 323 | *+ ___|___ |
Antulius | 0:9f7581d1af6f | 324 | *+ _____ |
Antulius | 0:9f7581d1af6f | 325 | *+ ___ |
Antulius | 0:9f7581d1af6f | 326 | *+ _ |
Antulius | 0:9f7581d1af6f | 327 | *+ |
Antulius | 0:9f7581d1af6f | 328 | *+ GND |
Antulius | 0:9f7581d1af6f | 329 | *+ |
Antulius | 6:f47832fe0b07 | 330 | *+------------------------------------------------------------------------------ |
Antulius | 6:f47832fe0b07 | 331 | *+ Descripción del Conexionado para el Buzzer Piezo-Eléctrico |
Antulius | 6:f47832fe0b07 | 332 | *+------------------------------------------------------------------------------ |
Antulius | 6:f47832fe0b07 | 333 | *+ |
Antulius | 6:f47832fe0b07 | 334 | *+ 100 |
Antulius | 6:f47832fe0b07 | 335 | *+ PWM Pin -----/\/\/\/-------| |
Antulius | 6:f47832fe0b07 | 336 | *+ | |
Antulius | 6:f47832fe0b07 | 337 | *+ | + |
Antulius | 6:f47832fe0b07 | 338 | *+ ( ) |
Antulius | 6:f47832fe0b07 | 339 | *+ ( o ) BUZZER |
Antulius | 6:f47832fe0b07 | 340 | *+ ( ) |
Antulius | 6:f47832fe0b07 | 341 | *+ | |
Antulius | 6:f47832fe0b07 | 342 | *+ | |
Antulius | 6:f47832fe0b07 | 343 | *+ | |
Antulius | 6:f47832fe0b07 | 344 | *+ ----- |
Antulius | 6:f47832fe0b07 | 345 | *+ --- |
Antulius | 6:f47832fe0b07 | 346 | *+ - |
Antulius | 6:f47832fe0b07 | 347 | *+ |
Antulius | 6:f47832fe0b07 | 348 | *+------------------------------------------------------------------------------ |
Antulius | 6:f47832fe0b07 | 349 | *+ Conexión al Potenciometro: |
Antulius | 6:f47832fe0b07 | 350 | *+ |
Antulius | 6:f47832fe0b07 | 351 | *+ Como recomendación hay que poner un filtro pasa bajas para evitar que el |
Antulius | 6:f47832fe0b07 | 352 | *+ ruido al convertidor analógico/digital. |
Antulius | 6:f47832fe0b07 | 353 | *+ |
Antulius | 6:f47832fe0b07 | 354 | *+ 3.3V |
Antulius | 6:f47832fe0b07 | 355 | *+ O |
Antulius | 6:f47832fe0b07 | 356 | *+ | |
Antulius | 6:f47832fe0b07 | 357 | *+ | |
Antulius | 6:f47832fe0b07 | 358 | *+ | Conexión de los Potenciometros |
Antulius | 6:f47832fe0b07 | 359 | *+ | |
Antulius | 6:f47832fe0b07 | 360 | *+ / |
Antulius | 6:f47832fe0b07 | 361 | *+ \ 10K |
Antulius | 6:f47832fe0b07 | 362 | *+ / 100 |
Antulius | 6:f47832fe0b07 | 363 | *+ \ <----/\/\/\/\--------------> PIN (AnalogIn Pin) |
Antulius | 6:f47832fe0b07 | 364 | *+ \ | |
Antulius | 6:f47832fe0b07 | 365 | *+ / | |
Antulius | 6:f47832fe0b07 | 366 | *+ \ ----- 0.1uF |
Antulius | 6:f47832fe0b07 | 367 | *+ | ----- |
Antulius | 6:f47832fe0b07 | 368 | *+ | | |
Antulius | 6:f47832fe0b07 | 369 | *+ | | |
Antulius | 6:f47832fe0b07 | 370 | *+ | | |
Antulius | 6:f47832fe0b07 | 371 | *+ ___|___ ___|___ |
Antulius | 6:f47832fe0b07 | 372 | *+ _____ _____ |
Antulius | 6:f47832fe0b07 | 373 | *+ ___ ___ |
Antulius | 6:f47832fe0b07 | 374 | *+ _ _ |
Antulius | 6:f47832fe0b07 | 375 | *+ |
Antulius | 6:f47832fe0b07 | 376 | *+ GND GND |
Antulius | 6:f47832fe0b07 | 377 | *+ |
Antulius | 6:f47832fe0b07 | 378 | *+ |
Antulius | 6:f47832fe0b07 | 379 | *+ Conexión al Joy Stick Keyes |
Antulius | 6:f47832fe0b07 | 380 | *+ |
Antulius | 6:f47832fe0b07 | 381 | *+ 1 2 3 4 5 |
Antulius | 6:f47832fe0b07 | 382 | *+ GND Vcc VrX VrY SW |
Antulius | 6:f47832fe0b07 | 383 | *+ |
Antulius | 6:f47832fe0b07 | 384 | *+ |
Antulius | 6:f47832fe0b07 | 385 | *+ |
Antulius | 6:f47832fe0b07 | 386 | *+------------------------------------------------------------------------------ |
Antulius | 6:f47832fe0b07 | 387 | *+ Conexión hacia la Terminal Serial: |
Antulius | 6:f47832fe0b07 | 388 | *+------------------------------------------------------------------------------ |
Antulius | 6:f47832fe0b07 | 389 | *+ |
Antulius | 6:f47832fe0b07 | 390 | *+ Los Transeptores recomedados para se pueden conectar a los siguientes pines |
Antulius | 6:f47832fe0b07 | 391 | *+ de las UART's que posee la Bluepill por medio del siguiente conexionado. |
Antulius | 6:f47832fe0b07 | 392 | *+ |
Antulius | 6:f47832fe0b07 | 393 | *+ UART1 UART2 UART3 CABLE CP2102 PL2303 CH340G FT232RL |
Antulius | 6:f47832fe0b07 | 394 | *+ PA_9 PA_2 PB_10 Tx ------> Rx 3 2 2 3 |
Antulius | 6:f47832fe0b07 | 395 | *+ PA_10 PA_3 PB_11 Rx <------ Tx 4 3 3 2 |
Antulius | 6:f47832fe0b07 | 396 | *+ 3V ------ 3V 5 5 4 1 |
Antulius | 6:f47832fe0b07 | 397 | *+ GND ------ GND 2 1 1 4 |
Antulius | 6:f47832fe0b07 | 398 | *+------------------------------------------------------------------------------ |
Antulius | 0:9f7581d1af6f | 399 | *+ |
Antulius | 0:9f7581d1af6f | 400 | *+ Powered by |
Antulius | 0:9f7581d1af6f | 401 | *+ |
Antulius | 0:9f7581d1af6f | 402 | *+ T H E A N T U L I U ' S T E A M R&D Unltd |
Antulius | 0:9f7581d1af6f | 403 | *+ |
Antulius | 0:9f7581d1af6f | 404 | *+ Research, Development, Systems, Equipment, Support & Spare Parts. |
Antulius | 6:f47832fe0b07 | 405 | *+ (C) Copyright 1989-2019, All Rights Reserved |
Antulius | 0:9f7581d1af6f | 406 | *+ |
Antulius | 6:f47832fe0b07 | 407 | *+ Welcome to The Beaners Proyect Community! |
Antulius | 0:9f7581d1af6f | 408 | *+----------------------------------------------------------------------------*/ |
Antulius | 0:9f7581d1af6f | 409 | |
Antulius | 3:1ccbb37e3828 | 410 | /* END documentation */ |
Antulius | 3:1ccbb37e3828 | 411 | |
Antulius | 6:f47832fe0b07 | 412 | /* END Mbed */ |