DCF77 Atomic Clock Module
Functions
void dcf77_initialize (void)const struct tm * dcf77_gettime (void)unsigned dcf77_input_probe (void)Variables
event_type dcf77_syncevent_type dcf77_update_timeDetailed 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:
The synchronization event is raised when synchronization is detected or when it is lost.
- 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 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
Copyright (C) 1999, 2000, 2001, 2002, 2003 Stéphane Carrez, France
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.