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: CRC16 FreescaleIAP FreescaleWatchdog GGSProtocol LM75B PIMA Parameters PersistentCircularQueue SerialNumberV2COM mbed-dev-watchdog_2016_03_04
Fork of smartRamalKW by
lerEnergiaReativaIndutiva.cpp
00001 #include "appCommands.h" 00002 00003 #ifndef RAMAL 00004 00005 extern Pima pima; 00006 00007 #define SUCESSO 0x00 00008 #define FALHA_COMUNICACAO_MEDIDOR 0xff 00009 #define GRANDEZA_NAO_ENCONTRADA 0xfe 00010 00011 void cmdLerEnergiaReativaIndutiva(){ 00012 char resp[15] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 00013 resp[13] = pima.getTotInductivePower()[2] << 4; 00014 resp[12] = (pima.getTotInductivePower()[1] << 4) | (pima.getTotInductivePower()[2] >> 4); 00015 resp[11] = (pima.getTotInductivePower()[0] << 4) | (pima.getTotInductivePower()[1] >> 4); 00016 resp[10] = pima.getTotInductivePower()[0] >> 4; 00017 00018 if(pima.getTotInductivePower()[0] == 0xff){ // Nao existe uma leitura valida do medidor 00019 if(pima.getMeterNumber()[0] == 0xff){ // Nao existe nenhuma leitura atualizada de medidor 00020 resp[0] = FALHA_COMUNICACAO_MEDIDOR; 00021 } else{ // Nao leu energia reativa indutiva, mas tem alguma leitura atualizada 00022 resp[0] = GRANDEZA_NAO_ENCONTRADA; 00023 } 00024 } else{ 00025 resp[0] = SUCESSO; 00026 } 00027 exec.enviaResposta(RESP_LER_ENERGIA_REATIVA_INDUTIVA, resp, 15); 00028 } 00029 00030 #endif // ndef(RAMAL)
Generated on Thu Jul 14 2022 00:24:57 by
1.7.2
