Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 2:e89eada3e6eb
- Parent:
- 1:a8cbf0b997d2
- Child:
- 3:ab98286e7d09
--- a/main.cpp Tue Sep 17 17:55:12 2019 +0000
+++ b/main.cpp Sun Jun 21 02:48:32 2020 +0000
@@ -3,10 +3,10 @@
** Proyecto : STM32F103C8_Hola_Mundo
** Procesador : STM32F103C8T6
** Plataforma : Blue Pill
-** Herramienta : Mbed Compiler
-** Version : Driver 01.01
-** Compilador : GNU C Compiler
-** Fecha/Hora : 14-07-2015, 11:48, # CodeGen: 0
+** Herramienta : Mbed
+** Compilador : Mbed Online C Compiler
+** Version : Mbed-OS 5.15.0
+** Fecha/Hora : 18-12-2019, 11:48, # CodeGen: 0
** Descripción :
** Este proyecto muestra la configuración y uso de la Terminal Serial
** This module contains user's application code.
@@ -36,6 +36,8 @@
#include "mbed.h"
#include "Serial.h"
#include "stdio.h"
+#include <limits.h>
+#include "wchar.h"
/*
:...............................................................................
: Definiciones
@@ -47,7 +49,11 @@
#define release 3 // Estado para boton liberado
#define FALSE 0 // Estado FALSO
#define TRUE 1 // Estado VERDADERO
-
+#define Baud_Rate 115200 // Velocidad de Transmisión (Bauds)
+ // Velocidades Permitidas:
+ // 300, 600, 1200, 2400, 4800, 9600,
+ // 14400, 19600, 28800, 38400, 57600
+ // 115200, 230400
/*
+-------------------------------------------------------------------------------
| Configuración de Puertos
@@ -63,8 +69,9 @@
| Variables Globales de Usuario
+-------------------------------------------------------------------------------
*/
-uint32_t Baud_Rate = 115200; // Velocidad de Transmisión (Bauds)
-
+uint8_t ch;
+uint16_t uni;
+uint16_t wchar;
/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Definición de Funciones Prototipo y Rutinas de los Vectores de Interrupción
@@ -83,7 +90,8 @@
int main()
{ // Inicialización de variables, puertos e interrupciones
confSysClock(); // Configure system clock (72MHz HSE clock, 48MHz USB clock)
- Setup();
+ Setup();
+terminal.printf ("\tInstituto Politecnico Nacional\n\r");
terminal.printf ("ESCUELA SUPERIOR DE INGENIERIA MECANICA Y ELECTRICA\n\r");
printf ("\vHola Mundo!\r");
printf ("\v\t\vH\ne\nl\nl\no\n \nW\no\nr\nl\nd\n!\r");
@@ -92,7 +100,7 @@
while (TRUE) // El Lazo del Programa principal está aquí !!!
{ // La secuencia de ESCape puede iniciar con \e ó \033 ó \x1B
- printf("\n\r\v\tHola \033[1;37;42mESIME\x1B[0m - \e[127;37;41mIPN\033[0m!!!\n\r\v");
+ printf("\n\r\v\tHola \033[1;37;42mESIME\x1B[0m - \e[1;37;41mIPN\033[0m!!!\n\r\v");
printf ("\033[1;31mEste es un texto rojo.\n\r\033[0m");
printf ("\x1B[1;32mEste es un texto verde.\n\r\x1B[0m");
printf ("\e[1;34mEste es un texto azul.\n\r\e[0m");
@@ -117,10 +125,36 @@
printf("\r\n");
}
}
-// terminal.printf("\a\f\n\r"); //\e[033c
- terminal.printf("\n\a\f\e[7;5;1mBlinking\e[0m\r\n");
- wait(10);
- terminal.printf(" =)\e[2J"); // Clear Screen
+
+ terminal.printf("\e[0m\r\n");
+ terminal.printf("\n\a\f\e[7;5;1mBlinking\e[0m\r\n");
+ printf ("\n\nPresiona cualquier tecla para continuar...");
+ char opcion = terminal.getc();
+ terminal.printf(" =) \e[2J"); // Clear Screen
+ printf("\r\n");
+
+ /* Imprime los caracteres ASCII */
+ for (ch = 0; ch < UCHAR_MAX; ch++)
+ {
+ /* ch == ASCII */
+ printf("\e[1;37;42mHex:\e[1;33;42m %02X \e[1;37;46mASCII:\e[1;33;46m%3d \e[1;37;47mCaracter:\e[1;33;44m %c \033[0m\r\n", ch, ch, ch);
+ wait(0.5);
+ }
+ /* Imprime los caracteres Unicode */
+// wchar_t star = 0x2605;
+// wprintf(L"%c\n", star);
+/*
+ for (uni = 0400; uni < 2000; uni++)
+ {
+ wprintf(L"%c\n", uni);
+ for (ch = 0; ch < UCHAR_MAX; ch++)
+ /* ch == Unicode */
+// printf("%c ==> \\%u\n\r", ch, ch);
+// printf ("\e[1;37;41mCaracter: %c Unicode %d ===> \e[1;33;41m\\%lc \033[0m\n\r",ch, uni, uni );
+// wait(0.5);
+// }
+
+ terminal.printf("\a\f\n\r"); //\e[033c
}
}
/* END main */
@@ -141,8 +175,8 @@
// Las Funciones Prototipo van aquí !
void Setup()
{
- terminal.baud(Baud_Rate); // Se configura la velocidad de transmisión e inicia la comunicación serial.
- terminal.printf("System is Wake Up!.\n\r");
+ terminal.baud(Baud_Rate); // Se configura la velocidad de transmisión
+ terminal.printf("System is Wake Up!.\n\r"); // e inicia la comunicación serial.
}
/* END routines */