FORMULA GENERAL numero imaginario o real
Dependencies: mbed STM32F103C8T6_Hello
Diff: main.cpp
- Revision:
- 14:596a61f27f36
- Parent:
- 13:485613003845
--- a/main.cpp Tue Feb 05 08:30:37 2019 +0000 +++ b/main.cpp Fri Sep 13 16:46:51 2019 +0000 @@ -1,17 +1,188 @@ +/* ########################################################################### +** Archivo : main.c +** Proyecto : STM32-F103C8_Plantilla +** Procesador : STM32F103C8 +** Herramienta : Mbed +** Version : Driver 01.01 +** Compilador : GNU C Compiler +** Fecha/Hora : 14-07-2015, 11:48, # CodeGen: 0 +** Descripción : +** Este proyecto muestra la configuracion del uso de la terminal serial +** This module contains user's application code. +** Componentes : Serial, etc . +** Configuraciones : Se puede selecionar entre diferentes velocidades de transmision +** Autores : +** ATEAM Development Group: +** - Antulio Morgado Valle +** +** Versión : Beta +** Revisión : A +** Release : 0 +** Bugs & Fixes : +** Date : 20/10/2019 +** Added support for Led_RGB +** 22/09/2018 +** Added LCD Menu, Beta version (with bugs) +** +** ###########################################################################*/ +/* +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +: Includes +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +*/ #include "mbed.h" +#include "stm32f103c8t6.h" +#include "PinNames.h" +#include "Serial.h" +#include "stdio.h" +#include "math.h" -Serial pc(PA_2, PA_3); // TX, RX -DigitalOut myled(PC_13); // on-board LED +/* +:............................................................................... +: Definiciones +:............................................................................... +*/ +#define on 0 // Estado para boton presionado +#define off 1 // Estado para boton sin presionar +#define hold 2 // Estado para boton mantenido +#define release 3 // Estado para boton liberado +#define FALSE 0 // Estado FASLO +#define TRUE 1 // Estado VERDADERO +/* ++------------------------------------------------------------------------------- +| Configuración de Puertos ++------------------------------------------------------------------------------- +*/ +// Host Pc terminal Comunication channel +Serial terminal (PA_2,PA_3); //Inicioaliza la comunicacion serial a la PC(RX,TX) +//Serial terminal(USBTX,USBRX,1115200);/TX,RX +/* ++------------------------------------------------------------------------------- +| Variables Globales de Usuario ++------------------------------------------------------------------------------- +*/ +uint32_t Baud_Rate = 115200 ; // Velocidad de transmision +/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +| Definición de Funciones Prototipo y Rutinas de los Vectores de Interrupción +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +*/ +void Setup(void); //Function que inicializa la tarjeta; +/* +END definitions */ +/* +#=============================================================================== +| +| P R O G R A M A P R I N C I P A L +| +#=============================================================================== +*/ +int main() +{ +void confSysClock(); +void Setup(); +//apartir de aqui creas tu programa +terminal.printf("Formula General(Chicharronera)"); + int a,b,c; + printf("\t\t Introduce los valores de a,b,c\n"); + float x1,x2,x3; + scanf("%i %i %i",&a,&b,&c); + x3= sqrt(double (b*b)- 4*a*c); + x1=(-b-x3)- 4*a*c/(2*a); + x2=(-b+x3)- 4*a*c/(2*a); + printf("el valor de x1 es %.2f ",x1); + printf("\nel valor de x2 es %.2f ",x2); + if(x3<0) + printf("\nla ecuacion es imaginaria"); + else + printf("\nla ecuacion es real"); + if(x3==0) + printf("\nla ecuacion es compleja"); + +} +/* END main */ + +/* +................................................................................ +: Rutinas de los Vectores de Interrupción +................................................................................ +*/ -int main() -{ - while(1) { - // The on-board LED is connected via a resistor to +3.3V (not to GND). - // So the LED is active on 0 - myled = 0; // turn the LED on - wait_ms(200); // wait 200 millisecond - myled = 1; // turn the LED off - pc.printf("Blink\r\n"); - wait_ms(1000); // wait 1000 millisecond - } +/* +______________________________________________________________________________ +| +| Funciones Prototipo +|_______________________________________________________________________________ +*/ + // Las Funciones Prototipo van aquí ! +void Setup() +{ + terminal.baud(Baud_Rate); + terminal.printf("System is wake up!.\n\t"); } +/* END routines */ + +/* END program */ + +/*+----------------------------------------------------------------------------- +*+ Conexión al Led Testigo: +*+ +*+ Los leds se pueden conectar a cualquier pin que se declare como DigitalOut. +*+ El dispositivo puede drenar hasta 20ma por todas sus salidas a un voltaje de +*+ 3.3V, pero se recomienda no exceder de 1mA por salida. +*+ Esto se logra poniendo una resistencia limitadora de mínimo 330 Ohms. +*+ +*+ 3.3V o 5V +*+ O +*+ | +*+ | +*+ / +*+ \ 1K +*+ / +*+ \ UTILIZANDO LÓGICA NEGATIVA +*+ | +*+ __|__ +*+ \ / +*+ \ / +*+ \ / +*+ _\/_ +*+ | +*+ |__________________________ PIN (Digital Out) +*+ +*+ +*+ +*+ +*+ 1K +*+ +*+ ________/\ /\ /\ ____ PIN (Digital Out) +*+ | \/ \/ \/ +*+ | +*+ | +*+ __|__ +*+ \ / +*+ \ / +*+ \ / UTILIZANDO LÓGICA POSITIVA +*+ _\/_ +*+ | +*+ | +*+ | +*+ __|__ +*+ ___ +*+ _ +*+ _ +*+ +*+ GND +*+ ++---------------------------------------------------------------------------- +*+ +*+ Powered by +*+ +*+ T H E A N T U L I U ' S T E A M R&D Unltd +*+ +*+ Research, Development, Systems, Equipment, Support & Spare Parts. +*+ (C) Copyright 1989-2019, All Rights Reserved +*+ +*+ Welcome to The Beaners Proyect Community! +*+----------------------------------------------------------------------------*/ + +/* END Mbed */ \ No newline at end of file