4cv4

Dependencies:   mbed

Committer:
arelicayetano
Date:
Wed Nov 20 00:31:15 2019 +0000
Revision:
0:d515a22efe9d
4cv4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
arelicayetano 0:d515a22efe9d 1 /* #############################################################################
arelicayetano 0:d515a22efe9d 2 ** Archivo : main.c
arelicayetano 0:d515a22efe9d 3 ** Proyecto : STM32-103C8_Barrido_Displays
arelicayetano 0:d515a22efe9d 4 ** Procesador : STM32F103C8
arelicayetano 0:d515a22efe9d 5 ** Herramienta : Mbed
arelicayetano 0:d515a22efe9d 6 ** Compilador : Mbed Online C Compiler
arelicayetano 0:d515a22efe9d 7 ** Version : 5.14
arelicayetano 0:d515a22efe9d 8 ** Descripción :
arelicayetano 0:d515a22efe9d 9 ** Este proyecto provee lo necesario para el despliegue de números y
arelicayetano 0:d515a22efe9d 10 ** caracteres en un display de 7 segmentos.
arelicayetano 0:d515a22efe9d 11 ** Contiene un Generador de Caracteres y las rutinas de Barrido para un
arelicayetano 0:d515a22efe9d 12 ** Display de 7 segmentos de Ánodo Común de 4 dígitos.
arelicayetano 0:d515a22efe9d 13 ** This module contains user's application code.
arelicayetano 0:d515a22efe9d 14 ** Componentes : GPIO, Ticker, Terminal Serial.
arelicayetano 0:d515a22efe9d 15 ** Configuraciones :
arelicayetano 0:d515a22efe9d 16 ** Modo 0.- Despliega números de hasta cuatro digitos
arelicayetano 0:d515a22efe9d 17 ** Modo 1.- Despliega una cadena de caracteres con desplazamiento a la
arelicayetano 0:d515a22efe9d 18 ** Izquierda.
arelicayetano 0:d515a22efe9d 19 ** Modo 2.- Realiza el Parpadeo (Blinking) del valor que se esta
arelicayetano 0:d515a22efe9d 20 ** deplegando (por implementar)
arelicayetano 0:d515a22efe9d 21 **
arelicayetano 0:d515a22efe9d 22 ** Autores :
arelicayetano 0:d515a22efe9d 23 ** ATEAM Development Group:
arelicayetano 0:d515a22efe9d 24 ** - Antulio Morgado Valle
arelicayetano 0:d515a22efe9d 25 **
arelicayetano 0:d515a22efe9d 26 ** Versión : Beta
arelicayetano 0:d515a22efe9d 27 ** Revisión : A
arelicayetano 0:d515a22efe9d 28 ** Release : 0
arelicayetano 0:d515a22efe9d 29 ** Bugs & Fixes :
arelicayetano 0:d515a22efe9d 30 ** Date : 20/10/2019
arelicayetano 0:d515a22efe9d 31 ** Added support for Shift Messages
arelicayetano 0:d515a22efe9d 32 **
arelicayetano 0:d515a22efe9d 33 ** ###########################################################################*/
arelicayetano 0:d515a22efe9d 34 /*
arelicayetano 0:d515a22efe9d 35 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
arelicayetano 0:d515a22efe9d 36 : Includes
arelicayetano 0:d515a22efe9d 37 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
arelicayetano 0:d515a22efe9d 38 */
arelicayetano 0:d515a22efe9d 39 #include "stm32f103c8t6.h"
arelicayetano 0:d515a22efe9d 40 #include "mbed.h"
arelicayetano 0:d515a22efe9d 41 //#include "AnalogIn.h"
arelicayetano 0:d515a22efe9d 42 //#include "ADC.h"
arelicayetano 0:d515a22efe9d 43 //#include "Led_RGB.h"
arelicayetano 0:d515a22efe9d 44 #include "Serial.h"
arelicayetano 0:d515a22efe9d 45 //#include "TextLCD.h"
arelicayetano 0:d515a22efe9d 46 //#include "I2C.h"
arelicayetano 0:d515a22efe9d 47 //#include "SPI.h"
arelicayetano 0:d515a22efe9d 48 #include "stdio.h"
arelicayetano 0:d515a22efe9d 49 /*
arelicayetano 0:d515a22efe9d 50 :...............................................................................
arelicayetano 0:d515a22efe9d 51 : Definiciones
arelicayetano 0:d515a22efe9d 52 :...............................................................................
arelicayetano 0:d515a22efe9d 53 */
arelicayetano 0:d515a22efe9d 54 #define on 0 // Estado para boton presionado
arelicayetano 0:d515a22efe9d 55 #define off 1 // Estado para boton sin presionar
arelicayetano 0:d515a22efe9d 56 #define hold 2 // Estado para boton mantenido
arelicayetano 0:d515a22efe9d 57 #define release 3 // Estado para boton liberado
arelicayetano 0:d515a22efe9d 58 #define FALSE 0 // Estado FALSO
arelicayetano 0:d515a22efe9d 59 #define TRUE 1 // Estado VERDADERO
arelicayetano 0:d515a22efe9d 60 #define Ticker_Rate 1000 // Periodo de interrupción (us)
arelicayetano 0:d515a22efe9d 61 #define Rate_Time 2 // Tiempo de Encendido de los Digitos (ms)
arelicayetano 0:d515a22efe9d 62 #define Scan_Time 2 // Tiempo de Barrido del Display (ms)
arelicayetano 0:d515a22efe9d 63 #define Shift_Time 10 // Tiempo de corrimiento (x Counter_Time)
arelicayetano 0:d515a22efe9d 64 #define Counter_Time 100 // Tiempo de counter (ms)
arelicayetano 0:d515a22efe9d 65 #define Size_String 20 // Tamaño del Buffer de Caracteres
arelicayetano 0:d515a22efe9d 66 #define Digit_Null 0xFF // Valor para apagar los Segmentos
arelicayetano 0:d515a22efe9d 67 #define Degree_Symbol 0x0F // Valor para el Símbolo de Grados
arelicayetano 0:d515a22efe9d 68 /*
arelicayetano 0:d515a22efe9d 69 +-------------------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 70 | Configuración de Puertos
arelicayetano 0:d515a22efe9d 71 +-------------------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 72 */
arelicayetano 0:d515a22efe9d 73
arelicayetano 0:d515a22efe9d 74 DigitalOut led_monitor(LED1); // Inicializa el Led de Monitor
arelicayetano 0:d515a22efe9d 75 PwmOut buzzer (PB_1); // PWM para el Buzzer
arelicayetano 0:d515a22efe9d 76 AnalogIn sensor1 (PA_0); // Canal Analógico para sensor 1
arelicayetano 0:d515a22efe9d 77 AnalogIn sensor2 (PA_1); // Canal Analógico para sensor 2
arelicayetano 0:d515a22efe9d 78 BusIn Teclado (PB_5,PB_6,PB_7,PB_8); // Teclado Matricial
arelicayetano 0:d515a22efe9d 79 BusOut Anodos (PB_12, PB_13, PB_14, PB_15); // Anodos: (Uni Dec Cent Mill) A1 A2 A3 A4
arelicayetano 0:d515a22efe9d 80 BusOut Catodos (PA_8,PA_9,PA_10,PA_11,PA_12,PA_15,PB_3,PB_4); // Cátodos: p e d c b a f g (lsb -> msb))
arelicayetano 0:d515a22efe9d 81 // ***** Host PC Terminal Communication channels
arelicayetano 0:d515a22efe9d 82 Serial Terminal (PA_2, PA_3); // Inicializa la comunicación serial a la PC (Tx,Rx)
arelicayetano 0:d515a22efe9d 83 //Serial Terminal(USBTX, USBRX,115200);// Tx, Rx Baud Rate - Terminal Serial por USB @ 115,200 Bauds
arelicayetano 0:d515a22efe9d 84 // ***** I2C Communication
arelicayetano 0:d515a22efe9d 85 //I2C i2c_LCD(PB_9,PB_8,); // SDA, SCL
arelicayetano 0:d515a22efe9d 86 // ***** SPI Communication
arelicayetano 0:d515a22efe9d 87 //SPI spi_LCD(PA_7,PA_6,PA_5,PB_6); // MOSI, MISO, SCLK, SS
arelicayetano 0:d515a22efe9d 88 Ticker Barrido; // Interrupción por Timer
arelicayetano 0:d515a22efe9d 89 /*
arelicayetano 0:d515a22efe9d 90 ** -------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 91 ** Instanciación del LCD
arelicayetano 0:d515a22efe9d 92 ** -------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 93 */
arelicayetano 0:d515a22efe9d 94 // LCD instantiation
arelicayetano 0:d515a22efe9d 95 //TextLCD lcd(PTC5, PTC6, PTC8, PTC9, PTC10, PCT11, TextLCD::LCD20x2); // 4bit bus: rs, e, d4-d7
arelicayetano 0:d515a22efe9d 96 //TextLCD_SPI lcd(&spi_LCD, PB_6, TextLCD::LCD16x4, TextLCD::AC780); // SPI bus, CS, LCD Type
arelicayetano 0:d515a22efe9d 97 //TextLCD_I2C lcd(&i2c_LCD, 0x7E, TextLCD::LCD20x4); // I2C bus, PCF8574A Arduino Shield, LCD Type
arelicayetano 0:d515a22efe9d 98
arelicayetano 0:d515a22efe9d 99 /*
arelicayetano 0:d515a22efe9d 100 +-------------------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 101 | Variables Globales de Usuario
arelicayetano 0:d515a22efe9d 102 +-------------------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 103 */
arelicayetano 0:d515a22efe9d 104 uint16_t Rate=1000; // Velocidad de barrido (1000us = 1ms)
arelicayetano 0:d515a22efe9d 105 // ++++++++++++++++++++ Generador de Caracteres ++++++++++++++++++++++++++++++++
arelicayetano 0:d515a22efe9d 106 // Offset: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
arelicayetano 0:d515a22efe9d 107 //Caracter a Desplegar: 0 1 2 3 4 5 6 7 8 9 A b C d E f G h I j K L M n o P q r S t u V W X y Z space a e /e @ ñ [ ] U /U /_ - _ _/_ /= = == ° +/c +n +/c +u o c n /c u ^ ¬ + > ^ / v < v > i +i /i +/i ii +ii # /# J /J -J -/J | || | + /+ F +F /F +/F null ! " # $ % & ' ( ) * + - . / : ; < > ? @
arelicayetano 0:d515a22efe9d 108 uint8_t Segmentos[]={0x81,0xE7,0x49,0x43,0x27,0x13,0x11,0xC7,0x01,0x03,0x05,0x31,0x99,0x61,0x19,0x1D,0x91,0x35,0xBD,0xE3,0x2D,0xB9,0x85,0x75,0x71,0x0D,0x07,0x7D,0x13,0x39,0xF1,0xB1,0xA1,0x25,0x23,0x49,0xFF,0x41,0x09,0x03,0x11,0x55,0x99,0xC3,0xA1,0x85,0xDF,0x7F,0xFB,0xDB,0x7B,0x5F,0x5B,0x0F,0x1F,0x8F,0x4F,0x2F,0x71,0x79,0x75,0x73,0xF1,0x3F,0x9F,0xCF,0x6F,0x7D,0xF9,0xF3,0x77,0xFD,0xBF,0xF7,0xEF,0xF5,0xAF,0x6D,0x37,0xE3,0xB9,0x9D,0xC7,0xBD,0xA5,0xE7,0x3D,0x67,0x1D,0x47,0x63,0x39,0x00};
arelicayetano 0:d515a22efe9d 109 // ++++++++++++++++++++++ Selector de Digitos ++++++++++++++++++++++++++++++++++
arelicayetano 0:d515a22efe9d 110 uint8_t Digitos[]={0x08,0x04,0x02,0x01,0x00,0x0F}; // Millares, Centenas, Decenas, Unidades, Apagados, Encendidos
arelicayetano 0:d515a22efe9d 111 uint8_t Numeros[]={1,0,2,4}; // Valor a Desplegar
arelicayetano 0:d515a22efe9d 112 uint8_t Cadena[]={33,0,21,10,36,14,28,18,22,14,36,35,10,12,10,29,14,23,12,24,36,36,36}; // Mensaje a Desplegar
arelicayetano 0:d515a22efe9d 113 uint8_t punto_decimal=0; // Posición del punto decimal: 0=sin punto, 1=unidades, 2=decenas, 3=centemas 4=millares,
arelicayetano 0:d515a22efe9d 114 uint8_t cont_1ms; // Contador de milésimas de Segundo
arelicayetano 0:d515a22efe9d 115 uint8_t cont_10ms; // Contador de centésimas de Segundo
arelicayetano 0:d515a22efe9d 116 uint8_t cont_100ms; // Contador de décimas de Segundo
arelicayetano 0:d515a22efe9d 117 uint8_t cont_1s; // Contador de Segundos
arelicayetano 0:d515a22efe9d 118 uint8_t scan_rate = Scan_Time ;
arelicayetano 0:d515a22efe9d 119 uint8_t shift_rate= Shift_Time;
arelicayetano 0:d515a22efe9d 120 uint8_t display_rate=10; // Display Rate = 10ms
arelicayetano 0:d515a22efe9d 121 uint16_t counter=1250;
arelicayetano 0:d515a22efe9d 122 uint8_t i=0;
arelicayetano 0:d515a22efe9d 123 uint8_t nchar=0;
arelicayetano 0:d515a22efe9d 124 bool mode=0;
arelicayetano 0:d515a22efe9d 125 bool flag1=FALSE;
arelicayetano 0:d515a22efe9d 126 bool flag2=FALSE;
arelicayetano 0:d515a22efe9d 127
arelicayetano 0:d515a22efe9d 128 /*
arelicayetano 0:d515a22efe9d 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
arelicayetano 0:d515a22efe9d 130 | Definición de Funciones Prototipo y Rutinas de los Vectores de Interrupción
arelicayetano 0:d515a22efe9d 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
arelicayetano 0:d515a22efe9d 132 */
arelicayetano 0:d515a22efe9d 133 void Barrido_OnInterrupt(void);
arelicayetano 0:d515a22efe9d 134 /* END definitions */
arelicayetano 0:d515a22efe9d 135
arelicayetano 0:d515a22efe9d 136 /*
arelicayetano 0:d515a22efe9d 137 #===============================================================================
arelicayetano 0:d515a22efe9d 138 |
arelicayetano 0:d515a22efe9d 139 | P R O G R A M A P R I N C I P A L
arelicayetano 0:d515a22efe9d 140 |
arelicayetano 0:d515a22efe9d 141 #===============================================================================
arelicayetano 0:d515a22efe9d 142 */
arelicayetano 0:d515a22efe9d 143 int main()
arelicayetano 0:d515a22efe9d 144 { // Inicialización de variables, puertos e interrupciones
arelicayetano 0:d515a22efe9d 145 confSysClock(); // Configure system clock (72MHz HSE clock, 48MHz USB clock)
arelicayetano 0:d515a22efe9d 146 Barrido.attach_us(&Barrido_OnInterrupt, Rate); // Le asigna el periodo de barrido de 1ms (Rate=1000)
arelicayetano 0:d515a22efe9d 147 Terminal.baud(115200); // Se configura la velocodad de transmisión
arelicayetano 0:d515a22efe9d 148 Terminal.printf("\e[2J"); // Clear Screen
arelicayetano 0:d515a22efe9d 149 Terminal.printf(" System is Wake Up!.\n\r"); // e inicia la comunicación serial
arelicayetano 0:d515a22efe9d 150 Terminal.printf ("\t\e[1;37;41mInstituto Politecnico Nacional\e[0m\n\r");
arelicayetano 0:d515a22efe9d 151 Terminal.printf ("\e[1;37;42mESCUELA SUPERIOR DE INGENIERIA MECANICA Y ELECTRICA\e[0m\n\r\v");
arelicayetano 0:d515a22efe9d 152 Terminal.printf ("\t\e[1;34;40mBarrido \e[1;37;40mdel \e[1;32;40mDisplay \e[1;33;40mde \e[1;31;40m7 Segmentos\e[0m\n\r\v\v\e[0m");
arelicayetano 0:d515a22efe9d 153
arelicayetano 0:d515a22efe9d 154 Terminal.printf ("\nSelecciona el Modo de Operacion:\n\r");
arelicayetano 0:d515a22efe9d 155 Terminal.printf ("Modo 0 = Normal (4 Digitos)\n\r");
arelicayetano 0:d515a22efe9d 156 Terminal.printf ("Modo 1 = Corrimiento \n\r");
arelicayetano 0:d515a22efe9d 157
arelicayetano 0:d515a22efe9d 158 while (TRUE) // El Lazo del Programa principal está aquí !!!
arelicayetano 0:d515a22efe9d 159 {
arelicayetano 0:d515a22efe9d 160 if (flag1==TRUE) // Está puesta la Bandera 1 ?
arelicayetano 0:d515a22efe9d 161 {
arelicayetano 0:d515a22efe9d 162 if (mode==1) // Está en modo 1? (corrimiento de mensaje)
arelicayetano 0:d515a22efe9d 163 {
arelicayetano 0:d515a22efe9d 164 Numeros[i]=Cadena[i+nchar];// Copia 4 caracteres al buffer de despliegue
arelicayetano 0:d515a22efe9d 165 if (nchar >= Size_String) nchar=0; // Restablece el contador de caractres
arelicayetano 0:d515a22efe9d 166 if (i==4) //
arelicayetano 0:d515a22efe9d 167 {
arelicayetano 0:d515a22efe9d 168 i=0; //
arelicayetano 0:d515a22efe9d 169 mode=0; //
arelicayetano 0:d515a22efe9d 170 }
arelicayetano 0:d515a22efe9d 171 }
arelicayetano 0:d515a22efe9d 172 //------------------ Barrido de los Digitos ------------------------
arelicayetano 0:d515a22efe9d 173 /* ................. Display de Ánodo Común ........................
arelicayetano 0:d515a22efe9d 174 */
arelicayetano 0:d515a22efe9d 175 Anodos= Digitos[4]; // Apaga todos los Digitos (Evita fantasmas)
arelicayetano 0:d515a22efe9d 176 Catodos= Segmentos[Numeros[i]]; // Actualiza los segmentos
arelicayetano 0:d515a22efe9d 177 if (i==4-punto_decimal) Catodos=(Segmentos[Numeros[i]]& 0xFE); // Enciende el punto decimal
arelicayetano 0:d515a22efe9d 178 Anodos= Digitos[i]; // Activa el Digito en cuestión
arelicayetano 0:d515a22efe9d 179
arelicayetano 0:d515a22efe9d 180 /* ................. Display de Cátodo Común ........................
arelicayetano 0:d515a22efe9d 181 Anodos= 0x0F - (Digitos[4]); // Apaga todos los Digitos (Evita fantasmas)
arelicayetano 0:d515a22efe9d 182 Catodos= 0x0FF - (Segmentos[Numeros[i]]); // Actualiza los segmentos
arelicayetano 0:d515a22efe9d 183 if (i==4-punto_decimal) Catodos=(Segmentos[Numeros[i]]& 0xFE); // Enciende el punto decimal
arelicayetano 0:d515a22efe9d 184 Anodos= 0x0F - (Digitos[i]); // Activa el Digito en cuestión
arelicayetano 0:d515a22efe9d 185 */
arelicayetano 0:d515a22efe9d 186 i++; // Apunta al siguiente dígito
arelicayetano 0:d515a22efe9d 187 if (i==4) // Es el últino dígito?
arelicayetano 0:d515a22efe9d 188 {
arelicayetano 0:d515a22efe9d 189 i=0; // Reinicia el Barriodo
arelicayetano 0:d515a22efe9d 190 }
arelicayetano 0:d515a22efe9d 191 flag1=FALSE; // Apaga la Bandera 1
arelicayetano 0:d515a22efe9d 192 }
arelicayetano 0:d515a22efe9d 193
arelicayetano 0:d515a22efe9d 194 //------------------ Corrimiento de los Digitos ------------------------
arelicayetano 0:d515a22efe9d 195 if (flag2==TRUE) // Está puesta la Bandera 2?
arelicayetano 0:d515a22efe9d 196 {
arelicayetano 0:d515a22efe9d 197 shift_rate--; // Decrementa el contador de Corrimientos
arelicayetano 0:d515a22efe9d 198 if (!shift_rate) // Es Cero?
arelicayetano 0:d515a22efe9d 199 {
arelicayetano 0:d515a22efe9d 200 mode=1; // Tiempo entre desplazamientos del mensaje
arelicayetano 0:d515a22efe9d 201 shift_rate = Shift_Time;// Restablece el tiempo de los corrimientos
arelicayetano 0:d515a22efe9d 202 nchar++; // corrimiento al siguiente conjunto de de caracteres
arelicayetano 0:d515a22efe9d 203 i=0; // Restablece el barrido de los digitos
arelicayetano 0:d515a22efe9d 204 }
arelicayetano 0:d515a22efe9d 205 led_monitor=!led_monitor; // parapadeo del led_monitor
arelicayetano 0:d515a22efe9d 206 flag2=FALSE; // Limpia la Bandera 2
arelicayetano 0:d515a22efe9d 207 }
arelicayetano 0:d515a22efe9d 208 }
arelicayetano 0:d515a22efe9d 209 }
arelicayetano 0:d515a22efe9d 210 /* END main */
arelicayetano 0:d515a22efe9d 211
arelicayetano 0:d515a22efe9d 212 /*
arelicayetano 0:d515a22efe9d 213 ................................................................................
arelicayetano 0:d515a22efe9d 214 : Rutinas de los Vectores de Interrupción
arelicayetano 0:d515a22efe9d 215 ................................................................................
arelicayetano 0:d515a22efe9d 216 */
arelicayetano 0:d515a22efe9d 217 void Barrido_OnInterrupt() // Rutina de Atención al Ticker
arelicayetano 0:d515a22efe9d 218 {
arelicayetano 0:d515a22efe9d 219 cont_1ms++; // Incrmenta el contador de milisegundos
arelicayetano 0:d515a22efe9d 220 counter--; // Decrementa el contador de eventos
arelicayetano 0:d515a22efe9d 221 scan_rate--; // Decrementa el tiempo de despliege
arelicayetano 0:d515a22efe9d 222 if(!scan_rate) // Se acabo el tiempo de desplige?
arelicayetano 0:d515a22efe9d 223 {
arelicayetano 0:d515a22efe9d 224 scan_rate=Scan_Time; // Se restable el tiempo de despliegue
arelicayetano 0:d515a22efe9d 225 flag1=TRUE; // Enciende la bandera para las rutinas de despliege
arelicayetano 0:d515a22efe9d 226 }
arelicayetano 0:d515a22efe9d 227 if (cont_1ms>=10) // Son 10ms?
arelicayetano 0:d515a22efe9d 228 {
arelicayetano 0:d515a22efe9d 229 cont_10ms++; // Incrementa el contador de decimas de ms
arelicayetano 0:d515a22efe9d 230 cont_1ms=0; // Restablece el contador de ms
arelicayetano 0:d515a22efe9d 231 }
arelicayetano 0:d515a22efe9d 232 if (cont_10ms>=10) // Son 100ms?
arelicayetano 0:d515a22efe9d 233 {
arelicayetano 0:d515a22efe9d 234 cont_100ms++; // Incrementa el contador de centecimas de ms
arelicayetano 0:d515a22efe9d 235 cont_10ms=0; // Restablece el contador de decimas de seg
arelicayetano 0:d515a22efe9d 236 }
arelicayetano 0:d515a22efe9d 237 if (cont_100ms>=10) // Son 1000ms o sea 1 seg?
arelicayetano 0:d515a22efe9d 238 {
arelicayetano 0:d515a22efe9d 239 cont_1s++; // Incrementa el contador de segundos
arelicayetano 0:d515a22efe9d 240 cont_100ms=0; // Restablece el contador de centesimas de seg
arelicayetano 0:d515a22efe9d 241 }
arelicayetano 0:d515a22efe9d 242 if (cont_1s>=10) // Son 10seg?
arelicayetano 0:d515a22efe9d 243 {
arelicayetano 0:d515a22efe9d 244 cont_1s=0; // Restablece el contador de segundos
arelicayetano 0:d515a22efe9d 245 }
arelicayetano 0:d515a22efe9d 246 if (!counter)
arelicayetano 0:d515a22efe9d 247 {
arelicayetano 0:d515a22efe9d 248 counter=Counter_Time; // Restablece el contador de eventos
arelicayetano 0:d515a22efe9d 249 flag2=TRUE;
arelicayetano 0:d515a22efe9d 250 }
arelicayetano 0:d515a22efe9d 251 }
arelicayetano 0:d515a22efe9d 252 /* END Events */
arelicayetano 0:d515a22efe9d 253 /*
arelicayetano 0:d515a22efe9d 254 ________________________________________________________________________________
arelicayetano 0:d515a22efe9d 255 |
arelicayetano 0:d515a22efe9d 256 | Funciones Prototipo
arelicayetano 0:d515a22efe9d 257 |_______________________________________________________________________________
arelicayetano 0:d515a22efe9d 258 */
arelicayetano 0:d515a22efe9d 259 // Las Funciones Prototipo van aquí !
arelicayetano 0:d515a22efe9d 260
arelicayetano 0:d515a22efe9d 261
arelicayetano 0:d515a22efe9d 262 /* END program */
arelicayetano 0:d515a22efe9d 263 /*+-----------------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 264 *+ Descripción del Display de 7 Segmentos de Anodos Comunes en modo multiplexado
arelicayetano 0:d515a22efe9d 265 *+------------------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 266 *+ 13 12 11 10 9 8
arelicayetano 0:d515a22efe9d 267 *+ | | | | | |
arelicayetano 0:d515a22efe9d 268 *+ | | | | | |
arelicayetano 0:d515a22efe9d 269 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 270 *+ | A a f A A b |
arelicayetano 0:d515a22efe9d 271 *+ | 4 3 2 |
arelicayetano 0:d515a22efe9d 272 *+ | ______________________________________________ |
arelicayetano 0:d515a22efe9d 273 *+ | | ____ ____ _____ _____ | |
arelicayetano 0:d515a22efe9d 274 *+ | | / / / / / / / / | |
arelicayetano 0:d515a22efe9d 275 *+ | | /____ / /____ / . /____ / /____ / | |
arelicayetano 0:d515a22efe9d 276 *+ | | / / / / . / / / / | |
arelicayetano 0:d515a22efe9d 277 *+ | | /____ /. /_____/ . /____ /. /____ /. | |
arelicayetano 0:d515a22efe9d 278 *+ | | | |
arelicayetano 0:d515a22efe9d 279 *+ | |______________________________________________| |
arelicayetano 0:d515a22efe9d 280 *+ | |
arelicayetano 0:d515a22efe9d 281 *+ | A |
arelicayetano 0:d515a22efe9d 282 *+ | e d p c g 1 |
arelicayetano 0:d515a22efe9d 283 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 284 *+ | | | | | | |
arelicayetano 0:d515a22efe9d 285 *+ | | | | | | |
arelicayetano 0:d515a22efe9d 286 *+ 1 2 3 4 5 6 7
arelicayetano 0:d515a22efe9d 287 *+
arelicayetano 0:d515a22efe9d 288 *+ Display: HS410561K-D30
arelicayetano 0:d515a22efe9d 289 *+
arelicayetano 0:d515a22efe9d 290 *+
arelicayetano 0:d515a22efe9d 291 *+ 13 12 11 10 9 8
arelicayetano 0:d515a22efe9d 292 *+ | | | | | |
arelicayetano 0:d515a22efe9d 293 *+ | | | | | |
arelicayetano 0:d515a22efe9d 294 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 295 *+ | A g f p a b |
arelicayetano 0:d515a22efe9d 296 *+ | 4 |
arelicayetano 0:d515a22efe9d 297 *+ | ______________________________________________ |
arelicayetano 0:d515a22efe9d 298 *+ | | ____ ____ _____ _____ | |
arelicayetano 0:d515a22efe9d 299 *+ | | / / / / / / / / | |
arelicayetano 0:d515a22efe9d 300 *+ | | /____ / /____ / . /____ / /____ / | |
arelicayetano 0:d515a22efe9d 301 *+ | | / / / / . / / / / | |
arelicayetano 0:d515a22efe9d 302 *+ | | /____ /. /_____/ /____ /. /____ /. | |
arelicayetano 0:d515a22efe9d 303 *+ | | | |
arelicayetano 0:d515a22efe9d 304 *+ | |______________________________________________| |
arelicayetano 0:d515a22efe9d 305 *+ | |
arelicayetano 0:d515a22efe9d 306 *+ | A A A |
arelicayetano 0:d515a22efe9d 307 *+ | e 3 2 c d 1 |
arelicayetano 0:d515a22efe9d 308 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 309 *+ | | | | | | |
arelicayetano 0:d515a22efe9d 310 *+ | | | | | | |
arelicayetano 0:d515a22efe9d 311 *+ 1 2 3 4 5 6 7
arelicayetano 0:d515a22efe9d 312 *+
arelicayetano 0:d515a22efe9d 313 *+ Display: BQ-M544RE
arelicayetano 0:d515a22efe9d 314 *+
arelicayetano 0:d515a22efe9d 315 *+
arelicayetano 0:d515a22efe9d 316 *+ 12 11 10 9 8 7
arelicayetano 0:d515a22efe9d 317 *+ | | | | | |
arelicayetano 0:d515a22efe9d 318 *+ | | | | | |
arelicayetano 0:d515a22efe9d 319 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 320 *+ | A a f A A b |
arelicayetano 0:d515a22efe9d 321 *+ | 4 3 2 |
arelicayetano 0:d515a22efe9d 322 *+ | ______________________________________________ |
arelicayetano 0:d515a22efe9d 323 *+ | | ____ ____ _____ . _____ | |
arelicayetano 0:d515a22efe9d 324 *+ | | / / / / / / / / | |
arelicayetano 0:d515a22efe9d 325 *+ | | /____ / /____ / . /____ / /____ / | |
arelicayetano 0:d515a22efe9d 326 *+ | | / / / / . / / / / | |
arelicayetano 0:d515a22efe9d 327 *+ | | /____ /. /_____/ . /____ /. /____ /. | |
arelicayetano 0:d515a22efe9d 328 *+ | | | |
arelicayetano 0:d515a22efe9d 329 *+ | |______________________________________________| |
arelicayetano 0:d515a22efe9d 330 *+ | |
arelicayetano 0:d515a22efe9d 331 *+ | A A |
arelicayetano 0:d515a22efe9d 332 *+ | e d p c g 1 |
arelicayetano 0:d515a22efe9d 333 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 334 *+ | | | | | |
arelicayetano 0:d515a22efe9d 335 *+ | | | | | | p1 = g
arelicayetano 0:d515a22efe9d 336 *+ 1 2 3 4 5 6 p2 = c
arelicayetano 0:d515a22efe9d 337 *+ p3 = d
arelicayetano 0:d515a22efe9d 338 *+ Display: HS-5463BS p4 = e
arelicayetano 0:d515a22efe9d 339 *+ Cátodo Común pu = b
arelicayetano 0:d515a22efe9d 340 *+ pd = f
arelicayetano 0:d515a22efe9d 341 *+
arelicayetano 0:d515a22efe9d 342 *+
arelicayetano 0:d515a22efe9d 343 *+ 16 15 14 13 11
arelicayetano 0:d515a22efe9d 344 *+ | | | | |
arelicayetano 0:d515a22efe9d 345 *+ | | | | |
arelicayetano 0:d515a22efe9d 346 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 347 *+ | b g a c f |
arelicayetano 0:d515a22efe9d 348 *+ | |
arelicayetano 0:d515a22efe9d 349 *+ | ______________________________________________ |
arelicayetano 0:d515a22efe9d 350 *+ | | ____ ____ _____ . _____ | |
arelicayetano 0:d515a22efe9d 351 *+ | | / / / / / / / / | |
arelicayetano 0:d515a22efe9d 352 *+ | | /____ / /____ / . /____ / /____ / | |
arelicayetano 0:d515a22efe9d 353 *+ | | / / / / . / / / / | |
arelicayetano 0:d515a22efe9d 354 *+ | | /____ /. /_____/ . /____ /. /____ /. | |
arelicayetano 0:d515a22efe9d 355 *+ | | | |
arelicayetano 0:d515a22efe9d 356 *+ | |______________________________________________| |
arelicayetano 0:d515a22efe9d 357 *+ | |
arelicayetano 0:d515a22efe9d 358 *+ | A A A A A |
arelicayetano 0:d515a22efe9d 359 *+ | 4 3 d p e 2 p 1 |
arelicayetano 0:d515a22efe9d 360 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 361 *+ | | | | | | | |
arelicayetano 0:d515a22efe9d 362 *+ | | | | | | | |
arelicayetano 0:d515a22efe9d 363 *+ 1 2 3 4 5 6 7 8
arelicayetano 0:d515a22efe9d 364 *+
arelicayetano 0:d515a22efe9d 365 *+ Display: KEM-3942BSR
arelicayetano 0:d515a22efe9d 366 *+
arelicayetano 0:d515a22efe9d 367 +*
arelicayetano 0:d515a22efe9d 368 *+
arelicayetano 0:d515a22efe9d 369 *+ 12 11 10 9 8 7
arelicayetano 0:d515a22efe9d 370 *+ | | | | | |
arelicayetano 0:d515a22efe9d 371 *+ | | | | | |
arelicayetano 0:d515a22efe9d 372 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 373 *+ | A a f A A b |
arelicayetano 0:d515a22efe9d 374 *+ | 4 3 2 |
arelicayetano 0:d515a22efe9d 375 *+ | ______________________________________________ |
arelicayetano 0:d515a22efe9d 376 *+ | | ____ ____ _____ _____ | |
arelicayetano 0:d515a22efe9d 377 *+ | | / / / / / / / / | |
arelicayetano 0:d515a22efe9d 378 *+ | | /____ / /____ / . /____ / /____ / | |
arelicayetano 0:d515a22efe9d 379 *+ | | / / / / . / / / / | |
arelicayetano 0:d515a22efe9d 380 *+ | | /____ /. /_____/ . /____ /. /____ /. | |
arelicayetano 0:d515a22efe9d 381 *+ | | | |
arelicayetano 0:d515a22efe9d 382 *+ | |______________________________________________| |
arelicayetano 0:d515a22efe9d 383 *+ | |
arelicayetano 0:d515a22efe9d 384 *+ | A |
arelicayetano 0:d515a22efe9d 385 *+ | e d p c g 1 |
arelicayetano 0:d515a22efe9d 386 *+ --------------------------------------------------
arelicayetano 0:d515a22efe9d 387 *+ | | | | | |
arelicayetano 0:d515a22efe9d 388 *+ | | | | | |
arelicayetano 0:d515a22efe9d 389 *+ 1 2 3 4 5 6
arelicayetano 0:d515a22efe9d 390 *+
arelicayetano 0:d515a22efe9d 391 *+ Display: FYQ-2841BH
arelicayetano 0:d515a22efe9d 392 *+
arelicayetano 0:d515a22efe9d 393 *+
arelicayetano 0:d515a22efe9d 394 *+ PB_15 PB_14 PB_13 PB_12
arelicayetano 0:d515a22efe9d 395 *+ A4 A3 A2 A1
arelicayetano 0:d515a22efe9d 396 *+ Mill Cent Dec Uni
arelicayetano 0:d515a22efe9d 397 *+
arelicayetano 0:d515a22efe9d 398 *+ STM32-F103C8 PB_4 PB_3 PA_15 PA_12 PA_11 PA_10 PA_9 PA_8 # Hex Offset
arelicayetano 0:d515a22efe9d 399 *+ a
arelicayetano 0:d515a22efe9d 400 *+ ______ g f a b c d e p
arelicayetano 0:d515a22efe9d 401 *+ / / 1 0 0 0 1 0 0 0 0 0x81 0
arelicayetano 0:d515a22efe9d 402 *+ f / g / b 1 1 0 1 1 1 1 0 1 0xE7 1
arelicayetano 0:d515a22efe9d 403 *+ /_____/ 1 0 1 1 0 1 0 0 2 0x49 2
arelicayetano 0:d515a22efe9d 404 *+ / / 1 0 0 1 0 1 0 0 3 0x43 3
arelicayetano 0:d515a22efe9d 405 *+ e / / c 1 1 0 1 0 0 1 0 4 0x27 4
arelicayetano 0:d515a22efe9d 406 *+ /_____/ . 1 0 0 1 0 0 0 1 5 0x13 5
arelicayetano 0:d515a22efe9d 407 *+ d p 1 0 0 0 0 0 0 1 6 0x11 6
arelicayetano 0:d515a22efe9d 408 *+ 1 1 0 1 1 1 0 0 7 0xC7 7
arelicayetano 0:d515a22efe9d 409 *+ 1 0 0 0 0 0 0 0 8 0x01 8
arelicayetano 0:d515a22efe9d 410 *+ 1 0 0 1 0 0 0 0 9 0x03 9
arelicayetano 0:d515a22efe9d 411 *+ 1 1 0 0 0 0 0 0 A 0x05 10
arelicayetano 0:d515a22efe9d 412 *+ 1 0 0 0 0 0 1 1 b 0x31 11
arelicayetano 0:d515a22efe9d 413 *+ 1 0 1 0 1 0 0 1 C 0x99 12
arelicayetano 0:d515a22efe9d 414 *+ 1 0 0 0 0 1 1 0 d 0x61 13
arelicayetano 0:d515a22efe9d 415 *+ 1 0 1 0 0 0 0 1 E 0x19 14
arelicayetano 0:d515a22efe9d 416 *+ 1 1 1 0 0 0 0 1 f 0x1D 15
arelicayetano 0:d515a22efe9d 417 *+ 1 0 0 0 1 0 0 1 G 0x91 16
arelicayetano 0:d515a22efe9d 418 *+ 1 1 0 0 0 0 1 1 h 0x35 17
arelicayetano 0:d515a22efe9d 419 *+ 1 1 0 1 1 1 1 1 i 0xBD 18
arelicayetano 0:d515a22efe9d 420 *+ 1 0 0 0 1 1 1 0 J 0xE3 19
arelicayetano 0:d515a22efe9d 421 *+ 1 0 1 0 0 0 1 0 k 0x2D 20
arelicayetano 0:d515a22efe9d 422 *+ 1 0 1 0 1 0 1 1 L 0xB9 21
arelicayetano 0:d515a22efe9d 423 *+ 1 1 0 0 1 0 0 0 M 0x85 22
arelicayetano 0:d515a22efe9d 424 *+ 1 1 0 0 0 1 1 1 n 0x75 23
arelicayetano 0:d515a22efe9d 425 *+ 1 0 0 0 0 1 1 1 o 0x71 24
arelicayetano 0:d515a22efe9d 426 *+ 1 1 1 0 0 0 0 0 P 0x0D 25
arelicayetano 0:d515a22efe9d 427 *+ 1 1 0 1 0 0 0 0 q 0x07 26
arelicayetano 0:d515a22efe9d 428 *+ 1 1 1 0 0 1 1 1 r 0x7D 27
arelicayetano 0:d515a22efe9d 429 *+ 1 0 0 1 0 0 0 1 s 0x13 28
arelicayetano 0:d515a22efe9d 430 *+ 1 0 1 0 0 0 1 1 t 0x39 29
arelicayetano 0:d515a22efe9d 431 *+ 1 0 0 0 1 1 1 1 u 0xF1 30
arelicayetano 0:d515a22efe9d 432 *+ 1 0 0 0 1 0 1 1 V 0xB1 31
arelicayetano 0:d515a22efe9d 433 *+ 1 0 0 0 1 0 1 0 w 0xA1 32
arelicayetano 0:d515a22efe9d 434 *+ 1 1 0 0 1 0 1 0 X 0x25 33
arelicayetano 0:d515a22efe9d 435 *+ 1 0 0 1 0 0 1 0 y 0x23 34
arelicayetano 0:d515a22efe9d 436 *+ 1 0 1 0 1 1 0 0 Z 0x49 35
arelicayetano 0:d515a22efe9d 437 *+ 1 1 1 1 1 1 1 1 space 0xFF 36
arelicayetano 0:d515a22efe9d 438 *+ 0 1 0 0 0 0 0 1 a 0x41 37
arelicayetano 0:d515a22efe9d 439 *+ 0 0 0 0 1 0 0 1 e 0x09 38
arelicayetano 0:d515a22efe9d 440 *+ 0 0 0 0 0 0 1 1 /e 0x03 39
arelicayetano 0:d515a22efe9d 441 *+ 0 0 0 1 0 0 0 1 @ 0x11 40
arelicayetano 0:d515a22efe9d 442 *+ 0 1 0 1 0 1 0 1 ñ 0x55 41
arelicayetano 0:d515a22efe9d 443 *+ 1 0 0 1 1 0 0 1 [ 0x99 42
arelicayetano 0:d515a22efe9d 444 *+ 0 0 0 0 1 0 0 1 ] 0xC3 43
arelicayetano 0:d515a22efe9d 445 *+ 1 0 1 0 0 0 0 1 U 0xA1 44
arelicayetano 0:d515a22efe9d 446 *+ 1 0 0 0 0 1 0 1 /U 0x85 45
arelicayetano 0:d515a22efe9d 447 *+ 1 1 0 1 1 1 1 1 /_ 0xDF 46
arelicayetano 0:d515a22efe9d 448 *+ 0 1 1 1 1 1 1 1 - 0x7F 47
arelicayetano 0:d515a22efe9d 449 *+ 1 1 1 1 1 0 1 1 _ 0xFB 48
arelicayetano 0:d515a22efe9d 450 *+ 1 1 0 1 1 0 1 1 _/_ 0xDB 49
arelicayetano 0:d515a22efe9d 451 *+ 0 1 1 1 1 0 1 1 /= 0x7B 50
arelicayetano 0:d515a22efe9d 452 *+ 0 1 0 1 1 1 1 1 = 0x5F 51
arelicayetano 0:d515a22efe9d 453 *+ 0 1 0 1 1 0 1 1 == 0x5B 52
arelicayetano 0:d515a22efe9d 454 *+ 0 0 0 0 1 1 1 1 ° 0x0F 53
arelicayetano 0:d515a22efe9d 455 *+ 1 1 1 1 0 0 0 1 + c 0xF1 38
arelicayetano 0:d515a22efe9d 456 *+ 1 1 1 1 0 1 0 0 +/c 0xF4 39
arelicayetano 0:d515a22efe9d 457 *+ 1 0 1 0 0 1 1 1 c 0xA7 40
arelicayetano 0:d515a22efe9d 458 *+ 1 0 0 1 0 1 1 1 /c 0x97 41
arelicayetano 0:d515a22efe9d 459 *+ 1 1 1 1 0 0 1 0 + u 0xF2 42
arelicayetano 0:d515a22efe9d 460 *+ 1 1 1 1 1 0 0 0 + n 0xF8 43
arelicayetano 0:d515a22efe9d 461 *+ 1 0 1 0 1 0 0 1 [ 0xA9 44
arelicayetano 0:d515a22efe9d 462 *+ 1 0 0 1 1 1 0 0 ] 0x9C 45
arelicayetano 0:d515a22efe9d 463 *+ 1 1 1 1 0 0 0 0 ° 0xF0 46
arelicayetano 0:d515a22efe9d 464 *+ 1 1 1 1 1 1 0 0 ¬ 0xFC 47
arelicayetano 0:d515a22efe9d 465 *+ 1 1 1 1 0 1 1 0 + > 0xF6 48
arelicayetano 0:d515a22efe9d 466 *+ 1 1 1 0 0 1 1 1 ^ 0xE7 49
arelicayetano 0:d515a22efe9d 467 *+ 1 0 1 0 1 1 1 1 / < 0xAF 50
arelicayetano 0:d515a22efe9d 468 *+ 1 0 0 1 1 1 1 1 / v 0x9F 51
arelicayetano 0:d515a22efe9d 469 *+ 1 1 0 1 0 1 1 1 > 0xD7 52
arelicayetano 0:d515a22efe9d 470 *+ 1 1 1 1 0 0 1 1 v 0xF3 53
arelicayetano 0:d515a22efe9d 471 *+ 1 1 1 1 1 0 0 1 < 0xF9 54
arelicayetano 0:d515a22efe9d 472 *+ 1 1 1 1 1 1 0 1 / _ 0xBF 55
arelicayetano 0:d515a22efe9d 473 *+ 1 1 1 1 0 1 1 1 - 0xF7 56
arelicayetano 0:d515a22efe9d 474 *+ 1 0 1 1 1 1 1 1 _ 0xFD 57
arelicayetano 0:d515a22efe9d 475 *+ 1 1 1 1 0 1 0 1 = 0xF5 58
arelicayetano 0:d515a22efe9d 476 *+ 1 0 1 1 0 1 1 1 / = 0xB7 59
arelicayetano 0:d515a22efe9d 477 *+ 1 0 1 1 0 1 0 1 == 0xB5 60
arelicayetano 0:d515a22efe9d 478 *+ 1 0 1 1 1 1 0 1 _¬ 0xBD 61
arelicayetano 0:d515a22efe9d 479 *+ 1 1 0 0 1 1 1 1 ii 0xCF 62
arelicayetano 0:d515a22efe9d 480 *+ 1 1 1 1 1 0 1 0 # 0xFA 63
arelicayetano 0:d515a22efe9d 481 *+ 1 0 0 1 1 1 1 0 j 0x9E 64
arelicayetano 0:d515a22efe9d 482 *+ 1 1 0 1 1 1 0 0 /j 0xDC 65
arelicayetano 0:d515a22efe9d 483 *+ 1 1 1 0 1 0 0 1 - j 0xE9 66
arelicayetano 0:d515a22efe9d 484 *+ 1 0 1 0 1 0 1 1 -/j 0xAB 67
arelicayetano 0:d515a22efe9d 485 *+ 1 0 0 0 1 1 1 0 - J 0x8E 68
arelicayetano 0:d515a22efe9d 486 *+ 1 1 0 1 1 0 0 0 -/J 0xD8 69
arelicayetano 0:d515a22efe9d 487 *+ 1 1 1 0 1 0 1 1 | 0xEB 70
arelicayetano 0:d515a22efe9d 488 *+ 1 1 0 0 1 0 1 0 || 0xCA 71
arelicayetano 0:d515a22efe9d 489 *+ 1 1 0 1 0 1 1 0 + 0xD6 72
arelicayetano 0:d515a22efe9d 490 *+ 1 1 1 0 0 0 1 1 /+ 0xE3 73
arelicayetano 0:d515a22efe9d 491 *+ 1 0 0 1 1 0 1 1 espacio 0xFF 74
arelicayetano 0:d515a22efe9d 492 *+
arelicayetano 0:d515a22efe9d 493 *+ Nota: Cada dígito se activa al hacer la señal A correspondiente en "alto"
arelicayetano 0:d515a22efe9d 494 *+ y enviar las señales de los segmentos que se desean encender en "bajo"
arelicayetano 0:d515a22efe9d 495 *+
arelicayetano 0:d515a22efe9d 496 *+----------------------------------------------------------------------------*/
arelicayetano 0:d515a22efe9d 497 /* END documentation */
arelicayetano 0:d515a22efe9d 498 /*
arelicayetano 0:d515a22efe9d 499 +-------------------------------------------------------------------------------
arelicayetano 0:d515a22efe9d 500 | EJERCICIO
arelicayetano 0:d515a22efe9d 501 |
arelicayetano 0:d515a22efe9d 502 | 1.- Implementar el menú para seleccionar entre Modo 0 y Modo 1 por el usuario
arelicayetano 0:d515a22efe9d 503 | 2.- Crear la función para convertir cualquier valor entero a codigo BCD
arelicayetano 0:d515a22efe9d 504 | y representarlo en un buffer de un arreglo de Millares, Centenas, Decenas
arelicayetano 0:d515a22efe9d 505 | y unidades para su despliegue en el display de 7 segmentos.
arelicayetano 0:d515a22efe9d 506 | 3.- Implementar la rutina para eliminación de los ceros a la izquierda
arelicayetano 0:d515a22efe9d 507 | (Blanking).
arelicayetano 0:d515a22efe9d 508 |
arelicayetano 0:d515a22efe9d 509 +------------------------------------------------------------------------------+
arelicayetano 0:d515a22efe9d 510 |
arelicayetano 0:d515a22efe9d 511 | EXAMEN
arelicayetano 0:d515a22efe9d 512 |
arelicayetano 0:d515a22efe9d 513 | 1.- Modificar este programa para:
arelicayetano 0:d515a22efe9d 514 | a) Leer una cadena de caracteres (Mensaje) desde la terminal serial.
arelicayetano 0:d515a22efe9d 515 | b) Convertir todos los caracteres de la cadena a Mayúsculas.
arelicayetano 0:d515a22efe9d 516 |
arelicayetano 0:d515a22efe9d 517 | 2.- Utilizando el generador de caracteres para el display
arelicayetano 0:d515a22efe9d 518 | a) Traducir los caracteres de la cadena a su equivalente de caracteres
arelicayetano 0:d515a22efe9d 519 | para ser desplegados por el display de 7 segmentos.
arelicayetano 0:d515a22efe9d 520 | b) Crear los buffers corresponedientes para depositar las nuevas cadenas
arelicayetano 0:d515a22efe9d 521 | generadas y poderlas desplegar.
arelicayetano 0:d515a22efe9d 522 | c) Delimitar el tamaño del buffer de despliegue para que se ajuste a la
arelicayetano 0:d515a22efe9d 523 | longitud de la cadena a desplegar más 4 especios.
arelicayetano 0:d515a22efe9d 524 | (La longitud para el Buffer para despliegue no debe exceder los 80
arelicayetano 0:d515a22efe9d 525 | caracters).
arelicayetano 0:d515a22efe9d 526 |
arelicayetano 0:d515a22efe9d 527 | Tip.- Consultar la Tabla ASCII
arelicayetano 0:d515a22efe9d 528 | (Para los números, restarles 0x30 y para las letras, restarles 0x37)
arelicayetano 0:d515a22efe9d 529 | (Para la Ñ, restar 0x7C y para el espacio, sumarle 0x04)
arelicayetano 0:d515a22efe9d 530 |
arelicayetano 0:d515a22efe9d 531 | 3.- Utilizando el Convertidor Analógico/Digital.
arelicayetano 0:d515a22efe9d 532 | a) Obtener una medición en representación flotante (0.0 a 1.0) y escalarla
arelicayetano 0:d515a22efe9d 533 | para poder ser representada en formato BCD de 4 dígitos (0-9999).
arelicayetano 0:d515a22efe9d 534 | b) proveer rutinas para poder escalar por medio del punto decimal.
arelicayetano 0:d515a22efe9d 535 |
arelicayetano 0:d515a22efe9d 536 +------------------------------------------------------------------------------+
arelicayetano 0:d515a22efe9d 537 *+ Powered by
arelicayetano 0:d515a22efe9d 538 *+
arelicayetano 0:d515a22efe9d 539 *+ T H E A N T U L I U ' S T E A M R&D Unltd
arelicayetano 0:d515a22efe9d 540 *+
arelicayetano 0:d515a22efe9d 541 *+ Research, Development, Systems, Equipment, Support & Spare Parts.
arelicayetano 0:d515a22efe9d 542 *+ (C) Copyright 1989-2019, All Rights Reserved
arelicayetano 0:d515a22efe9d 543 *+
arelicayetano 0:d515a22efe9d 544 *+ Welcome to The Beaners Proyect Community!
arelicayetano 0:d515a22efe9d 545 *+----------------------------------------------------------------------------*/
arelicayetano 0:d515a22efe9d 546 /* END Mbed */