Go Down

Topic: DCF77 library for Arduino - synchronize with atomic clock (Read 41515 times) previous topic - next topic

babutian

Hello after downloading the DCF77 lib (including Time and TimeZone) I keep getting the following errors:

Code: [Select]


Build options changed, rebuilding all
\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp: In static member function 'static void DCF77::finalizeBuffer()':

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:160:25: error: 'now' was not declared in this scope

   filledTimestamp = now();

                         ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp: In static member function 'static bool DCF77::receivedTimeUpdate()':

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:189:50: error: 'now' was not declared in this scope

  time_t processedTime = latestupdatedTime + (now() - processingTimestamp);

                                                  ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:197:20: error: 'SECS_PER_MIN' was not declared in this scope

  if(difference < 2*SECS_PER_MIN) {

                    ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:209:25: error: 'SECS_PER_MIN' was not declared in this scope

  if(shiftDifference < 2*SECS_PER_MIN) {

                         ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp: In static member function 'static bool DCF77::processBuffer()':

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:271:2: error: 'tmElements_t' was not declared in this scope

  tmElements_t time;

  ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:284:12: error: request for member 'Second' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

       time.Second = 0;

            ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:285:9: error: request for member 'Minute' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

    time.Minute = rx_buffer->Min-((rx_buffer->Min/16)*6);

         ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:286:12: error: request for member 'Hour' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

       time.Hour   = rx_buffer->Hour-((rx_buffer->Hour/16)*6);

            ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:287:12: error: request for member 'Day' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

       time.Day    = rx_buffer->Day-((rx_buffer->Day/16)*6);

            ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:288:12: error: request for member 'Month' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

       time.Month  = rx_buffer->Month-((rx_buffer->Month/16)*6);

            ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:289:12: error: request for member 'Year' in 'time', which is of non-class type 'time_t(time_t*) {aka long unsigned int(long unsigned int*)}'

       time.Year   = 2000 + rx_buffer->Year-((rx_buffer->Year/16)*6) -1970;

            ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:290:37: error: 'makeTime' was not declared in this scope

    latestupdatedTime = makeTime(time); 

                                     ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp: In static member function 'static time_t DCF77::getTime()':

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:310:48: error: 'now' was not declared in this scope

   time_t currentTime =latestupdatedTime + (now() - processingTimestamp);

                                                ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp: In static member function 'static time_t DCF77::getUTCTime()':

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:325:42: error: 'SECS_PER_HOUR' was not declared in this scope

   int UTCTimeDifference = (CEST ? 2 : 1)*SECS_PER_HOUR;

                                          ^

\\nas\Main\DOCUMENTS\Arduino\libraries\DCF77\DCF77.cpp:326:68: error: 'now' was not declared in this scope

   time_t currentTime =latestupdatedTime - UTCTimeDifference + (now() - processingTimestamp);

                                                                    ^

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.



for just this code:

Code: [Select]
#include "DCF77.h"
#include "Time.h"

 
char time_s[9];
char date_s[11];
 
#define DCF_PIN 2           // Connection pin to DCF 77 device
#define DCF_INTERRUPT 0    // Interrupt number associated with pin
 
time_t t;
DCF77 DCF = DCF77(DCF_PIN,DCF_INTERRUPT);
 
void setup() {
  Serial.begin(9600);
  DCF.Start();
  Serial.println("Warte auf Zeitsignal ... ");
  Serial.println("Dies kann 2 oder mehr Minuten dauern.");
}
 
void loop() {

}
 


Any suggestions would be greatly appreciated!

6v6gt

Try:
#include <TimeLib.h>
Instead of:
#include "Time.h"

babutian

Hi, unfortunately I don't have the timeLib.h file, there is only time.h in the appropriate Time lib folder... Where do I get it?

regards


ProLaser2846

Hi, my name is Mateusz and I'm from west part of Poland, so distortions in signal I received is not bad. Thank you for your library! ;)

My question is, How can I print on lcd or maybe just serial monitor parity bits of DCF77 signal? I have got built a prototype of DCF77 clock and I want to add some gadgets to it. ;P

Thanks and regards! :)

6v6gt

The format of the signal is described here and includes the parity bits:
https://en.wikipedia.org/wiki/DCF77

I guess when you say you want to print the parity bits, you mean you want to print if the parity bit check passed or failed.

CEST/CET timezones (bit 17 and 18) can also be used as a check. These bits cannot be equal.

ProLaser2846

I guess when you say you want to print the parity bits, you mean you want to print if the parity bit check passed or failed.

Exactly!
I want to checks every parity bit in signal (P1, P2, P3 and maybe "S" bit too [yes I know S bit is not a parity bit]) and display it on lcd by

if (parityBitP1 == 1) {
   lcd.print("1");
   }

if (parityBitP2 == 1) ...

But I can't write program that will do this because I don't know how. :/
Can someone help me with that? I don't even know how to start writing this code... :(

6v6gt

You have got the code linked in the OP http://thijs.elenbaas.net/downloads/?did=1 installed and working ?

The parity checking is done here:

Code: [Select]


// Check parities
    if (flags.parityMin == rx_buffer->P1  &&
        flags.parityHour == rx_buffer->P2 &&
        flags.parityDate == rx_buffer->P3 &&
rx_buffer->CEST != rx_buffer->CET)
    { 
    . . .
   // parity ok
    }
    else {
    . . .
       // parity check failed
    }



So, for example, flags.parityMin is the parity pit for Minutes calculated from this bits received in the data stream from the DCF transmitter.
rx_buffer->P1 is the actual parity bit received in the data stream from the DCF transmitter.
Clearly, if the calculated and actual parity bits don't match, there is a parity error.
From that, you should be able to find something to print to the LCD screen.


Go Up