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: BufferedSerial mbed
main.cpp
00001 /* 00002 * - Proyecto: Accesorios Queclink. 00003 * - Lenguaje: ANSI C/C++ (mbed) 00004 * - Tarjeta: Nucleo F091RC 00005 * - Referencias: 00006 * - Fecha: 2016/May 00007 * - Autor(es): Felícito Manzano / 00008 Mario Vargas 00009 * - Compañia: V.S.R. de Centroamérica 00010 * - País: SV / CR 00011 */ 00012 00013 #include "mbed.h" 00014 #include "BufferedSerial.h" 00015 #include "funciones_basicas.h" 00016 #include "funciones_UFS270.h" 00017 #include "constantes.hpp" 00018 #include <stdio.h> 00019 00020 //HARDWARE SETUP 00021 //*********************************** 00022 extern Serial pcusb(USBTX, USBRX); //Serial ports TX,RX Hardware 00023 extern Serial gv300(PC_10, PC_11); // Para conexión con el GPS GV300 N/W 00024 extern BufferedSerial fuelR1(PB_10, PB_11); // 1er. tanque de combustible 00025 extern DigitalOut myled(LED1); // LED1 Integrado 00026 int contador_tramas = 1; 00027 00028 00029 int main() 00030 { 00031 // CONFIGURAR INTERFACES SERIALES 00032 pcusb.baud(9600); // Common PC Baudrate 00033 gv300.baud(115200); // GV300 USB Default Baudrate 00034 fuelR1.baud(19200); // UFS270 Default Baudrate 00035 00036 // Mensaje de Inicio 00037 booting_gtdat(&gv300, &pcusb); 00038 00039 // Declaración de Variables 00040 // Nivel de combustible UFS270 00041 char level_FuelR1[6] = "-----"; 00042 char sw_StatusR1[2] = "-"; 00043 char hw_StatusR1[2] = "-"; 00044 int eval_Fuel1 = 0; 00045 int contador_TX = 0; 00046 00047 00048 while(1) { 00049 myled = 1; 00050 // Leer UFS270 en el tanque A 00051 pcusb.printf("UFS270 A - INICIA\r\n"); 00052 eval_Fuel1 = ufs270_rtFL(&fuelR1, level_FuelR1, hw_StatusR1, sw_StatusR1); 00053 if (eval_Fuel1) { 00054 pcusb.printf("UFS270_A Altura=%s - OK\r\n",level_FuelR1); 00055 contador_TX++; 00056 } else { 00057 pcusb.printf("UFS270_A - SIN DATOS\r\n"); 00058 } 00059 wait_ms(T_TX); 00060 00061 00062 // Transmitir 00063 if ((eval_Fuel1)&&(contador_TX == 3)){ 00064 // Generar transmisión 00065 pcusb.printf("REPORTE CONSOLIDADO COMBUSTIBLE\r\n"); 00066 pcusb.printf("Inicia comunicacion con CP. Enviando mensaje:\r\n"); 00067 pcusb.printf("%s%sFTMS%s%s%s%c%c%s%04X%s\r\n\n", 00068 CABECERA_TX, CODIGO_INT_FUEL, SEPARADOR, 00069 level_FuelR1, SEPARADOR, hw_StatusR1[0], sw_StatusR1[0], 00070 FIN_CABECERA_TX, contador_tramas, ULTIMO_CARACTER); 00071 wait_ms(T_ESPERA_CP); 00072 00073 gv300.printf("%s%sFTMS%s%s%s%c%c%s%04X%s\r\n", 00074 CABECERA_TX, CODIGO_INT_FUEL, SEPARADOR, 00075 level_FuelR1, SEPARADOR, hw_StatusR1[0], sw_StatusR1[0], 00076 FIN_CABECERA_TX, contador_tramas, ULTIMO_CARACTER); 00077 wait_ms(T_ESPERA_CP); 00078 contador_TX = 0; 00079 incrementar_trama(&contador_tramas); 00080 pcusb.printf("Mensaje escrito en puerto serial del CP\r\n\n"); 00081 wait_ms(T_TX); 00082 00083 } 00084 /* CIERRE */ 00085 00086 pcusb.printf("Contador tx = %d\n", contador_TX); 00087 pcusb.printf("***FIN***\r\n\n"); 00088 strcpy(level_FuelR1,"-----\0"); 00089 strcpy(sw_StatusR1, "-\0"); 00090 strcpy(hw_StatusR1, "-\0"); 00091 eval_Fuel1 = 0; 00092 myled = 0; 00093 wait(2); 00094 } 00095 }
Generated on Thu Jul 14 2022 08:15:15 by
1.7.2