DCF77 Atomic Clock Module


void dcf77_initialize (void)
const struct tm * dcf77_gettime (void)
unsigned dcf77_input_probe (void)


event_type dcf77_sync
event_type dcf77_update_time

Detailed Description

The DCF77 module gives the time of the day as reported by an external DCF77 receptor connected to the board. The DCF77 emitter uses an atomic clock to provide high precision time (no drift).

The time is sent by the emitter one bit per second, and 60 bits per frame. The complete sequence indicates the time, day, month and year. See http://www.eecis.udel.edu/~mills/ntp/dcf77.htm.

The software module is split into two parts:

  • an upper part provides the API. It is completely generic and does not depend on the board. It detects the synchronization, receives the DCF77 bits and creates a time structure. It raises two events: one for synchronization and one for time update.

  • a bottom part which is board specific and which is responsible for getting one bit from the DCF77 external receptor. This is implemented by the dcf77_input_probe function that is called by the upper part when it needs to.

The synchronization event is raised when synchronization is detected or when it is lost.

The time update event is raised when the first bit is received.

Function Documentation

const struct tm* dcf77_gettime void   

Get the DCF77 UTC time.

Return a pointer to a tm structure which contains the current time (UTC). The structure should not be modified.

void dcf77_initialize void   

Initialize the DCF77 module.

The DCF77 module must be initialized to register a timer handler to poll and analyze the DCF77 input.

unsigned dcf77_input_probe void   

Probe the DCF77 input.

This function must be implemented by the board. It probes the DCF77 input and returns either 0 or 1. It needs not return compute and return the value of the current DCF77 frame bit. That is, the upper layer calls this operation several times per second and determines itself the frame bit based. The frame bit will be 0 when the probe function returns a 1 for less than 100ms and it will be 1 when the duration is arround 200ms.

Variable Documentation

event_type dcf77_sync

Event to report changes in synchronisation state.

Definition at line 96 of file dcf77.h.

event_type dcf77_update_time

Event to notify new date available.

Definition at line 99 of file dcf77.h.