Hot!How to calculate the difference between two times <time.h>

Page: < 12 Showing page 2 of 2
Author
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/19 09:44:39 (permalink)
-1 (1)
Now I'll come back to the main question ...
 
#21
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/26 03:36:46 (permalink)
0
Good morning everyone.
I'll follow up on my time logic.
From what I've seen, the first thing I should do is type RTCC, create a variable of this type and fill in with the current time, is it?
 
Today with your help I will be able to implement this time function ...
post edited by Neraildes - 2019/01/26 03:44:42
#22
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/26 03:50:29 (permalink)
0
Watch the code below ...
 
typedef union tagRTCC
{ struct
    {
        uint8_t sec;
        uint8_t min;
        uint8_t hr;
        uint8_t wkd;
        uint8_t day;
        uint8_t mth;
        uint8_t yr;
    };
    struct
    { uint16_t prt00;
        uint16_t prt01;
        uint16_t prt10;
        uint16_t prt11;
    };
    struct
    { uint32_t time;
        uint32_t date;
    };
    uint8_t buffer[8];
} RTCC_t;

  RTCC_t _time;

 
Correct me if I'm wrong, but on the last line should not I have a typedef?
 
typedef   RTCC_t _time;
 
 
#23
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/26 04:28:57 (permalink)
0
An error has occurred. Observe the attached figure.

Attached Image(s)

#24
Mysil
Super Member
  • Total Posts : 3204
  • Reward points : 0
  • Joined: 2012/07/01 04:19:50
  • Location: Norway
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/26 07:39:40 (permalink)
0
About message #23:
No, the typedef is in the large block above, defining the union of structures and array.
 
    RTCC_t    _time;  

is the definition of storage of an actual instance of the storage object.
The type of the storage is RTCC_t
Name of the actual instance of the storage structure is:    _time
 
Problem in message #24 is caused by:  struct tm
this structure is specified in include file time.h, which is installed with the compiler.
Are you sure it have been included?
#include <time.h>

 
I haven't tested this in XC8, only XC32 so far.
 
    Mysil
#25
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/26 11:45:56 (permalink)
0
Hi all,
I'm managing to do my time routines for my project. Below are the routines working perfectly (I tested in DEVC ++), however a buffer needs a lot of memory space and I do not have it. This buffer needs 26 bytes, but in fact I need only 10 bytes. Can you change the value of this buffer?
 
unsigned long Time_DateToEpoch(char *date, char *time){
     unsigned int yy,mm,dd,hh,mn,ss;
     char temp[3];
     unsigned long retorno;
     struct tm t;
     time_t t_of_day;

     
     temp[0]=date[0];
     temp[1]=date[1];
     temp[2]=0;
     yy=atoi(temp);
     yy+=100;

     temp[0]=date[3];
     temp[1]=date[4];
     temp[2]=0;
     mm=atoi(temp)-1;
     
     temp[0]=date[6];
     temp[1]=date[7];
     temp[2]=0;
     dd=atoi(temp);
     
     temp[0]=time[0];
     temp[1]=time[1];
     temp[2]=0;
     hh=atoi(temp);
     
     temp[0]=time[3];
     temp[1]=time[4];
     temp[2]=0;
     mn=atoi(temp);
     
     temp[0]=time[6];
     temp[1]=time[7];
     temp[2]=0;
     ss=atoi(temp);
     
      
     t.tm_year = yy;
     t.tm_mon = mm; // Month, 0 - jan
     t.tm_mday = dd; // Day of the month
     t.tm_hour = hh;
     t.tm_min = mn;
     t.tm_sec = ss;
     t.tm_isdst = -1; // Is DST on? 1 = yes, 0 = no, -1 = unknown
     t_of_day = mktime(&t);
     retorno = t_of_day;
    
     return retorno;
}

 
 
void Time_EpochtoDate(long value, char *texto){
     time_t now;
     struct tm ts;
     char buf[10];
    

     now = value;

     // Format time, "ddd yyyy-mm-dd hh:mm:ss zzz"
     ts = *localtime(&now);
     //strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", &ts);
     strftime(buf, sizeof(buf), "%H:%M:%S", &ts);
     strcpy(texto,buf);
}

#26
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/26 11:50:26 (permalink)
0
The message is:
 
C:\Program Files (x86)\Microchip\xc8\v2.00\pic\sources\c90\common\strftime.c:41:: error: (1250) could not find space (26 bytes) for variable _buf
#27
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/26 11:57:37 (permalink)
0
What can I do to increase the program and data memory of my project. Below is the output of the compiler:
 
 
CLEAN SUCCESSFUL (total time: 211ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Dropbox Externo/JJ Cientifica/Lifilizador/03-Firmware/Liofilizador - Placa Mae - MPLAB.X'
make -f nbproject/Makefile-default.mk dist/default/production/Liofilizador_-_Placa_Mae_-_MPLAB.X.production.hex
make[2]: Entering directory 'C:/Dropbox Externo/JJ Cientifica/Lifilizador/03-Firmware/Liofilizador - Placa Mae - MPLAB.X'
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/EEPROM_24C512.p1 EEPROM_24C512.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o "build/default/production/Liofilizador Placa Mae.p1" "Liofilizador Placa Mae.c"
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/I2C.p1 I2C.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/adc.p1 adc.c
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/eeprom.p1 eeprom.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/isr.p1 isr.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/ntc10k.p1 ntc10k.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/proculus.p1 proculus.c
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/pt100.p1 pt100.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/usart.p1 usart.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/protocolo.p1 protocolo.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/Voltagem.p1 Voltagem.c
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/timedate.p1 timedate.c
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -c -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/util.p1 util.c
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe" -mcpu=16F887 -Wl,-Map=dist/default/production/Liofilizador_-_Placa_Mae_-_MPLAB.X.production.map -DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -fno-short-double -fno-short-float -Os -maddrqual=ignore -xassembler-with-cpp -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/Liofilizador_-_Placa_Mae_-_MPLAB.X.production.elf build/default/production/EEPROM_24C512.p1 build/default/production/I2C.p1 "build/default/production/Liofilizador Placa Mae.p1" build/default/production/adc.p1 build/default/production/eeprom.p1 build/default/production/isr.p1 build/default/production/ntc10k.p1 build/default/production/proculus.p1 build/default/production/pt100.p1 build/default/production/usart.p1 build/default/production/Voltagem.p1 build/default/production/protocolo.p1 build/default/production/util.p1 build/default/production/timedate.p1
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
EEPROM_24C512.c:18:: warning: (520) function "_EEPROM_24C512_Read_Byte" is never called
EEPROM_24C512.c:33:: warning: (520) function "_EEPROM_24C512_Write_Int" is never called
EEPROM_24C512.c:44:: warning: (520) function "_EEPROM_24C512_Read_Int" is never called
EEPROM_24C512.c:61:: warning: (520) function "_EEPROM_24C512_Write_Str" is never called
EEPROM_24C512.c:77:: warning: (520) function "_EEPROM_24C512_Read_Str" is never called
EEPROM_24C512.c:96:: warning: (520) function "_Delay_EEPROM_24C512" is never called
I2C.c:18:: warning: (520) function "_I2C_Slave_Init" is never called
I2C.c:37:: warning: (520) function "_I2C_Master_Wait" is never called
I2C.c:42:: warning: (520) function "_I2C_Master_Start" is never called
I2C.c:49:: warning: (520) function "_I2C_Master_RepeatedStart" is never called
I2C.c:55:: warning: (520) function "_I2C_Master_Stop" is never called
I2C.c:61:: warning: (520) function "_I2C_Master_Write" is never called
I2C.c:67:: warning: (520) function "_I2C_Master_Read" is never called
Liofilizador Placa Mae.c:1005:: warning: (520) function "_Comando_Protocolo_Proculus" is never called
Liofilizador Placa Mae.c:1097:: warning: (520) function "_Comando_Protocolo_Serial" is never called
Liofilizador Placa Mae.c:1415:: warning: (520) function "_Inicializar_Seguranca" is never called
Liofilizador Placa Mae.c:1427:: warning: (520) function "_Read_Datalog" is never called
Liofilizador Placa Mae.c:1436:: warning: (520) function "_Write_Datalog" is never called
adc.c:12:: warning: (520) function "_My_ADC_Read" is never called
eeprom.c:94:: warning: (520) function "_EEPROM_Write_Float" is never called
eeprom.c:106:: warning: (520) function "_EEPROM_Read_Float" is never called
eeprom.c:123:: warning: (520) function "_EEPROM_Write_Double" is never called
eeprom.c:136:: warning: (520) function "_EEPROM_Read_Double" is never called
eeprom.c:154:: warning: (520) function "_EEPROM_Write_ULong24" is never called
eeprom.c:169:: warning: (520) function "_EEPROM_Read_ULong24" is never called
eeprom.c:184:: warning: (520) function "_EEPROM_Write_Long32" is never called
eeprom.c:198:: warning: (520) function "_EEPROM_Read_Long32" is never called
ntc10k.c:5:: warning: (520) function "_NTC10K_Read_Temperature" is never called
proculus.c:26:: warning: (520) function "_PROCULUS_Control_Register_Read" is never called
proculus.c:184:: warning: (520) function "_PROCULUS_VP_Write_Byte" is never called
proculus.c:190:: warning: (520) function "_PROCULUS_VP_Read_Byte" is never called
proculus.c:217:: warning: (520) function "_PROCULUS_VP_Write_Int16" is never called
proculus.c:225:: warning: (520) function "_PROCULUS_VP_Read_Int16" is never called
proculus.c:239:: warning: (520) function "_PROCULUS_VP_Write_Long32" is never called
proculus.c:251:: warning: (520) function "_PROCULUS_VP_Read_Long32" is never called
proculus.c:274:: warning: (520) function "_PROCULUS_VP_Write_Float24" is never called
proculus.c:283:: warning: (520) function "_PROCULUS_VP_Read_Float24" is never called
proculus.c:291:: warning: (520) function "_PROCULUS_VP_Write_Float32" is never called
proculus.c:301:: warning: (520) function "_PROCULUS_VP_Read_Float32" is never called
proculus.c:313:: warning: (520) function "_PROCULUS_VP_Write_Double24" is never called
proculus.c:323:: warning: (520) function "_PROCULUS_VP_Read_Double24" is never called
proculus.c:332:: warning: (520) function "_PROCULUS_VP_Write_Double32" is never called
proculus.c:342:: warning: (520) function "_PROCULUS_VP_Read_Double32" is never called
proculus.c:365:: warning: (520) function "_PROCULUS_Read_Version" is never called
proculus.c:388:: warning: (520) function "_PROCULUS_Reset" is never called
proculus.c:483:: warning: (520) function "_PROCULUS_graphic_plot" is never called
pt100.c:5:: warning: (520) function "_PT100_Read_Temperature" is never called
usart.c:104:: warning: (520) function "_USART_putsc" is never called
usart.c:118:: warning: (520) function "_USART_put_buffer" is never called
usart.c:159:: warning: (520) function "_USART_put_sint" is never called
usart.c:165:: warning: (520) function "_USART_put_long" is never called
usart.c:173:: warning: (520) function "_USART_put_float24" is never called
Voltagem.c:6:: warning: (520) function "_VOLTAGEM_read" is never called
timedate.c:9:: warning: (520) function "_Time_DateToEpoch" is never called
timedate.c:64:: warning: (520) function "_Time_EpochtoDate" is never called
isr.c:26:: warning: (1090) variable "_usart_buffersize" is not used
Liofilizador Placa Mae.c:557:: warning: (1090) variable "SaveLiofilizadorOnMemory@CanalAD" is not used
Liofilizador Placa Mae.c:677:: warning: (1090) variable "SetParametersToSlave@SlaveBoard" is not used
Liofilizador Placa Mae.c:680:: warning: (1090) variable "SetParametersToSlave@bb" is not used
Liofilizador Placa Mae.c:715:: warning: (1090) variable "Send_to_PC@i" is not used
Liofilizador Placa Mae.c:741:: warning: (1090) variable "Decodify_Command@tempbyte" is not used
Liofilizador Placa Mae.c:742:: warning: (1090) variable "Decodify_Command@tempint" is not used
Liofilizador Placa Mae.c:743:: warning: (1090) variable "Decodify_Command@vacuo" is not used
Liofilizador Placa Mae.c:792:: warning: (1090) variable "Decodify_Command@data" is not used
Liofilizador Placa Mae.c:1202:: warning: (1090) variable "ShowMessage@center" is not used
Liofilizador Placa Mae.c:1214:: warning: (1090) variable "global_datalog@buffer" is not used
proculus.c:201:: warning: (1090) variable "PROCULUS_VP_Write_UInt16@pt" is not used
usart.c:18:: warning: (1090) variable "USART_init@erro" is not used
Liofilizador Placa Mae.c:287:: warning: (1518) direct function call made with an incomplete prototype (Criar_Indices_no_Banco_de_Dados)
Liofilizador Placa Mae.c:381:: warning: (1518) direct function call made with an incomplete prototype (PROCULUS_Get_Page)
Liofilizador Placa Mae.c:411:: warning: (1518) direct function call made with an incomplete prototype (Check_And_Send_Capture_Datalog)
Liofilizador Placa Mae.c:440:: warning: (1518) direct function call made with an incomplete prototype (PROCULUS_OK)
Liofilizador Placa Mae.c:462:: warning: (1518) direct function call made with an incomplete prototype (PROCULUS_OK)
Liofilizador Placa Mae.c:470:: warning: (1518) direct function call made with an incomplete prototype (Check_And_Send_Capture_Datalog)
Liofilizador Placa Mae.c:560:: warning: (759) expression generates no code
Liofilizador Placa Mae.c:687:: warning: (759) expression generates no code
Liofilizador Placa Mae.c:689:: warning: (759) expression generates no code
Liofilizador Placa Mae.c:783:: warning: (1518) direct function call made with an incomplete prototype (SEND_REPLY_OK)
Liofilizador Placa Mae.c:797:: warning: (1518) direct function call made with an incomplete prototype (SEND_REPLY_OK)
Liofilizador Placa Mae.c:955:: warning: (1518) direct function call made with an incomplete prototype (SEND_REPLY_OK)
Liofilizador Placa Mae.c:1203:: warning: (1518) direct function call made with an incomplete prototype (PROCULUS_OK)
Liofilizador Placa Mae.c:1202:: warning: (759) expression generates no code
Liofilizador Placa Mae.c:1465:: warning: (1518) direct function call made with an incomplete prototype (save_datalog)
proculus.c:202:: warning: (759) expression generates no code
C:\Program Files (x86)\Microchip\xc8\v2.00\pic\sources\c90\common\strftime.c:41:: error: (1250) could not find space (26 bytes) for variable _buf
(908) exit status = 1
nbproject/Makefile-default.mk:317: recipe for target 'dist/default/production/Liofilizador_-_Placa_Mae_-_MPLAB.X.production.hex' failed
make[2]: Leaving directory 'C:/Dropbox Externo/JJ Cientifica/Lifilizador/03-Firmware/Liofilizador - Placa Mae - MPLAB.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Dropbox Externo/JJ Cientifica/Lifilizador/03-Firmware/Liofilizador - Placa Mae - MPLAB.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [dist/default/production/Liofilizador_-_Placa_Mae_-_MPLAB.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 16s)

 
 
 
 
 
 
#28
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 05:45:10 (permalink)
0
 
Observe o código abaixo, o qual estou implementado.
 
    StartTime = daytime(); /* Epoc time */
    while (1)
    {
        CurrentTime = daytime(); /* Epoc time */
        ElapsedTime = CurrentTime - StartTime;
        // More code here
    }

 
I want to do a function that displays the time in the following format:

"hh: mm: ss"

The time has no limit, it can be between 00 and 99 hours ...
 
post edited by Neraildes - 2019/01/27 05:46:36
#29
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 06:02:34 (permalink)
0
I want to use a function as follows:
------------------------------------------------
char text[10];
starttime=nowtime ();
...
epoch2hour (nowtime () - starttime (), text);
------------------------------------------------
The result should be:
Example:
"27:42:38"
post edited by Neraildes - 2019/01/27 06:06:33
#30
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 06:09:36 (permalink)
0
I already have the function that converts date-time to epoch.
#31
crosland
Super Member
  • Total Posts : 1521
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Bucks, UK
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 06:39:27 (permalink)
+1 (1)
Neraildes
 The time has no limit, it can be between 00 and 99 hours ...
 



So it does have a limit?
#32
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 06:42:20 (permalink)
0
crosland
Neraildes
 The time has no limit, it can be between 00 and 99 hours ...
 



So it does have a limit?




Sorry, I was not clear. What I want is unlimited time but I would hardly spend more than 99 hours, so the space to store this value should be 2 bytes.
#33
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 06:45:01 (permalink)
0
 
I found an "epoch to date". Now I need your help to display the time in the format I desire.
 
 
void epoch_to_date_time(date_time_t* date_time,unsigned int epoch)
{
    date_time->second = epoch%60; epoch /= 60;
    date_time->minute = epoch%60; epoch /= 60;
    date_time->hour = epoch%24; epoch /= 24;

    unsigned int years = epoch/(365*4+1)*4; epoch %= 365*4+1;

    unsigned int year;
    for (year=3; year>0; year--)
    {
        if (epoch >= days[year][0])
            break;
    }

    unsigned int month;
    for (month=11; month>0; month--)
    {
        if (epoch >= days[year][month])
            break;
    }

    date_time->year = years+year;
    date_time->month = month+1;
    date_time->day = epoch-days[year][month]+1;
}

#34
crosland
Super Member
  • Total Posts : 1521
  • Reward points : 0
  • Joined: 2005/05/10 10:55:05
  • Location: Bucks, UK
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 07:27:17 (permalink)
+2 (2)
Neraildes
Sorry, I was not clear. What I want is unlimited time but I would hardly spend more than 99 hours, so the space to store this value should be 2 bytes.



That still doesn't make any sense. Either it will (sometimes) be more than 99 hours or it will never be more than 99 hours.
 
Which is it?
 
What is the actual upper limit?
 
You cannot write code based on "maybes".
#35
Neraildes
Super Member
  • Total Posts : 201
  • Reward points : 0
  • Joined: 2017/10/11 07:13:25
  • Location: 0
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 07:35:46 (permalink)
0
crosland
Neraildes
Sorry, I was not clear. What I want is unlimited time but I would hardly spend more than 99 hours, so the space to store this value should be 2 bytes.



That still doesn't make any sense. Either it will (sometimes) be more than 99 hours or it will never be more than 99 hours.
 
Which is it?
 
What is the actual upper limit?
 
You cannot write code based on "maybes".




 
NEVER go beyond 50 hours with 100% certainty
#36
mlp
boots too small
  • Total Posts : 686
  • Reward points : 0
  • Joined: 2012/09/10 15:12:07
  • Location: previously Microchip XC8 team
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 19:43:53 (permalink)
+1 (1)
Neraildes
What can I do to increase the program and data memory of my project. Below is the output of the compiler:

Use a bigger chip.

Mark (this opinion available for hire)
#37
cobusve
Super Member
  • Total Posts : 456
  • Reward points : 0
  • Joined: 2012/04/02 16:15:40
  • Location: Chandler
  • Status: offline
Re: How to calculate the difference between two times <time.h> 2019/01/27 20:40:15 (permalink)
+1 (1)
I scanned your post and could not find any reference to which Microcontroller you are using? How big is your code actually? It may be large because of a small thing you are doing (like printf using floats) in which case you can easily work around that, or the device may be too small for what you are trying to do, in which case you have a very different problem ...
 
It is always a good idea to post as much information as possible!

Also take a look at https://www.microforum.cc/ - a great resource for information on PIC and AVR microcontrollers and embedded programming in general. You can also post questions to the experts there.
#38
NKurzman
A Guy on the Net
  • Total Posts : 16995
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: online
Re: How to calculate the difference between two times <time.h> 2019/01/27 21:42:30 (permalink)
0
They are using a PIC16F887
#39
Page: < 12 Showing page 2 of 2
Jump to:
© 2019 APG vNext Commercial Version 4.5